From acd4914c0e1f745e5699e224e15706f804c241ea Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sat, 31 Jan 2015 21:14:28 -0800 Subject: [PATCH 001/162] Rename the main node package filename to match the package name --- Jakefile | 8 ++++++-- package.json | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Jakefile b/Jakefile index 15661debff6..2d6db20d386 100644 --- a/Jakefile +++ b/Jakefile @@ -323,6 +323,7 @@ var tscFile = path.join(builtLocalDirectory, compilerFilename); compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false); var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js"); +var nodePackageFile = path.join(builtLocalDirectory, "typescript.js"); compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, @@ -331,7 +332,10 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca /*outDir*/ undefined, /*preserveConstEnums*/ true, /*keepComments*/ false, - /*noResolve*/ false); + /*noResolve*/ false, + /*callback*/ function () { + jake.cpR(servicesFile, nodePackageFile, {silent: true}); + }); var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts"); var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts"); @@ -425,7 +429,7 @@ task("generate-spec", [specMd]) // Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory desc("Makes a new LKG out of the built js files"); task("LKG", ["clean", "release", "local"].concat(libraryTargets), function() { - var expectedFiles = [tscFile, servicesFile, nodeDefinitionsFile, standaloneDefinitionsFile, internalNodeDefinitionsFile, internalStandaloneDefinitionsFile].concat(libraryTargets); + var expectedFiles = [tscFile, servicesFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, internalNodeDefinitionsFile, internalStandaloneDefinitionsFile].concat(libraryTargets); var missingFiles = expectedFiles.filter(function (f) { return !fs.existsSync(f); }); diff --git a/package.json b/package.json index 2bd89706606..94b5435be19 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "url": "https://github.com/Microsoft/TypeScript.git" }, "preferGlobal": true, - "main": "./bin/typescriptServices.js", + "main": "./bin/typescript.js", "bin": { "tsc": "./bin/tsc" }, From f416cb01c113a6131e3d6c6b7dc156090c6ebb03 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 2 Feb 2015 17:36:45 -0800 Subject: [PATCH 002/162] Explicitly specify ES6 target in computed property test file names. --- ...es10.js => computedPropertyNames10_ES6.js} | 4 ++-- ...ypes => computedPropertyNames10_ES6.types} | 2 +- ...es11.js => computedPropertyNames11_ES6.js} | 4 ++-- ...ypes => computedPropertyNames11_ES6.types} | 2 +- ...=> computedPropertyNames12_ES6.errors.txt} | 24 +++++++++---------- ...es12.js => computedPropertyNames12_ES6.js} | 4 ++-- ...es13.js => computedPropertyNames13_ES6.js} | 4 ++-- ...ypes => computedPropertyNames13_ES6.types} | 2 +- ...=> computedPropertyNames14_ES6.errors.txt} | 14 +++++------ ...es14.js => computedPropertyNames14_ES6.js} | 4 ++-- ...=> computedPropertyNames15_ES6.errors.txt} | 6 ++--- ...es15.js => computedPropertyNames15_ES6.js} | 4 ++-- ...es16.js => computedPropertyNames16_ES6.js} | 4 ++-- ...ypes => computedPropertyNames16_ES6.types} | 2 +- ...=> computedPropertyNames17_ES6.errors.txt} | 14 +++++------ ...es17.js => computedPropertyNames17_ES6.js} | 4 ++-- ...es18.js => computedPropertyNames18_ES6.js} | 4 ++-- ...ypes => computedPropertyNames18_ES6.types} | 2 +- ...=> computedPropertyNames19_ES6.errors.txt} | 4 ++-- ...es19.js => computedPropertyNames19_ES6.js} | 4 ++-- ...ames1.js => computedPropertyNames1_ES6.js} | 4 ++-- ...types => computedPropertyNames1_ES6.types} | 2 +- .../reference/computedPropertyNames20.js | 9 ------- .../reference/computedPropertyNames20_ES6.js | 9 +++++++ ...ypes => computedPropertyNames20_ES6.types} | 2 +- ...=> computedPropertyNames21_ES6.errors.txt} | 4 ++-- ...es21.js => computedPropertyNames21_ES6.js} | 4 ++-- ...es22.js => computedPropertyNames22_ES6.js} | 4 ++-- ...ypes => computedPropertyNames22_ES6.types} | 2 +- ...=> computedPropertyNames23_ES6.errors.txt} | 4 ++-- ...es23.js => computedPropertyNames23_ES6.js} | 4 ++-- ...=> computedPropertyNames24_ES6.errors.txt} | 4 ++-- ...es24.js => computedPropertyNames24_ES6.js} | 4 ++-- ...es25.js => computedPropertyNames25_ES6.js} | 4 ++-- ...ypes => computedPropertyNames25_ES6.types} | 2 +- ...=> computedPropertyNames26_ES6.errors.txt} | 4 ++-- ...es26.js => computedPropertyNames26_ES6.js} | 4 ++-- ...=> computedPropertyNames27_ES6.errors.txt} | 4 ++-- ...es27.js => computedPropertyNames27_ES6.js} | 4 ++-- ...es28.js => computedPropertyNames28_ES6.js} | 4 ++-- ...ypes => computedPropertyNames28_ES6.types} | 2 +- ...es29.js => computedPropertyNames29_ES6.js} | 4 ++-- ...ypes => computedPropertyNames29_ES6.types} | 2 +- ... => computedPropertyNames2_ES6.errors.txt} | 6 ++--- ...ames2.js => computedPropertyNames2_ES6.js} | 4 ++-- ...=> computedPropertyNames30_ES6.errors.txt} | 4 ++-- ...es30.js => computedPropertyNames30_ES6.js} | 4 ++-- ...es31.js => computedPropertyNames31_ES6.js} | 4 ++-- ...ypes => computedPropertyNames31_ES6.types} | 2 +- ...=> computedPropertyNames32_ES6.errors.txt} | 4 ++-- ...es32.js => computedPropertyNames32_ES6.js} | 4 ++-- ...es33.js => computedPropertyNames33_ES6.js} | 4 ++-- ...ypes => computedPropertyNames33_ES6.types} | 2 +- ...=> computedPropertyNames34_ES6.errors.txt} | 4 ++-- ...es34.js => computedPropertyNames34_ES6.js} | 4 ++-- ...=> computedPropertyNames35_ES6.errors.txt} | 6 ++--- ...es35.js => computedPropertyNames35_ES6.js} | 4 ++-- ...=> computedPropertyNames36_ES6.errors.txt} | 4 ++-- ...es36.js => computedPropertyNames36_ES6.js} | 4 ++-- ...es37.js => computedPropertyNames37_ES6.js} | 4 ++-- ...ypes => computedPropertyNames37_ES6.types} | 2 +- ...=> computedPropertyNames38_ES6.errors.txt} | 4 ++-- ...es38.js => computedPropertyNames38_ES6.js} | 4 ++-- ...=> computedPropertyNames39_ES6.errors.txt} | 4 ++-- ...es39.js => computedPropertyNames39_ES6.js} | 4 ++-- ... => computedPropertyNames3_ES6.errors.txt} | 14 +++++------ ...ames3.js => computedPropertyNames3_ES6.js} | 4 ++-- ...=> computedPropertyNames40_ES6.errors.txt} | 4 ++-- ...es40.js => computedPropertyNames40_ES6.js} | 4 ++-- ...es41.js => computedPropertyNames41_ES6.js} | 4 ++-- ...ypes => computedPropertyNames41_ES6.types} | 2 +- ...=> computedPropertyNames42_ES6.errors.txt} | 6 ++--- ...es42.js => computedPropertyNames42_ES6.js} | 4 ++-- ...=> computedPropertyNames43_ES6.errors.txt} | 4 ++-- ...es43.js => computedPropertyNames43_ES6.js} | 4 ++-- ...=> computedPropertyNames44_ES6.errors.txt} | 6 ++--- ...es44.js => computedPropertyNames44_ES6.js} | 4 ++-- ...=> computedPropertyNames45_ES6.errors.txt} | 4 ++-- ...es45.js => computedPropertyNames45_ES6.js} | 4 ++-- .../reference/computedPropertyNames46.js | 9 ------- .../reference/computedPropertyNames46_ES6.js | 9 +++++++ ...ypes => computedPropertyNames46_ES6.types} | 2 +- ...es47.js => computedPropertyNames47_ES6.js} | 4 ++-- ...ypes => computedPropertyNames47_ES6.types} | 2 +- ...es48.js => computedPropertyNames48_ES6.js} | 4 ++-- ...ypes => computedPropertyNames48_ES6.types} | 2 +- ...ames4.js => computedPropertyNames4_ES6.js} | 4 ++-- ...types => computedPropertyNames4_ES6.types} | 2 +- ... => computedPropertyNames5_ES6.errors.txt} | 14 +++++------ ...ames5.js => computedPropertyNames5_ES6.js} | 4 ++-- ... => computedPropertyNames6_ES6.errors.txt} | 6 ++--- ...ames6.js => computedPropertyNames6_ES6.js} | 4 ++-- ...ames7.js => computedPropertyNames7_ES6.js} | 4 ++-- ...types => computedPropertyNames7_ES6.types} | 2 +- ... => computedPropertyNames8_ES6.errors.txt} | 6 ++--- ...ames8.js => computedPropertyNames8_ES6.js} | 4 ++-- ... => computedPropertyNames9_ES6.errors.txt} | 4 ++-- ...ames9.js => computedPropertyNames9_ES6.js} | 4 ++-- ...pertyNamesContextualType10_ES6.errors.txt} | 4 ++-- ...putedPropertyNamesContextualType10_ES6.js} | 4 ++-- ...mputedPropertyNamesContextualType1_ES6.js} | 4 ++-- ...tedPropertyNamesContextualType1_ES6.types} | 2 +- ...mputedPropertyNamesContextualType2_ES6.js} | 4 ++-- ...tedPropertyNamesContextualType2_ES6.types} | 2 +- ...mputedPropertyNamesContextualType3_ES6.js} | 4 ++-- ...tedPropertyNamesContextualType3_ES6.types} | 2 +- ...mputedPropertyNamesContextualType4_ES6.js} | 4 ++-- ...tedPropertyNamesContextualType4_ES6.types} | 2 +- ...mputedPropertyNamesContextualType5_ES6.js} | 4 ++-- ...tedPropertyNamesContextualType5_ES6.types} | 2 +- ...mputedPropertyNamesContextualType6_ES6.js} | 4 ++-- ...tedPropertyNamesContextualType6_ES6.types} | 2 +- ...mputedPropertyNamesContextualType7_ES6.js} | 4 ++-- ...tedPropertyNamesContextualType7_ES6.types} | 2 +- ...opertyNamesContextualType8_ES6.errors.txt} | 4 ++-- ...mputedPropertyNamesContextualType8_ES6.js} | 4 ++-- ...opertyNamesContextualType9_ES6.errors.txt} | 4 ++-- ...mputedPropertyNamesContextualType9_ES6.js} | 4 ++-- ...putedPropertyNamesDeclarationEmit1_ES6.js} | 6 ++--- ...edPropertyNamesDeclarationEmit1_ES6.types} | 2 +- ...putedPropertyNamesDeclarationEmit2_ES6.js} | 6 ++--- ...edPropertyNamesDeclarationEmit2_ES6.types} | 2 +- .../computedPropertyNamesDeclarationEmit3.js | 6 ----- ...pertyNamesDeclarationEmit3_ES6.errors.txt} | 4 ++-- ...mputedPropertyNamesDeclarationEmit3_ES6.js | 6 +++++ .../computedPropertyNamesDeclarationEmit4.js | 7 ------ ...pertyNamesDeclarationEmit4_ES6.errors.txt} | 4 ++-- ...mputedPropertyNamesDeclarationEmit4_ES6.js | 7 ++++++ ...putedPropertyNamesDeclarationEmit5_ES6.js} | 6 ++--- ...edPropertyNamesDeclarationEmit5_ES6.types} | 2 +- ...edPropertyNamesOnOverloads_ES6.errors.txt} | 6 ++--- ...> computedPropertyNamesOnOverloads_ES6.js} | 4 ++-- .../computedPropertyNamesSourceMap1.js.map | 2 -- ...=> computedPropertyNamesSourceMap1_ES6.js} | 6 ++--- ...computedPropertyNamesSourceMap1_ES6.js.map | 2 ++ ...PropertyNamesSourceMap1_ES6.sourcemap.txt} | 14 +++++------ ...computedPropertyNamesSourceMap1_ES6.types} | 2 +- .../computedPropertyNamesSourceMap2.js | 14 ----------- .../computedPropertyNamesSourceMap2.js.map | 2 -- .../computedPropertyNamesSourceMap2_ES6.js | 14 +++++++++++ ...computedPropertyNamesSourceMap2_ES6.js.map | 2 ++ ...PropertyNamesSourceMap2_ES6.sourcemap.txt} | 14 +++++------ ...computedPropertyNamesSourceMap2_ES6.types} | 2 +- ...es10.ts => computedPropertyNames10_ES6.ts} | 0 ...es11.ts => computedPropertyNames11_ES6.ts} | 0 ...es12.ts => computedPropertyNames12_ES6.ts} | 0 ...es13.ts => computedPropertyNames13_ES6.ts} | 0 ...es14.ts => computedPropertyNames14_ES6.ts} | 0 ...es15.ts => computedPropertyNames15_ES6.ts} | 0 ...es16.ts => computedPropertyNames16_ES6.ts} | 0 ...es17.ts => computedPropertyNames17_ES6.ts} | 0 ...es18.ts => computedPropertyNames18_ES6.ts} | 0 ...es19.ts => computedPropertyNames19_ES6.ts} | 0 ...ames1.ts => computedPropertyNames1_ES6.ts} | 0 ...es20.ts => computedPropertyNames20_ES6.ts} | 0 ...es21.ts => computedPropertyNames21_ES6.ts} | 0 ...es22.ts => computedPropertyNames22_ES6.ts} | 0 ...es23.ts => computedPropertyNames23_ES6.ts} | 0 ...es24.ts => computedPropertyNames24_ES6.ts} | 0 ...es25.ts => computedPropertyNames25_ES6.ts} | 0 ...es26.ts => computedPropertyNames26_ES6.ts} | 0 ...es27.ts => computedPropertyNames27_ES6.ts} | 0 ...es28.ts => computedPropertyNames28_ES6.ts} | 0 ...es29.ts => computedPropertyNames29_ES6.ts} | 0 ...ames2.ts => computedPropertyNames2_ES6.ts} | 0 ...es30.ts => computedPropertyNames30_ES6.ts} | 0 ...es31.ts => computedPropertyNames31_ES6.ts} | 0 ...es32.ts => computedPropertyNames32_ES6.ts} | 0 ...es33.ts => computedPropertyNames33_ES6.ts} | 0 ...es34.ts => computedPropertyNames34_ES6.ts} | 0 ...es35.ts => computedPropertyNames35_ES6.ts} | 0 ...es36.ts => computedPropertyNames36_ES6.ts} | 0 ...es37.ts => computedPropertyNames37_ES6.ts} | 0 ...es38.ts => computedPropertyNames38_ES6.ts} | 0 ...es39.ts => computedPropertyNames39_ES6.ts} | 0 ...ames3.ts => computedPropertyNames3_ES6.ts} | 0 ...es40.ts => computedPropertyNames40_ES6.ts} | 0 ...es41.ts => computedPropertyNames41_ES6.ts} | 0 ...es42.ts => computedPropertyNames42_ES6.ts} | 0 ...es43.ts => computedPropertyNames43_ES6.ts} | 0 ...es44.ts => computedPropertyNames44_ES6.ts} | 0 ...es45.ts => computedPropertyNames45_ES6.ts} | 0 ...es46.ts => computedPropertyNames46_ES6.ts} | 0 ...es47.ts => computedPropertyNames47_ES6.ts} | 0 ...es48.ts => computedPropertyNames48_ES6.ts} | 0 ...ames4.ts => computedPropertyNames4_ES6.ts} | 0 ...ames5.ts => computedPropertyNames5_ES6.ts} | 0 ...ames6.ts => computedPropertyNames6_ES6.ts} | 0 ...ames7.ts => computedPropertyNames7_ES6.ts} | 0 ...ames8.ts => computedPropertyNames8_ES6.ts} | 0 ...ames9.ts => computedPropertyNames9_ES6.ts} | 0 ...putedPropertyNamesContextualType10_ES6.ts} | 0 ...mputedPropertyNamesContextualType1_ES6.ts} | 0 ...mputedPropertyNamesContextualType2_ES6.ts} | 0 ...mputedPropertyNamesContextualType3_ES6.ts} | 0 ...mputedPropertyNamesContextualType4_ES6.ts} | 0 ...mputedPropertyNamesContextualType5_ES6.ts} | 0 ...mputedPropertyNamesContextualType6_ES6.ts} | 0 ...mputedPropertyNamesContextualType7_ES6.ts} | 0 ...mputedPropertyNamesContextualType8_ES6.ts} | 0 ...mputedPropertyNamesContextualType9_ES6.ts} | 0 ...putedPropertyNamesDeclarationEmit1_ES6.ts} | 0 ...putedPropertyNamesDeclarationEmit2_ES6.ts} | 0 ...putedPropertyNamesDeclarationEmit3_ES6.ts} | 0 ...putedPropertyNamesDeclarationEmit4_ES6.ts} | 0 ...putedPropertyNamesDeclarationEmit5_ES6.ts} | 0 ...> computedPropertyNamesOnOverloads_ES6.ts} | 0 ...=> computedPropertyNamesSourceMap1_ES6.ts} | 0 ...=> computedPropertyNamesSourceMap2_ES6.ts} | 0 209 files changed, 327 insertions(+), 327 deletions(-) rename tests/baselines/reference/{computedPropertyNames10.js => computedPropertyNames10_ES6.js} (83%) rename tests/baselines/reference/{computedPropertyNames10.types => computedPropertyNames10_ES6.types} (91%) rename tests/baselines/reference/{computedPropertyNames11.js => computedPropertyNames11_ES6.js} (87%) rename tests/baselines/reference/{computedPropertyNames11.types => computedPropertyNames11_ES6.types} (93%) rename tests/baselines/reference/{computedPropertyNames12.errors.txt => computedPropertyNames12_ES6.errors.txt} (64%) rename tests/baselines/reference/{computedPropertyNames12.js => computedPropertyNames12_ES6.js} (84%) rename tests/baselines/reference/{computedPropertyNames13.js => computedPropertyNames13_ES6.js} (88%) rename tests/baselines/reference/{computedPropertyNames13.types => computedPropertyNames13_ES6.types} (89%) rename tests/baselines/reference/{computedPropertyNames14.errors.txt => computedPropertyNames14_ES6.errors.txt} (64%) rename tests/baselines/reference/{computedPropertyNames14.js => computedPropertyNames14_ES6.js} (82%) rename tests/baselines/reference/{computedPropertyNames15.errors.txt => computedPropertyNames15_ES6.errors.txt} (68%) rename tests/baselines/reference/{computedPropertyNames15.js => computedPropertyNames15_ES6.js} (79%) rename tests/baselines/reference/{computedPropertyNames16.js => computedPropertyNames16_ES6.js} (93%) rename tests/baselines/reference/{computedPropertyNames16.types => computedPropertyNames16_ES6.types} (90%) rename tests/baselines/reference/{computedPropertyNames17.errors.txt => computedPropertyNames17_ES6.errors.txt} (65%) rename tests/baselines/reference/{computedPropertyNames17.js => computedPropertyNames17_ES6.js} (90%) rename tests/baselines/reference/{computedPropertyNames18.js => computedPropertyNames18_ES6.js} (60%) rename tests/baselines/reference/{computedPropertyNames18.types => computedPropertyNames18_ES6.types} (86%) rename tests/baselines/reference/{computedPropertyNames19.errors.txt => computedPropertyNames19_ES6.errors.txt} (69%) rename tests/baselines/reference/{computedPropertyNames19.js => computedPropertyNames19_ES6.js} (62%) rename tests/baselines/reference/{computedPropertyNames1.js => computedPropertyNames1_ES6.js} (68%) rename tests/baselines/reference/{computedPropertyNames1.types => computedPropertyNames1_ES6.types} (89%) delete mode 100644 tests/baselines/reference/computedPropertyNames20.js create mode 100644 tests/baselines/reference/computedPropertyNames20_ES6.js rename tests/baselines/reference/{computedPropertyNames20.types => computedPropertyNames20_ES6.types} (84%) rename tests/baselines/reference/{computedPropertyNames21.errors.txt => computedPropertyNames21_ES6.errors.txt} (69%) rename tests/baselines/reference/{computedPropertyNames21.js => computedPropertyNames21_ES6.js} (73%) rename tests/baselines/reference/{computedPropertyNames22.js => computedPropertyNames22_ES6.js} (77%) rename tests/baselines/reference/{computedPropertyNames22.types => computedPropertyNames22_ES6.types} (88%) rename tests/baselines/reference/{computedPropertyNames23.errors.txt => computedPropertyNames23_ES6.errors.txt} (71%) rename tests/baselines/reference/{computedPropertyNames23.js => computedPropertyNames23_ES6.js} (76%) rename tests/baselines/reference/{computedPropertyNames24.errors.txt => computedPropertyNames24_ES6.errors.txt} (77%) rename tests/baselines/reference/{computedPropertyNames24.js => computedPropertyNames24_ES6.js} (89%) rename tests/baselines/reference/{computedPropertyNames25.js => computedPropertyNames25_ES6.js} (88%) rename tests/baselines/reference/{computedPropertyNames25.types => computedPropertyNames25_ES6.types} (89%) rename tests/baselines/reference/{computedPropertyNames26.errors.txt => computedPropertyNames26_ES6.errors.txt} (78%) rename tests/baselines/reference/{computedPropertyNames26.js => computedPropertyNames26_ES6.js} (90%) rename tests/baselines/reference/{computedPropertyNames27.errors.txt => computedPropertyNames27_ES6.errors.txt} (69%) rename tests/baselines/reference/{computedPropertyNames27.js => computedPropertyNames27_ES6.js} (85%) rename tests/baselines/reference/{computedPropertyNames28.js => computedPropertyNames28_ES6.js} (86%) rename tests/baselines/reference/{computedPropertyNames28.types => computedPropertyNames28_ES6.types} (90%) rename tests/baselines/reference/{computedPropertyNames29.js => computedPropertyNames29_ES6.js} (82%) rename tests/baselines/reference/{computedPropertyNames29.types => computedPropertyNames29_ES6.types} (91%) rename tests/baselines/reference/{computedPropertyNames2.errors.txt => computedPropertyNames2_ES6.errors.txt} (72%) rename tests/baselines/reference/{computedPropertyNames2.js => computedPropertyNames2_ES6.js} (90%) rename tests/baselines/reference/{computedPropertyNames30.errors.txt => computedPropertyNames30_ES6.errors.txt} (79%) rename tests/baselines/reference/{computedPropertyNames30.js => computedPropertyNames30_ES6.js} (91%) rename tests/baselines/reference/{computedPropertyNames31.js => computedPropertyNames31_ES6.js} (89%) rename tests/baselines/reference/{computedPropertyNames31.types => computedPropertyNames31_ES6.types} (92%) rename tests/baselines/reference/{computedPropertyNames32.errors.txt => computedPropertyNames32_ES6.errors.txt} (69%) rename tests/baselines/reference/{computedPropertyNames32.js => computedPropertyNames32_ES6.js} (77%) rename tests/baselines/reference/{computedPropertyNames33.js => computedPropertyNames33_ES6.js} (79%) rename tests/baselines/reference/{computedPropertyNames33.types => computedPropertyNames33_ES6.types} (89%) rename tests/baselines/reference/{computedPropertyNames34.errors.txt => computedPropertyNames34_ES6.errors.txt} (74%) rename tests/baselines/reference/{computedPropertyNames34.js => computedPropertyNames34_ES6.js} (79%) rename tests/baselines/reference/{computedPropertyNames35.errors.txt => computedPropertyNames35_ES6.errors.txt} (66%) rename tests/baselines/reference/{computedPropertyNames35.js => computedPropertyNames35_ES6.js} (60%) rename tests/baselines/reference/{computedPropertyNames36.errors.txt => computedPropertyNames36_ES6.errors.txt} (74%) rename tests/baselines/reference/{computedPropertyNames36.js => computedPropertyNames36_ES6.js} (87%) rename tests/baselines/reference/{computedPropertyNames37.js => computedPropertyNames37_ES6.js} (87%) rename tests/baselines/reference/{computedPropertyNames37.types => computedPropertyNames37_ES6.types} (88%) rename tests/baselines/reference/{computedPropertyNames38.errors.txt => computedPropertyNames38_ES6.errors.txt} (74%) rename tests/baselines/reference/{computedPropertyNames38.js => computedPropertyNames38_ES6.js} (87%) rename tests/baselines/reference/{computedPropertyNames39.errors.txt => computedPropertyNames39_ES6.errors.txt} (74%) rename tests/baselines/reference/{computedPropertyNames39.js => computedPropertyNames39_ES6.js} (87%) rename tests/baselines/reference/{computedPropertyNames3.errors.txt => computedPropertyNames3_ES6.errors.txt} (66%) rename tests/baselines/reference/{computedPropertyNames3.js => computedPropertyNames3_ES6.js} (89%) rename tests/baselines/reference/{computedPropertyNames40.errors.txt => computedPropertyNames40_ES6.errors.txt} (73%) rename tests/baselines/reference/{computedPropertyNames40.js => computedPropertyNames40_ES6.js} (84%) rename tests/baselines/reference/{computedPropertyNames41.js => computedPropertyNames41_ES6.js} (81%) rename tests/baselines/reference/{computedPropertyNames41.types => computedPropertyNames41_ES6.types} (88%) rename tests/baselines/reference/{computedPropertyNames42.errors.txt => computedPropertyNames42_ES6.errors.txt} (67%) rename tests/baselines/reference/{computedPropertyNames42.js => computedPropertyNames42_ES6.js} (77%) rename tests/baselines/reference/{computedPropertyNames43.errors.txt => computedPropertyNames43_ES6.errors.txt} (75%) rename tests/baselines/reference/{computedPropertyNames43.js => computedPropertyNames43_ES6.js} (90%) rename tests/baselines/reference/{computedPropertyNames44.errors.txt => computedPropertyNames44_ES6.errors.txt} (70%) rename tests/baselines/reference/{computedPropertyNames44.js => computedPropertyNames44_ES6.js} (89%) rename tests/baselines/reference/{computedPropertyNames45.errors.txt => computedPropertyNames45_ES6.errors.txt} (76%) rename tests/baselines/reference/{computedPropertyNames45.js => computedPropertyNames45_ES6.js} (90%) delete mode 100644 tests/baselines/reference/computedPropertyNames46.js create mode 100644 tests/baselines/reference/computedPropertyNames46_ES6.js rename tests/baselines/reference/{computedPropertyNames46.types => computedPropertyNames46_ES6.types} (83%) rename tests/baselines/reference/{computedPropertyNames47.js => computedPropertyNames47_ES6.js} (73%) rename tests/baselines/reference/{computedPropertyNames47.types => computedPropertyNames47_ES6.types} (86%) rename tests/baselines/reference/{computedPropertyNames48.js => computedPropertyNames48_ES6.js} (86%) rename tests/baselines/reference/{computedPropertyNames48.types => computedPropertyNames48_ES6.types} (93%) rename tests/baselines/reference/{computedPropertyNames4.js => computedPropertyNames4_ES6.js} (82%) rename tests/baselines/reference/{computedPropertyNames4.types => computedPropertyNames4_ES6.types} (91%) rename tests/baselines/reference/{computedPropertyNames5.errors.txt => computedPropertyNames5_ES6.errors.txt} (64%) rename tests/baselines/reference/{computedPropertyNames5.js => computedPropertyNames5_ES6.js} (73%) rename tests/baselines/reference/{computedPropertyNames6.errors.txt => computedPropertyNames6_ES6.errors.txt} (68%) rename tests/baselines/reference/{computedPropertyNames6.js => computedPropertyNames6_ES6.js} (70%) rename tests/baselines/reference/{computedPropertyNames7.js => computedPropertyNames7_ES6.js} (66%) rename tests/baselines/reference/{computedPropertyNames7.types => computedPropertyNames7_ES6.types} (85%) rename tests/baselines/reference/{computedPropertyNames8.errors.txt => computedPropertyNames8_ES6.errors.txt} (68%) rename tests/baselines/reference/{computedPropertyNames8.js => computedPropertyNames8_ES6.js} (70%) rename tests/baselines/reference/{computedPropertyNames9.errors.txt => computedPropertyNames9_ES6.errors.txt} (74%) rename tests/baselines/reference/{computedPropertyNames9.js => computedPropertyNames9_ES6.js} (74%) rename tests/baselines/reference/{computedPropertyNamesContextualType10.errors.txt => computedPropertyNamesContextualType10_ES6.errors.txt} (79%) rename tests/baselines/reference/{computedPropertyNamesContextualType10.js => computedPropertyNamesContextualType10_ES6.js} (55%) rename tests/baselines/reference/{computedPropertyNamesContextualType1.js => computedPropertyNamesContextualType1_ES6.js} (72%) rename tests/baselines/reference/{computedPropertyNamesContextualType1.types => computedPropertyNamesContextualType1_ES6.types} (90%) rename tests/baselines/reference/{computedPropertyNamesContextualType2.js => computedPropertyNamesContextualType2_ES6.js} (72%) rename tests/baselines/reference/{computedPropertyNamesContextualType2.types => computedPropertyNamesContextualType2_ES6.types} (90%) rename tests/baselines/reference/{computedPropertyNamesContextualType3.js => computedPropertyNamesContextualType3_ES6.js} (68%) rename tests/baselines/reference/{computedPropertyNamesContextualType3.types => computedPropertyNamesContextualType3_ES6.types} (89%) rename tests/baselines/reference/{computedPropertyNamesContextualType4.js => computedPropertyNamesContextualType4_ES6.js} (60%) rename tests/baselines/reference/{computedPropertyNamesContextualType4.types => computedPropertyNamesContextualType4_ES6.types} (86%) rename tests/baselines/reference/{computedPropertyNamesContextualType5.js => computedPropertyNamesContextualType5_ES6.js} (58%) rename tests/baselines/reference/{computedPropertyNamesContextualType5.types => computedPropertyNamesContextualType5_ES6.types} (86%) rename tests/baselines/reference/{computedPropertyNamesContextualType6.js => computedPropertyNamesContextualType6_ES6.js} (71%) rename tests/baselines/reference/{computedPropertyNamesContextualType6.types => computedPropertyNamesContextualType6_ES6.types} (91%) rename tests/baselines/reference/{computedPropertyNamesContextualType7.js => computedPropertyNamesContextualType7_ES6.js} (71%) rename tests/baselines/reference/{computedPropertyNamesContextualType7.types => computedPropertyNamesContextualType7_ES6.types} (91%) rename tests/baselines/reference/{computedPropertyNamesContextualType8.errors.txt => computedPropertyNamesContextualType8_ES6.errors.txt} (78%) rename tests/baselines/reference/{computedPropertyNamesContextualType8.js => computedPropertyNamesContextualType8_ES6.js} (61%) rename tests/baselines/reference/{computedPropertyNamesContextualType9.errors.txt => computedPropertyNamesContextualType9_ES6.errors.txt} (78%) rename tests/baselines/reference/{computedPropertyNamesContextualType9.js => computedPropertyNamesContextualType9_ES6.js} (60%) rename tests/baselines/reference/{computedPropertyNamesDeclarationEmit1.js => computedPropertyNamesDeclarationEmit1_ES6.js} (74%) rename tests/baselines/reference/{computedPropertyNamesDeclarationEmit1.types => computedPropertyNamesDeclarationEmit1_ES6.types} (82%) rename tests/baselines/reference/{computedPropertyNamesDeclarationEmit2.js => computedPropertyNamesDeclarationEmit2_ES6.js} (74%) rename tests/baselines/reference/{computedPropertyNamesDeclarationEmit2.types => computedPropertyNamesDeclarationEmit2_ES6.types} (83%) delete mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit3.js rename tests/baselines/reference/{computedPropertyNamesDeclarationEmit3.errors.txt => computedPropertyNamesDeclarationEmit3_ES6.errors.txt} (62%) create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.js delete mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit4.js rename tests/baselines/reference/{computedPropertyNamesDeclarationEmit4.errors.txt => computedPropertyNamesDeclarationEmit4_ES6.errors.txt} (62%) create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.js rename tests/baselines/reference/{computedPropertyNamesDeclarationEmit5.js => computedPropertyNamesDeclarationEmit5_ES6.js} (60%) rename tests/baselines/reference/{computedPropertyNamesDeclarationEmit5.types => computedPropertyNamesDeclarationEmit5_ES6.types} (87%) rename tests/baselines/reference/{computedPropertyNamesOnOverloads.errors.txt => computedPropertyNamesOnOverloads_ES6.errors.txt} (68%) rename tests/baselines/reference/{computedPropertyNamesOnOverloads.js => computedPropertyNamesOnOverloads_ES6.js} (75%) delete mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap1.js.map rename tests/baselines/reference/{computedPropertyNamesSourceMap1.js => computedPropertyNamesSourceMap1_ES6.js} (53%) create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js.map rename tests/baselines/reference/{computedPropertyNamesSourceMap1.sourcemap.txt => computedPropertyNamesSourceMap1_ES6.sourcemap.txt} (85%) rename tests/baselines/reference/{computedPropertyNamesSourceMap1.types => computedPropertyNamesSourceMap1_ES6.types} (76%) delete mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap2.js delete mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap2.js.map create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js.map rename tests/baselines/reference/{computedPropertyNamesSourceMap2.sourcemap.txt => computedPropertyNamesSourceMap2_ES6.sourcemap.txt} (79%) rename tests/baselines/reference/{computedPropertyNamesSourceMap2.types => computedPropertyNamesSourceMap2_ES6.types} (81%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames10.ts => computedPropertyNames10_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames11.ts => computedPropertyNames11_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames12.ts => computedPropertyNames12_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames13.ts => computedPropertyNames13_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames14.ts => computedPropertyNames14_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames15.ts => computedPropertyNames15_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames16.ts => computedPropertyNames16_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames17.ts => computedPropertyNames17_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames18.ts => computedPropertyNames18_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames19.ts => computedPropertyNames19_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames1.ts => computedPropertyNames1_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames20.ts => computedPropertyNames20_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames21.ts => computedPropertyNames21_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames22.ts => computedPropertyNames22_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames23.ts => computedPropertyNames23_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames24.ts => computedPropertyNames24_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames25.ts => computedPropertyNames25_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames26.ts => computedPropertyNames26_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames27.ts => computedPropertyNames27_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames28.ts => computedPropertyNames28_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames29.ts => computedPropertyNames29_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames2.ts => computedPropertyNames2_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames30.ts => computedPropertyNames30_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames31.ts => computedPropertyNames31_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames32.ts => computedPropertyNames32_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames33.ts => computedPropertyNames33_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames34.ts => computedPropertyNames34_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames35.ts => computedPropertyNames35_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames36.ts => computedPropertyNames36_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames37.ts => computedPropertyNames37_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames38.ts => computedPropertyNames38_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames39.ts => computedPropertyNames39_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames3.ts => computedPropertyNames3_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames40.ts => computedPropertyNames40_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames41.ts => computedPropertyNames41_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames42.ts => computedPropertyNames42_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames43.ts => computedPropertyNames43_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames44.ts => computedPropertyNames44_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames45.ts => computedPropertyNames45_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames46.ts => computedPropertyNames46_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames47.ts => computedPropertyNames47_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames48.ts => computedPropertyNames48_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames4.ts => computedPropertyNames4_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames5.ts => computedPropertyNames5_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames6.ts => computedPropertyNames6_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames7.ts => computedPropertyNames7_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames8.ts => computedPropertyNames8_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNames9.ts => computedPropertyNames9_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNamesContextualType10.ts => computedPropertyNamesContextualType10_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNamesContextualType1.ts => computedPropertyNamesContextualType1_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNamesContextualType2.ts => computedPropertyNamesContextualType2_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNamesContextualType3.ts => computedPropertyNamesContextualType3_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNamesContextualType4.ts => computedPropertyNamesContextualType4_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNamesContextualType5.ts => computedPropertyNamesContextualType5_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNamesContextualType6.ts => computedPropertyNamesContextualType6_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNamesContextualType7.ts => computedPropertyNamesContextualType7_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNamesContextualType8.ts => computedPropertyNamesContextualType8_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNamesContextualType9.ts => computedPropertyNamesContextualType9_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNamesDeclarationEmit1.ts => computedPropertyNamesDeclarationEmit1_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNamesDeclarationEmit2.ts => computedPropertyNamesDeclarationEmit2_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNamesDeclarationEmit3.ts => computedPropertyNamesDeclarationEmit3_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNamesDeclarationEmit4.ts => computedPropertyNamesDeclarationEmit4_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNamesDeclarationEmit5.ts => computedPropertyNamesDeclarationEmit5_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNamesOnOverloads.ts => computedPropertyNamesOnOverloads_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNamesSourceMap1.ts => computedPropertyNamesSourceMap1_ES6.ts} (100%) rename tests/cases/conformance/es6/computedProperties/{computedPropertyNamesSourceMap2.ts => computedPropertyNamesSourceMap2_ES6.ts} (100%) diff --git a/tests/baselines/reference/computedPropertyNames10.js b/tests/baselines/reference/computedPropertyNames10_ES6.js similarity index 83% rename from tests/baselines/reference/computedPropertyNames10.js rename to tests/baselines/reference/computedPropertyNames10_ES6.js index 138cbd7a4b2..72613b5c829 100644 --- a/tests/baselines/reference/computedPropertyNames10.js +++ b/tests/baselines/reference/computedPropertyNames10_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames10.ts] +//// [computedPropertyNames10_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ var v = { [`hello ${a} bye`]() { } } -//// [computedPropertyNames10.js] +//// [computedPropertyNames10_ES6.js] var s; var n; var a; diff --git a/tests/baselines/reference/computedPropertyNames10.types b/tests/baselines/reference/computedPropertyNames10_ES6.types similarity index 91% rename from tests/baselines/reference/computedPropertyNames10.types rename to tests/baselines/reference/computedPropertyNames10_ES6.types index 29bf6c43bef..5dcc4783b5e 100644 --- a/tests/baselines/reference/computedPropertyNames10.types +++ b/tests/baselines/reference/computedPropertyNames10_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames10.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES6.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames11.js b/tests/baselines/reference/computedPropertyNames11_ES6.js similarity index 87% rename from tests/baselines/reference/computedPropertyNames11.js rename to tests/baselines/reference/computedPropertyNames11_ES6.js index d82a7c4e512..63f786e4634 100644 --- a/tests/baselines/reference/computedPropertyNames11.js +++ b/tests/baselines/reference/computedPropertyNames11_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames11.ts] +//// [computedPropertyNames11_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ var v = { get [`hello ${a} bye`]() { return 0; } } -//// [computedPropertyNames11.js] +//// [computedPropertyNames11_ES6.js] var s; var n; var a; diff --git a/tests/baselines/reference/computedPropertyNames11.types b/tests/baselines/reference/computedPropertyNames11_ES6.types similarity index 93% rename from tests/baselines/reference/computedPropertyNames11.types rename to tests/baselines/reference/computedPropertyNames11_ES6.types index ee0796320d6..a0b9e6eb99e 100644 --- a/tests/baselines/reference/computedPropertyNames11.types +++ b/tests/baselines/reference/computedPropertyNames11_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames11.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES6.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames12.errors.txt b/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt similarity index 64% rename from tests/baselines/reference/computedPropertyNames12.errors.txt rename to tests/baselines/reference/computedPropertyNames12_ES6.errors.txt index 56774fe8dae..ecdf50aa31f 100644 --- a/tests/baselines/reference/computedPropertyNames12.errors.txt +++ b/tests/baselines/reference/computedPropertyNames12_ES6.errors.txt @@ -1,17 +1,17 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(5,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(6,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(7,12): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(10,12): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(11,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(12,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(13,12): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(14,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(15,12): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(5,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(6,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(7,12): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(10,12): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(11,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(12,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(13,12): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(14,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts(15,12): error TS1166: Computed property names are not allowed in class property declarations. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts (11 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts (11 errors) ==== var s: string; var n: number; var a: any; diff --git a/tests/baselines/reference/computedPropertyNames12.js b/tests/baselines/reference/computedPropertyNames12_ES6.js similarity index 84% rename from tests/baselines/reference/computedPropertyNames12.js rename to tests/baselines/reference/computedPropertyNames12_ES6.js index 5e5dec0c549..5ab6e4c09b3 100644 --- a/tests/baselines/reference/computedPropertyNames12.js +++ b/tests/baselines/reference/computedPropertyNames12_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames12.ts] +//// [computedPropertyNames12_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ class C { static [`hello ${a} bye`] = 0 } -//// [computedPropertyNames12.js] +//// [computedPropertyNames12_ES6.js] var s; var n; var a; diff --git a/tests/baselines/reference/computedPropertyNames13.js b/tests/baselines/reference/computedPropertyNames13_ES6.js similarity index 88% rename from tests/baselines/reference/computedPropertyNames13.js rename to tests/baselines/reference/computedPropertyNames13_ES6.js index ea531a9c644..07aa1673aba 100644 --- a/tests/baselines/reference/computedPropertyNames13.js +++ b/tests/baselines/reference/computedPropertyNames13_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames13.ts] +//// [computedPropertyNames13_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ class C { static [`hello ${a} bye`]() { } } -//// [computedPropertyNames13.js] +//// [computedPropertyNames13_ES6.js] var s; var n; var a; diff --git a/tests/baselines/reference/computedPropertyNames13.types b/tests/baselines/reference/computedPropertyNames13_ES6.types similarity index 89% rename from tests/baselines/reference/computedPropertyNames13.types rename to tests/baselines/reference/computedPropertyNames13_ES6.types index 4f267f2e893..78b2f3afc4a 100644 --- a/tests/baselines/reference/computedPropertyNames13.types +++ b/tests/baselines/reference/computedPropertyNames13_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames13.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES6.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames14.errors.txt b/tests/baselines/reference/computedPropertyNames14_ES6.errors.txt similarity index 64% rename from tests/baselines/reference/computedPropertyNames14.errors.txt rename to tests/baselines/reference/computedPropertyNames14_ES6.errors.txt index 1cf5b1445f2..829a0f0289f 100644 --- a/tests/baselines/reference/computedPropertyNames14.errors.txt +++ b/tests/baselines/reference/computedPropertyNames14_ES6.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts (6 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts (6 errors) ==== var b: boolean; class C { [b]() {} diff --git a/tests/baselines/reference/computedPropertyNames14.js b/tests/baselines/reference/computedPropertyNames14_ES6.js similarity index 82% rename from tests/baselines/reference/computedPropertyNames14.js rename to tests/baselines/reference/computedPropertyNames14_ES6.js index aa551795da6..7a58ad9a80a 100644 --- a/tests/baselines/reference/computedPropertyNames14.js +++ b/tests/baselines/reference/computedPropertyNames14_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames14.ts] +//// [computedPropertyNames14_ES6.ts] var b: boolean; class C { [b]() {} @@ -9,7 +9,7 @@ class C { static [null]() { } } -//// [computedPropertyNames14.js] +//// [computedPropertyNames14_ES6.js] var b; var C = (function () { function C() { diff --git a/tests/baselines/reference/computedPropertyNames15.errors.txt b/tests/baselines/reference/computedPropertyNames15_ES6.errors.txt similarity index 68% rename from tests/baselines/reference/computedPropertyNames15.errors.txt rename to tests/baselines/reference/computedPropertyNames15_ES6.errors.txt index 0e759668a95..804040772e2 100644 --- a/tests/baselines/reference/computedPropertyNames15.errors.txt +++ b/tests/baselines/reference/computedPropertyNames15_ES6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts (2 errors) ==== var p1: number | string; var p2: number | number[]; var p3: string | boolean; diff --git a/tests/baselines/reference/computedPropertyNames15.js b/tests/baselines/reference/computedPropertyNames15_ES6.js similarity index 79% rename from tests/baselines/reference/computedPropertyNames15.js rename to tests/baselines/reference/computedPropertyNames15_ES6.js index 1b506bbeb90..70c2e7b451c 100644 --- a/tests/baselines/reference/computedPropertyNames15.js +++ b/tests/baselines/reference/computedPropertyNames15_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames15.ts] +//// [computedPropertyNames15_ES6.ts] var p1: number | string; var p2: number | number[]; var p3: string | boolean; @@ -8,7 +8,7 @@ class C { [p3]() { } } -//// [computedPropertyNames15.js] +//// [computedPropertyNames15_ES6.js] var p1; var p2; var p3; diff --git a/tests/baselines/reference/computedPropertyNames16.js b/tests/baselines/reference/computedPropertyNames16_ES6.js similarity index 93% rename from tests/baselines/reference/computedPropertyNames16.js rename to tests/baselines/reference/computedPropertyNames16_ES6.js index 295deb9ee82..90f15f6cf2e 100644 --- a/tests/baselines/reference/computedPropertyNames16.js +++ b/tests/baselines/reference/computedPropertyNames16_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames16.ts] +//// [computedPropertyNames16_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ class C { get [`hello ${a} bye`]() { return 0; } } -//// [computedPropertyNames16.js] +//// [computedPropertyNames16_ES6.js] var s; var n; var a; diff --git a/tests/baselines/reference/computedPropertyNames16.types b/tests/baselines/reference/computedPropertyNames16_ES6.types similarity index 90% rename from tests/baselines/reference/computedPropertyNames16.types rename to tests/baselines/reference/computedPropertyNames16_ES6.types index ccfa7996066..6503c75037d 100644 --- a/tests/baselines/reference/computedPropertyNames16.types +++ b/tests/baselines/reference/computedPropertyNames16_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames16.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES6.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames17.errors.txt b/tests/baselines/reference/computedPropertyNames17_ES6.errors.txt similarity index 65% rename from tests/baselines/reference/computedPropertyNames17.errors.txt rename to tests/baselines/reference/computedPropertyNames17_ES6.errors.txt index b236ae3245e..9e97b0202cb 100644 --- a/tests/baselines/reference/computedPropertyNames17.errors.txt +++ b/tests/baselines/reference/computedPropertyNames17_ES6.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts (6 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts (6 errors) ==== var b: boolean; class C { get [b]() { return 0;} diff --git a/tests/baselines/reference/computedPropertyNames17.js b/tests/baselines/reference/computedPropertyNames17_ES6.js similarity index 90% rename from tests/baselines/reference/computedPropertyNames17.js rename to tests/baselines/reference/computedPropertyNames17_ES6.js index 5a55dbf7e1b..e9b19202e08 100644 --- a/tests/baselines/reference/computedPropertyNames17.js +++ b/tests/baselines/reference/computedPropertyNames17_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames17.ts] +//// [computedPropertyNames17_ES6.ts] var b: boolean; class C { get [b]() { return 0;} @@ -9,7 +9,7 @@ class C { set [null](v) { } } -//// [computedPropertyNames17.js] +//// [computedPropertyNames17_ES6.js] var b; var C = (function () { function C() { diff --git a/tests/baselines/reference/computedPropertyNames18.js b/tests/baselines/reference/computedPropertyNames18_ES6.js similarity index 60% rename from tests/baselines/reference/computedPropertyNames18.js rename to tests/baselines/reference/computedPropertyNames18_ES6.js index af2d68b3095..fbf840feb31 100644 --- a/tests/baselines/reference/computedPropertyNames18.js +++ b/tests/baselines/reference/computedPropertyNames18_ES6.js @@ -1,11 +1,11 @@ -//// [computedPropertyNames18.ts] +//// [computedPropertyNames18_ES6.ts] function foo() { var obj = { [this.bar]: 0 } } -//// [computedPropertyNames18.js] +//// [computedPropertyNames18_ES6.js] function foo() { var obj = { [this.bar]: 0 diff --git a/tests/baselines/reference/computedPropertyNames18.types b/tests/baselines/reference/computedPropertyNames18_ES6.types similarity index 86% rename from tests/baselines/reference/computedPropertyNames18.types rename to tests/baselines/reference/computedPropertyNames18_ES6.types index 0976e5fc3ca..af7081fa2ad 100644 --- a/tests/baselines/reference/computedPropertyNames18.types +++ b/tests/baselines/reference/computedPropertyNames18_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames18.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES6.ts === function foo() { >foo : () => void diff --git a/tests/baselines/reference/computedPropertyNames19.errors.txt b/tests/baselines/reference/computedPropertyNames19_ES6.errors.txt similarity index 69% rename from tests/baselines/reference/computedPropertyNames19.errors.txt rename to tests/baselines/reference/computedPropertyNames19_ES6.errors.txt index 2037008992f..9e2d1afbe74 100644 --- a/tests/baselines/reference/computedPropertyNames19.errors.txt +++ b/tests/baselines/reference/computedPropertyNames19_ES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts(3,10): error TS2331: 'this' cannot be referenced in a module body. +tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts(3,10): error TS2331: 'this' cannot be referenced in a module body. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts (1 errors) ==== module M { var obj = { [this.bar]: 0 diff --git a/tests/baselines/reference/computedPropertyNames19.js b/tests/baselines/reference/computedPropertyNames19_ES6.js similarity index 62% rename from tests/baselines/reference/computedPropertyNames19.js rename to tests/baselines/reference/computedPropertyNames19_ES6.js index 3fd2f99eea6..99ebde491ec 100644 --- a/tests/baselines/reference/computedPropertyNames19.js +++ b/tests/baselines/reference/computedPropertyNames19_ES6.js @@ -1,11 +1,11 @@ -//// [computedPropertyNames19.ts] +//// [computedPropertyNames19_ES6.ts] module M { var obj = { [this.bar]: 0 } } -//// [computedPropertyNames19.js] +//// [computedPropertyNames19_ES6.js] var M; (function (M) { var obj = { diff --git a/tests/baselines/reference/computedPropertyNames1.js b/tests/baselines/reference/computedPropertyNames1_ES6.js similarity index 68% rename from tests/baselines/reference/computedPropertyNames1.js rename to tests/baselines/reference/computedPropertyNames1_ES6.js index 8f3e448d698..86cdd9c4333 100644 --- a/tests/baselines/reference/computedPropertyNames1.js +++ b/tests/baselines/reference/computedPropertyNames1_ES6.js @@ -1,10 +1,10 @@ -//// [computedPropertyNames1.ts] +//// [computedPropertyNames1_ES6.ts] var v = { get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error } -//// [computedPropertyNames1.js] +//// [computedPropertyNames1_ES6.js] var v = { get [0 + 1]() { return 0; diff --git a/tests/baselines/reference/computedPropertyNames1.types b/tests/baselines/reference/computedPropertyNames1_ES6.types similarity index 89% rename from tests/baselines/reference/computedPropertyNames1.types rename to tests/baselines/reference/computedPropertyNames1_ES6.types index b44aa3c69d0..966cfef579d 100644 --- a/tests/baselines/reference/computedPropertyNames1.types +++ b/tests/baselines/reference/computedPropertyNames1_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES6.ts === var v = { >v : {} >{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : {} diff --git a/tests/baselines/reference/computedPropertyNames20.js b/tests/baselines/reference/computedPropertyNames20.js deleted file mode 100644 index 2a1edf06142..00000000000 --- a/tests/baselines/reference/computedPropertyNames20.js +++ /dev/null @@ -1,9 +0,0 @@ -//// [computedPropertyNames20.ts] -var obj = { - [this.bar]: 0 -} - -//// [computedPropertyNames20.js] -var obj = { - [this.bar]: 0 -}; diff --git a/tests/baselines/reference/computedPropertyNames20_ES6.js b/tests/baselines/reference/computedPropertyNames20_ES6.js new file mode 100644 index 00000000000..c128d8c0f85 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames20_ES6.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames20_ES6.ts] +var obj = { + [this.bar]: 0 +} + +//// [computedPropertyNames20_ES6.js] +var obj = { + [this.bar]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames20.types b/tests/baselines/reference/computedPropertyNames20_ES6.types similarity index 84% rename from tests/baselines/reference/computedPropertyNames20.types rename to tests/baselines/reference/computedPropertyNames20_ES6.types index abd1b203e87..2280c7c4820 100644 --- a/tests/baselines/reference/computedPropertyNames20.types +++ b/tests/baselines/reference/computedPropertyNames20_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames20.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES6.ts === var obj = { >obj : {} >{ [this.bar]: 0} : {} diff --git a/tests/baselines/reference/computedPropertyNames21.errors.txt b/tests/baselines/reference/computedPropertyNames21_ES6.errors.txt similarity index 69% rename from tests/baselines/reference/computedPropertyNames21.errors.txt rename to tests/baselines/reference/computedPropertyNames21_ES6.errors.txt index a44c8d60ee8..064e086cd5c 100644 --- a/tests/baselines/reference/computedPropertyNames21.errors.txt +++ b/tests/baselines/reference/computedPropertyNames21_ES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts(5,6): error TS2465: 'this' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES6.ts(5,6): error TS2465: 'this' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES6.ts (1 errors) ==== class C { bar() { return 0; diff --git a/tests/baselines/reference/computedPropertyNames21.js b/tests/baselines/reference/computedPropertyNames21_ES6.js similarity index 73% rename from tests/baselines/reference/computedPropertyNames21.js rename to tests/baselines/reference/computedPropertyNames21_ES6.js index 250d9142aa5..f51f6faed24 100644 --- a/tests/baselines/reference/computedPropertyNames21.js +++ b/tests/baselines/reference/computedPropertyNames21_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames21.ts] +//// [computedPropertyNames21_ES6.ts] class C { bar() { return 0; @@ -6,7 +6,7 @@ class C { [this.bar()]() { } } -//// [computedPropertyNames21.js] +//// [computedPropertyNames21_ES6.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames22.js b/tests/baselines/reference/computedPropertyNames22_ES6.js similarity index 77% rename from tests/baselines/reference/computedPropertyNames22.js rename to tests/baselines/reference/computedPropertyNames22_ES6.js index b42946536d0..9872605c20e 100644 --- a/tests/baselines/reference/computedPropertyNames22.js +++ b/tests/baselines/reference/computedPropertyNames22_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames22.ts] +//// [computedPropertyNames22_ES6.ts] class C { bar() { var obj = { @@ -8,7 +8,7 @@ class C { } } -//// [computedPropertyNames22.js] +//// [computedPropertyNames22_ES6.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames22.types b/tests/baselines/reference/computedPropertyNames22_ES6.types similarity index 88% rename from tests/baselines/reference/computedPropertyNames22.types rename to tests/baselines/reference/computedPropertyNames22_ES6.types index d23546192c0..b65f276881f 100644 --- a/tests/baselines/reference/computedPropertyNames22.types +++ b/tests/baselines/reference/computedPropertyNames22_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames22.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES6.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNames23.errors.txt b/tests/baselines/reference/computedPropertyNames23_ES6.errors.txt similarity index 71% rename from tests/baselines/reference/computedPropertyNames23.errors.txt rename to tests/baselines/reference/computedPropertyNames23_ES6.errors.txt index 0846ba4d6c6..0af5504f22a 100644 --- a/tests/baselines/reference/computedPropertyNames23.errors.txt +++ b/tests/baselines/reference/computedPropertyNames23_ES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts(6,12): error TS2465: 'this' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES6.ts(6,12): error TS2465: 'this' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES6.ts (1 errors) ==== class C { bar() { return 0; diff --git a/tests/baselines/reference/computedPropertyNames23.js b/tests/baselines/reference/computedPropertyNames23_ES6.js similarity index 76% rename from tests/baselines/reference/computedPropertyNames23.js rename to tests/baselines/reference/computedPropertyNames23_ES6.js index 9d71ef34c1e..1f78f5c366b 100644 --- a/tests/baselines/reference/computedPropertyNames23.js +++ b/tests/baselines/reference/computedPropertyNames23_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames23.ts] +//// [computedPropertyNames23_ES6.ts] class C { bar() { return 0; @@ -8,7 +8,7 @@ class C { ]() { } } -//// [computedPropertyNames23.js] +//// [computedPropertyNames23_ES6.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames24.errors.txt b/tests/baselines/reference/computedPropertyNames24_ES6.errors.txt similarity index 77% rename from tests/baselines/reference/computedPropertyNames24.errors.txt rename to tests/baselines/reference/computedPropertyNames24_ES6.errors.txt index 938fb64b82e..cab0ba6a85c 100644 --- a/tests/baselines/reference/computedPropertyNames24.errors.txt +++ b/tests/baselines/reference/computedPropertyNames24_ES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts(9,6): error TS2466: 'super' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES6.ts(9,6): error TS2466: 'super' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES6.ts (1 errors) ==== class Base { bar() { return 0; diff --git a/tests/baselines/reference/computedPropertyNames24.js b/tests/baselines/reference/computedPropertyNames24_ES6.js similarity index 89% rename from tests/baselines/reference/computedPropertyNames24.js rename to tests/baselines/reference/computedPropertyNames24_ES6.js index 2ef2826ee22..12aef633963 100644 --- a/tests/baselines/reference/computedPropertyNames24.js +++ b/tests/baselines/reference/computedPropertyNames24_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames24.ts] +//// [computedPropertyNames24_ES6.ts] class Base { bar() { return 0; @@ -10,7 +10,7 @@ class C extends Base { [super.bar()]() { } } -//// [computedPropertyNames24.js] +//// [computedPropertyNames24_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames25.js b/tests/baselines/reference/computedPropertyNames25_ES6.js similarity index 88% rename from tests/baselines/reference/computedPropertyNames25.js rename to tests/baselines/reference/computedPropertyNames25_ES6.js index a15fcb217e7..1a600df5040 100644 --- a/tests/baselines/reference/computedPropertyNames25.js +++ b/tests/baselines/reference/computedPropertyNames25_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames25.ts] +//// [computedPropertyNames25_ES6.ts] class Base { bar() { return 0; @@ -13,7 +13,7 @@ class C extends Base { } } -//// [computedPropertyNames25.js] +//// [computedPropertyNames25_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames25.types b/tests/baselines/reference/computedPropertyNames25_ES6.types similarity index 89% rename from tests/baselines/reference/computedPropertyNames25.types rename to tests/baselines/reference/computedPropertyNames25_ES6.types index d8567dc86ad..c008a6173cf 100644 --- a/tests/baselines/reference/computedPropertyNames25.types +++ b/tests/baselines/reference/computedPropertyNames25_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames25.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES6.ts === class Base { >Base : Base diff --git a/tests/baselines/reference/computedPropertyNames26.errors.txt b/tests/baselines/reference/computedPropertyNames26_ES6.errors.txt similarity index 78% rename from tests/baselines/reference/computedPropertyNames26.errors.txt rename to tests/baselines/reference/computedPropertyNames26_ES6.errors.txt index bbe51c6a0c8..d7e2b5ce7c5 100644 --- a/tests/baselines/reference/computedPropertyNames26.errors.txt +++ b/tests/baselines/reference/computedPropertyNames26_ES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts(10,12): error TS2466: 'super' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES6.ts(10,12): error TS2466: 'super' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES6.ts (1 errors) ==== class Base { bar() { return 0; diff --git a/tests/baselines/reference/computedPropertyNames26.js b/tests/baselines/reference/computedPropertyNames26_ES6.js similarity index 90% rename from tests/baselines/reference/computedPropertyNames26.js rename to tests/baselines/reference/computedPropertyNames26_ES6.js index 96760fc279c..ba622324bf0 100644 --- a/tests/baselines/reference/computedPropertyNames26.js +++ b/tests/baselines/reference/computedPropertyNames26_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames26.ts] +//// [computedPropertyNames26_ES6.ts] class Base { bar() { return 0; @@ -12,7 +12,7 @@ class C extends Base { ]() { } } -//// [computedPropertyNames26.js] +//// [computedPropertyNames26_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames27.errors.txt b/tests/baselines/reference/computedPropertyNames27_ES6.errors.txt similarity index 69% rename from tests/baselines/reference/computedPropertyNames27.errors.txt rename to tests/baselines/reference/computedPropertyNames27_ES6.errors.txt index c2872197363..edf84201647 100644 --- a/tests/baselines/reference/computedPropertyNames27.errors.txt +++ b/tests/baselines/reference/computedPropertyNames27_ES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts(4,7): error TS2466: 'super' cannot be referenced in a computed property name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES6.ts(4,7): error TS2466: 'super' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES6.ts (1 errors) ==== class Base { } class C extends Base { diff --git a/tests/baselines/reference/computedPropertyNames27.js b/tests/baselines/reference/computedPropertyNames27_ES6.js similarity index 85% rename from tests/baselines/reference/computedPropertyNames27.js rename to tests/baselines/reference/computedPropertyNames27_ES6.js index 71db977e9b6..54a20a52200 100644 --- a/tests/baselines/reference/computedPropertyNames27.js +++ b/tests/baselines/reference/computedPropertyNames27_ES6.js @@ -1,11 +1,11 @@ -//// [computedPropertyNames27.ts] +//// [computedPropertyNames27_ES6.ts] class Base { } class C extends Base { [(super(), "prop")]() { } } -//// [computedPropertyNames27.js] +//// [computedPropertyNames27_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames28.js b/tests/baselines/reference/computedPropertyNames28_ES6.js similarity index 86% rename from tests/baselines/reference/computedPropertyNames28.js rename to tests/baselines/reference/computedPropertyNames28_ES6.js index 96c7cd082f1..09e1b33bf98 100644 --- a/tests/baselines/reference/computedPropertyNames28.js +++ b/tests/baselines/reference/computedPropertyNames28_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames28.ts] +//// [computedPropertyNames28_ES6.ts] class Base { } class C extends Base { @@ -10,7 +10,7 @@ class C extends Base { } } -//// [computedPropertyNames28.js] +//// [computedPropertyNames28_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames28.types b/tests/baselines/reference/computedPropertyNames28_ES6.types similarity index 90% rename from tests/baselines/reference/computedPropertyNames28.types rename to tests/baselines/reference/computedPropertyNames28_ES6.types index 2adf52f8c5f..842cdbd32e0 100644 --- a/tests/baselines/reference/computedPropertyNames28.types +++ b/tests/baselines/reference/computedPropertyNames28_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames28.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES6.ts === class Base { >Base : Base } diff --git a/tests/baselines/reference/computedPropertyNames29.js b/tests/baselines/reference/computedPropertyNames29_ES6.js similarity index 82% rename from tests/baselines/reference/computedPropertyNames29.js rename to tests/baselines/reference/computedPropertyNames29_ES6.js index 94e83f34629..e1e6be51b21 100644 --- a/tests/baselines/reference/computedPropertyNames29.js +++ b/tests/baselines/reference/computedPropertyNames29_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames29.ts] +//// [computedPropertyNames29_ES6.ts] class C { bar() { () => { @@ -10,7 +10,7 @@ class C { } } -//// [computedPropertyNames29.js] +//// [computedPropertyNames29_ES6.js] var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames29.types b/tests/baselines/reference/computedPropertyNames29_ES6.types similarity index 91% rename from tests/baselines/reference/computedPropertyNames29.types rename to tests/baselines/reference/computedPropertyNames29_ES6.types index ed4db5862e9..d520418749e 100644 --- a/tests/baselines/reference/computedPropertyNames29.types +++ b/tests/baselines/reference/computedPropertyNames29_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames29.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES6.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNames2.errors.txt b/tests/baselines/reference/computedPropertyNames2_ES6.errors.txt similarity index 72% rename from tests/baselines/reference/computedPropertyNames2.errors.txt rename to tests/baselines/reference/computedPropertyNames2_ES6.errors.txt index d0fd1de4576..3f18a8764b4 100644 --- a/tests/baselines/reference/computedPropertyNames2.errors.txt +++ b/tests/baselines/reference/computedPropertyNames2_ES6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts (2 errors) ==== var methodName = "method"; var accessorName = "accessor"; class C { diff --git a/tests/baselines/reference/computedPropertyNames2.js b/tests/baselines/reference/computedPropertyNames2_ES6.js similarity index 90% rename from tests/baselines/reference/computedPropertyNames2.js rename to tests/baselines/reference/computedPropertyNames2_ES6.js index 78d53ef94fc..e5fcfaac8f9 100644 --- a/tests/baselines/reference/computedPropertyNames2.js +++ b/tests/baselines/reference/computedPropertyNames2_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames2.ts] +//// [computedPropertyNames2_ES6.ts] var methodName = "method"; var accessorName = "accessor"; class C { @@ -10,7 +10,7 @@ class C { static set [accessorName](v) { } } -//// [computedPropertyNames2.js] +//// [computedPropertyNames2_ES6.js] var methodName = "method"; var accessorName = "accessor"; var C = (function () { diff --git a/tests/baselines/reference/computedPropertyNames30.errors.txt b/tests/baselines/reference/computedPropertyNames30_ES6.errors.txt similarity index 79% rename from tests/baselines/reference/computedPropertyNames30.errors.txt rename to tests/baselines/reference/computedPropertyNames30_ES6.errors.txt index f7b6411f867..dc8892fd326 100644 --- a/tests/baselines/reference/computedPropertyNames30.errors.txt +++ b/tests/baselines/reference/computedPropertyNames30_ES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors +tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts (1 errors) ==== class Base { } class C extends Base { diff --git a/tests/baselines/reference/computedPropertyNames30.js b/tests/baselines/reference/computedPropertyNames30_ES6.js similarity index 91% rename from tests/baselines/reference/computedPropertyNames30.js rename to tests/baselines/reference/computedPropertyNames30_ES6.js index 608531ffb5b..c88fa98be5e 100644 --- a/tests/baselines/reference/computedPropertyNames30.js +++ b/tests/baselines/reference/computedPropertyNames30_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames30.ts] +//// [computedPropertyNames30_ES6.ts] class Base { } class C extends Base { @@ -15,7 +15,7 @@ class C extends Base { } } -//// [computedPropertyNames30.js] +//// [computedPropertyNames30_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames31.js b/tests/baselines/reference/computedPropertyNames31_ES6.js similarity index 89% rename from tests/baselines/reference/computedPropertyNames31.js rename to tests/baselines/reference/computedPropertyNames31_ES6.js index 9a31b80e346..33f5319ded9 100644 --- a/tests/baselines/reference/computedPropertyNames31.js +++ b/tests/baselines/reference/computedPropertyNames31_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames31.ts] +//// [computedPropertyNames31_ES6.ts] class Base { bar() { return 0; @@ -15,7 +15,7 @@ class C extends Base { } } -//// [computedPropertyNames31.js] +//// [computedPropertyNames31_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames31.types b/tests/baselines/reference/computedPropertyNames31_ES6.types similarity index 92% rename from tests/baselines/reference/computedPropertyNames31.types rename to tests/baselines/reference/computedPropertyNames31_ES6.types index 90e73bc3dcb..9d835a1fac1 100644 --- a/tests/baselines/reference/computedPropertyNames31.types +++ b/tests/baselines/reference/computedPropertyNames31_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames31.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES6.ts === class Base { >Base : Base diff --git a/tests/baselines/reference/computedPropertyNames32.errors.txt b/tests/baselines/reference/computedPropertyNames32_ES6.errors.txt similarity index 69% rename from tests/baselines/reference/computedPropertyNames32.errors.txt rename to tests/baselines/reference/computedPropertyNames32_ES6.errors.txt index e2f08c79fc9..386a9f5be0b 100644 --- a/tests/baselines/reference/computedPropertyNames32.errors.txt +++ b/tests/baselines/reference/computedPropertyNames32_ES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts(6,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES6.ts(6,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES6.ts (1 errors) ==== function foo() { return '' } class C { bar() { diff --git a/tests/baselines/reference/computedPropertyNames32.js b/tests/baselines/reference/computedPropertyNames32_ES6.js similarity index 77% rename from tests/baselines/reference/computedPropertyNames32.js rename to tests/baselines/reference/computedPropertyNames32_ES6.js index d3e98681369..a87f7715d89 100644 --- a/tests/baselines/reference/computedPropertyNames32.js +++ b/tests/baselines/reference/computedPropertyNames32_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames32.ts] +//// [computedPropertyNames32_ES6.ts] function foo() { return '' } class C { bar() { @@ -7,7 +7,7 @@ class C { [foo()]() { } } -//// [computedPropertyNames32.js] +//// [computedPropertyNames32_ES6.js] function foo() { return ''; } diff --git a/tests/baselines/reference/computedPropertyNames33.js b/tests/baselines/reference/computedPropertyNames33_ES6.js similarity index 79% rename from tests/baselines/reference/computedPropertyNames33.js rename to tests/baselines/reference/computedPropertyNames33_ES6.js index 554ec315897..03c503caec4 100644 --- a/tests/baselines/reference/computedPropertyNames33.js +++ b/tests/baselines/reference/computedPropertyNames33_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames33.ts] +//// [computedPropertyNames33_ES6.ts] function foo() { return '' } class C { bar() { @@ -9,7 +9,7 @@ class C { } } -//// [computedPropertyNames33.js] +//// [computedPropertyNames33_ES6.js] function foo() { return ''; } diff --git a/tests/baselines/reference/computedPropertyNames33.types b/tests/baselines/reference/computedPropertyNames33_ES6.types similarity index 89% rename from tests/baselines/reference/computedPropertyNames33.types rename to tests/baselines/reference/computedPropertyNames33_ES6.types index 8cbe8e93ef2..331bd2b3e09 100644 --- a/tests/baselines/reference/computedPropertyNames33.types +++ b/tests/baselines/reference/computedPropertyNames33_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames33.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES6.ts === function foo() { return '' } >foo : () => string >T : T diff --git a/tests/baselines/reference/computedPropertyNames34.errors.txt b/tests/baselines/reference/computedPropertyNames34_ES6.errors.txt similarity index 74% rename from tests/baselines/reference/computedPropertyNames34.errors.txt rename to tests/baselines/reference/computedPropertyNames34_ES6.errors.txt index c6d4a9aa4eb..b7f3e37b124 100644 --- a/tests/baselines/reference/computedPropertyNames34.errors.txt +++ b/tests/baselines/reference/computedPropertyNames34_ES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts(5,18): error TS2302: Static members cannot reference class type parameters. +tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES6.ts(5,18): error TS2302: Static members cannot reference class type parameters. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES6.ts (1 errors) ==== function foo() { return '' } class C { static bar() { diff --git a/tests/baselines/reference/computedPropertyNames34.js b/tests/baselines/reference/computedPropertyNames34_ES6.js similarity index 79% rename from tests/baselines/reference/computedPropertyNames34.js rename to tests/baselines/reference/computedPropertyNames34_ES6.js index f1d774139b1..62e2e151cd3 100644 --- a/tests/baselines/reference/computedPropertyNames34.js +++ b/tests/baselines/reference/computedPropertyNames34_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames34.ts] +//// [computedPropertyNames34_ES6.ts] function foo() { return '' } class C { static bar() { @@ -9,7 +9,7 @@ class C { } } -//// [computedPropertyNames34.js] +//// [computedPropertyNames34_ES6.js] function foo() { return ''; } diff --git a/tests/baselines/reference/computedPropertyNames35.errors.txt b/tests/baselines/reference/computedPropertyNames35_ES6.errors.txt similarity index 66% rename from tests/baselines/reference/computedPropertyNames35.errors.txt rename to tests/baselines/reference/computedPropertyNames35_ES6.errors.txt index 01c4614e84a..147e40af0b7 100644 --- a/tests/baselines/reference/computedPropertyNames35.errors.txt +++ b/tests/baselines/reference/computedPropertyNames35_ES6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,5): error TS1169: Computed property names are not allowed in interfaces. -tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts(4,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts(4,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts (2 errors) ==== function foo() { return '' } interface I { bar(): string; diff --git a/tests/baselines/reference/computedPropertyNames35.js b/tests/baselines/reference/computedPropertyNames35_ES6.js similarity index 60% rename from tests/baselines/reference/computedPropertyNames35.js rename to tests/baselines/reference/computedPropertyNames35_ES6.js index 5a731fd8bda..b08d7c0f312 100644 --- a/tests/baselines/reference/computedPropertyNames35.js +++ b/tests/baselines/reference/computedPropertyNames35_ES6.js @@ -1,11 +1,11 @@ -//// [computedPropertyNames35.ts] +//// [computedPropertyNames35_ES6.ts] function foo() { return '' } interface I { bar(): string; [foo()](): void; } -//// [computedPropertyNames35.js] +//// [computedPropertyNames35_ES6.js] function foo() { return ''; } diff --git a/tests/baselines/reference/computedPropertyNames36.errors.txt b/tests/baselines/reference/computedPropertyNames36_ES6.errors.txt similarity index 74% rename from tests/baselines/reference/computedPropertyNames36.errors.txt rename to tests/baselines/reference/computedPropertyNames36_ES6.errors.txt index a473ebfba8e..8127898fde4 100644 --- a/tests/baselines/reference/computedPropertyNames36.errors.txt +++ b/tests/baselines/reference/computedPropertyNames36_ES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames36.js b/tests/baselines/reference/computedPropertyNames36_ES6.js similarity index 87% rename from tests/baselines/reference/computedPropertyNames36.js rename to tests/baselines/reference/computedPropertyNames36_ES6.js index 7c731014d1e..5b71326fbc4 100644 --- a/tests/baselines/reference/computedPropertyNames36.js +++ b/tests/baselines/reference/computedPropertyNames36_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames36.ts] +//// [computedPropertyNames36_ES6.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { set ["set1"](p: Foo2) { } } -//// [computedPropertyNames36.js] +//// [computedPropertyNames36_ES6.js] var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/computedPropertyNames37.js b/tests/baselines/reference/computedPropertyNames37_ES6.js similarity index 87% rename from tests/baselines/reference/computedPropertyNames37.js rename to tests/baselines/reference/computedPropertyNames37_ES6.js index fb4c32909d5..992035f6865 100644 --- a/tests/baselines/reference/computedPropertyNames37.js +++ b/tests/baselines/reference/computedPropertyNames37_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames37.ts] +//// [computedPropertyNames37_ES6.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { set ["set1"](p: Foo2) { } } -//// [computedPropertyNames37.js] +//// [computedPropertyNames37_ES6.js] var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/computedPropertyNames37.types b/tests/baselines/reference/computedPropertyNames37_ES6.types similarity index 88% rename from tests/baselines/reference/computedPropertyNames37.types rename to tests/baselines/reference/computedPropertyNames37_ES6.types index b50e0590b79..288685f0e02 100644 --- a/tests/baselines/reference/computedPropertyNames37.types +++ b/tests/baselines/reference/computedPropertyNames37_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames37.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES6.ts === class Foo { x } >Foo : Foo >x : any diff --git a/tests/baselines/reference/computedPropertyNames38.errors.txt b/tests/baselines/reference/computedPropertyNames38_ES6.errors.txt similarity index 74% rename from tests/baselines/reference/computedPropertyNames38.errors.txt rename to tests/baselines/reference/computedPropertyNames38_ES6.errors.txt index fc5f31f1329..0a95b37f9a9 100644 --- a/tests/baselines/reference/computedPropertyNames38.errors.txt +++ b/tests/baselines/reference/computedPropertyNames38_ES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames38.js b/tests/baselines/reference/computedPropertyNames38_ES6.js similarity index 87% rename from tests/baselines/reference/computedPropertyNames38.js rename to tests/baselines/reference/computedPropertyNames38_ES6.js index 922244bfecf..0fdcdb1d63c 100644 --- a/tests/baselines/reference/computedPropertyNames38.js +++ b/tests/baselines/reference/computedPropertyNames38_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames38.ts] +//// [computedPropertyNames38_ES6.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { set [1 << 6](p: Foo2) { } } -//// [computedPropertyNames38.js] +//// [computedPropertyNames38_ES6.js] var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/computedPropertyNames39.errors.txt b/tests/baselines/reference/computedPropertyNames39_ES6.errors.txt similarity index 74% rename from tests/baselines/reference/computedPropertyNames39.errors.txt rename to tests/baselines/reference/computedPropertyNames39_ES6.errors.txt index 573ef726241..38f432162d5 100644 --- a/tests/baselines/reference/computedPropertyNames39.errors.txt +++ b/tests/baselines/reference/computedPropertyNames39_ES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames39.js b/tests/baselines/reference/computedPropertyNames39_ES6.js similarity index 87% rename from tests/baselines/reference/computedPropertyNames39.js rename to tests/baselines/reference/computedPropertyNames39_ES6.js index 62621f4e754..8e458ad83d7 100644 --- a/tests/baselines/reference/computedPropertyNames39.js +++ b/tests/baselines/reference/computedPropertyNames39_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames39.ts] +//// [computedPropertyNames39_ES6.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { set [1 << 6](p: Foo2) { } } -//// [computedPropertyNames39.js] +//// [computedPropertyNames39_ES6.js] var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/computedPropertyNames3.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt similarity index 66% rename from tests/baselines/reference/computedPropertyNames3.errors.txt rename to tests/baselines/reference/computedPropertyNames3_ES6.errors.txt index 080bff1ab9a..4efe6e62f1a 100644 --- a/tests/baselines/reference/computedPropertyNames3.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3_ES6.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (6 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts (6 errors) ==== var id; class C { [0 + 1]() { } diff --git a/tests/baselines/reference/computedPropertyNames3.js b/tests/baselines/reference/computedPropertyNames3_ES6.js similarity index 89% rename from tests/baselines/reference/computedPropertyNames3.js rename to tests/baselines/reference/computedPropertyNames3_ES6.js index 969bbf96d86..6252466b31e 100644 --- a/tests/baselines/reference/computedPropertyNames3.js +++ b/tests/baselines/reference/computedPropertyNames3_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames3.ts] +//// [computedPropertyNames3_ES6.ts] var id; class C { [0 + 1]() { } @@ -9,7 +9,7 @@ class C { static set [id.toString()](v) { } } -//// [computedPropertyNames3.js] +//// [computedPropertyNames3_ES6.js] var id; var C = (function () { function C() { diff --git a/tests/baselines/reference/computedPropertyNames40.errors.txt b/tests/baselines/reference/computedPropertyNames40_ES6.errors.txt similarity index 73% rename from tests/baselines/reference/computedPropertyNames40.errors.txt rename to tests/baselines/reference/computedPropertyNames40_ES6.errors.txt index c5bda4ed999..1a032a87b2b 100644 --- a/tests/baselines/reference/computedPropertyNames40.errors.txt +++ b/tests/baselines/reference/computedPropertyNames40_ES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts(8,5): error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts(8,5): error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames40.js b/tests/baselines/reference/computedPropertyNames40_ES6.js similarity index 84% rename from tests/baselines/reference/computedPropertyNames40.js rename to tests/baselines/reference/computedPropertyNames40_ES6.js index 1c9b5d3bfa8..99d28688a29 100644 --- a/tests/baselines/reference/computedPropertyNames40.js +++ b/tests/baselines/reference/computedPropertyNames40_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames40.ts] +//// [computedPropertyNames40_ES6.ts] class Foo { x } class Foo2 { x; y } @@ -10,7 +10,7 @@ class C { [""]() { return new Foo2 } } -//// [computedPropertyNames40.js] +//// [computedPropertyNames40_ES6.js] var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/computedPropertyNames41.js b/tests/baselines/reference/computedPropertyNames41_ES6.js similarity index 81% rename from tests/baselines/reference/computedPropertyNames41.js rename to tests/baselines/reference/computedPropertyNames41_ES6.js index 34fe2d33df7..f0c386706a3 100644 --- a/tests/baselines/reference/computedPropertyNames41.js +++ b/tests/baselines/reference/computedPropertyNames41_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames41.ts] +//// [computedPropertyNames41_ES6.ts] class Foo { x } class Foo2 { x; y } @@ -9,7 +9,7 @@ class C { static [""]() { return new Foo } } -//// [computedPropertyNames41.js] +//// [computedPropertyNames41_ES6.js] var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/computedPropertyNames41.types b/tests/baselines/reference/computedPropertyNames41_ES6.types similarity index 88% rename from tests/baselines/reference/computedPropertyNames41.types rename to tests/baselines/reference/computedPropertyNames41_ES6.types index 1fb0af282ca..ffb3387d161 100644 --- a/tests/baselines/reference/computedPropertyNames41.types +++ b/tests/baselines/reference/computedPropertyNames41_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames41.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES6.ts === class Foo { x } >Foo : Foo >x : any diff --git a/tests/baselines/reference/computedPropertyNames42.errors.txt b/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt similarity index 67% rename from tests/baselines/reference/computedPropertyNames42.errors.txt rename to tests/baselines/reference/computedPropertyNames42_ES6.errors.txt index 059b3117a43..7778d5f608a 100644 --- a/tests/baselines/reference/computedPropertyNames42.errors.txt +++ b/tests/baselines/reference/computedPropertyNames42_ES6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts (2 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames42.js b/tests/baselines/reference/computedPropertyNames42_ES6.js similarity index 77% rename from tests/baselines/reference/computedPropertyNames42.js rename to tests/baselines/reference/computedPropertyNames42_ES6.js index c9f24a1c708..8538088f450 100644 --- a/tests/baselines/reference/computedPropertyNames42.js +++ b/tests/baselines/reference/computedPropertyNames42_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames42.ts] +//// [computedPropertyNames42_ES6.ts] class Foo { x } class Foo2 { x; y } @@ -9,7 +9,7 @@ class C { [""]: Foo; } -//// [computedPropertyNames42.js] +//// [computedPropertyNames42_ES6.js] var Foo = (function () { function Foo() { } diff --git a/tests/baselines/reference/computedPropertyNames43.errors.txt b/tests/baselines/reference/computedPropertyNames43_ES6.errors.txt similarity index 75% rename from tests/baselines/reference/computedPropertyNames43.errors.txt rename to tests/baselines/reference/computedPropertyNames43_ES6.errors.txt index d38dcca9216..0efe0ba39ec 100644 --- a/tests/baselines/reference/computedPropertyNames43.errors.txt +++ b/tests/baselines/reference/computedPropertyNames43_ES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames43.js b/tests/baselines/reference/computedPropertyNames43_ES6.js similarity index 90% rename from tests/baselines/reference/computedPropertyNames43.js rename to tests/baselines/reference/computedPropertyNames43_ES6.js index 22ac7774439..ba0c228c307 100644 --- a/tests/baselines/reference/computedPropertyNames43.js +++ b/tests/baselines/reference/computedPropertyNames43_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames43.ts] +//// [computedPropertyNames43_ES6.ts] class Foo { x } class Foo2 { x; y } @@ -12,7 +12,7 @@ class D extends C { set ["set1"](p: Foo2) { } } -//// [computedPropertyNames43.js] +//// [computedPropertyNames43_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames44.errors.txt b/tests/baselines/reference/computedPropertyNames44_ES6.errors.txt similarity index 70% rename from tests/baselines/reference/computedPropertyNames44.errors.txt rename to tests/baselines/reference/computedPropertyNames44_ES6.errors.txt index bf1de6687e1..5170746395c 100644 --- a/tests/baselines/reference/computedPropertyNames44.errors.txt +++ b/tests/baselines/reference/computedPropertyNames44_ES6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts (2 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames44.js b/tests/baselines/reference/computedPropertyNames44_ES6.js similarity index 89% rename from tests/baselines/reference/computedPropertyNames44.js rename to tests/baselines/reference/computedPropertyNames44_ES6.js index c91a52e8199..72729054e07 100644 --- a/tests/baselines/reference/computedPropertyNames44.js +++ b/tests/baselines/reference/computedPropertyNames44_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames44.ts] +//// [computedPropertyNames44_ES6.ts] class Foo { x } class Foo2 { x; y } @@ -11,7 +11,7 @@ class D extends C { set ["set1"](p: Foo) { } } -//// [computedPropertyNames44.js] +//// [computedPropertyNames44_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames45.errors.txt b/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt similarity index 76% rename from tests/baselines/reference/computedPropertyNames45.errors.txt rename to tests/baselines/reference/computedPropertyNames45_ES6.errors.txt index 7ad29340b25..963e01ed86b 100644 --- a/tests/baselines/reference/computedPropertyNames45.errors.txt +++ b/tests/baselines/reference/computedPropertyNames45_ES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } diff --git a/tests/baselines/reference/computedPropertyNames45.js b/tests/baselines/reference/computedPropertyNames45_ES6.js similarity index 90% rename from tests/baselines/reference/computedPropertyNames45.js rename to tests/baselines/reference/computedPropertyNames45_ES6.js index 7ec3c165e12..23dccc77956 100644 --- a/tests/baselines/reference/computedPropertyNames45.js +++ b/tests/baselines/reference/computedPropertyNames45_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames45.ts] +//// [computedPropertyNames45_ES6.ts] class Foo { x } class Foo2 { x; y } @@ -12,7 +12,7 @@ class D extends C { set ["set1"](p: Foo) { } } -//// [computedPropertyNames45.js] +//// [computedPropertyNames45_ES6.js] var __extends = this.__extends || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } diff --git a/tests/baselines/reference/computedPropertyNames46.js b/tests/baselines/reference/computedPropertyNames46.js deleted file mode 100644 index e2ef2b2e729..00000000000 --- a/tests/baselines/reference/computedPropertyNames46.js +++ /dev/null @@ -1,9 +0,0 @@ -//// [computedPropertyNames46.ts] -var o = { - ["" || 0]: 0 -}; - -//// [computedPropertyNames46.js] -var o = { - ["" || 0]: 0 -}; diff --git a/tests/baselines/reference/computedPropertyNames46_ES6.js b/tests/baselines/reference/computedPropertyNames46_ES6.js new file mode 100644 index 00000000000..421c301d67a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames46_ES6.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames46_ES6.ts] +var o = { + ["" || 0]: 0 +}; + +//// [computedPropertyNames46_ES6.js] +var o = { + ["" || 0]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames46.types b/tests/baselines/reference/computedPropertyNames46_ES6.types similarity index 83% rename from tests/baselines/reference/computedPropertyNames46.types rename to tests/baselines/reference/computedPropertyNames46_ES6.types index cf8585828f4..7abb10f1ba5 100644 --- a/tests/baselines/reference/computedPropertyNames46.types +++ b/tests/baselines/reference/computedPropertyNames46_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames46.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES6.ts === var o = { >o : {} >{ ["" || 0]: 0} : {} diff --git a/tests/baselines/reference/computedPropertyNames47.js b/tests/baselines/reference/computedPropertyNames47_ES6.js similarity index 73% rename from tests/baselines/reference/computedPropertyNames47.js rename to tests/baselines/reference/computedPropertyNames47_ES6.js index 88e28e54239..e104d33e7d3 100644 --- a/tests/baselines/reference/computedPropertyNames47.js +++ b/tests/baselines/reference/computedPropertyNames47_ES6.js @@ -1,11 +1,11 @@ -//// [computedPropertyNames47.ts] +//// [computedPropertyNames47_ES6.ts] enum E1 { x } enum E2 { x } var o = { [E1.x || E2.x]: 0 }; -//// [computedPropertyNames47.js] +//// [computedPropertyNames47_ES6.js] var E1; (function (E1) { E1[E1["x"] = 0] = "x"; diff --git a/tests/baselines/reference/computedPropertyNames47.types b/tests/baselines/reference/computedPropertyNames47_ES6.types similarity index 86% rename from tests/baselines/reference/computedPropertyNames47.types rename to tests/baselines/reference/computedPropertyNames47_ES6.types index 20d7ab1d31e..840d77754cf 100644 --- a/tests/baselines/reference/computedPropertyNames47.types +++ b/tests/baselines/reference/computedPropertyNames47_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames47.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES6.ts === enum E1 { x } >E1 : E1 >x : E1 diff --git a/tests/baselines/reference/computedPropertyNames48.js b/tests/baselines/reference/computedPropertyNames48_ES6.js similarity index 86% rename from tests/baselines/reference/computedPropertyNames48.js rename to tests/baselines/reference/computedPropertyNames48_ES6.js index 9f8e0442ebe..27821647565 100644 --- a/tests/baselines/reference/computedPropertyNames48.js +++ b/tests/baselines/reference/computedPropertyNames48_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames48.ts] +//// [computedPropertyNames48_ES6.ts] declare function extractIndexer(p: { [n: number]: T }): T; enum E { x } @@ -17,7 +17,7 @@ extractIndexer({ ["" || 0]: "" }); // Should return any (widened form of undefined) -//// [computedPropertyNames48.js] +//// [computedPropertyNames48_ES6.js] var E; (function (E) { E[E["x"] = 0] = "x"; diff --git a/tests/baselines/reference/computedPropertyNames48.types b/tests/baselines/reference/computedPropertyNames48_ES6.types similarity index 93% rename from tests/baselines/reference/computedPropertyNames48.types rename to tests/baselines/reference/computedPropertyNames48_ES6.types index 78755d5d5d7..e10f078d11f 100644 --- a/tests/baselines/reference/computedPropertyNames48.types +++ b/tests/baselines/reference/computedPropertyNames48_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames48.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES6.ts === declare function extractIndexer(p: { [n: number]: T }): T; >extractIndexer : (p: { [n: number]: T; }) => T >T : T diff --git a/tests/baselines/reference/computedPropertyNames4.js b/tests/baselines/reference/computedPropertyNames4_ES6.js similarity index 82% rename from tests/baselines/reference/computedPropertyNames4.js rename to tests/baselines/reference/computedPropertyNames4_ES6.js index 5acb6d957da..55143ca9e10 100644 --- a/tests/baselines/reference/computedPropertyNames4.js +++ b/tests/baselines/reference/computedPropertyNames4_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames4.ts] +//// [computedPropertyNames4_ES6.ts] var s: string; var n: number; var a: any; @@ -16,7 +16,7 @@ var v = { [`hello ${a} bye`]: 0 } -//// [computedPropertyNames4.js] +//// [computedPropertyNames4_ES6.js] var s; var n; var a; diff --git a/tests/baselines/reference/computedPropertyNames4.types b/tests/baselines/reference/computedPropertyNames4_ES6.types similarity index 91% rename from tests/baselines/reference/computedPropertyNames4.types rename to tests/baselines/reference/computedPropertyNames4_ES6.types index 968cc86b598..973dfbec3a5 100644 --- a/tests/baselines/reference/computedPropertyNames4.types +++ b/tests/baselines/reference/computedPropertyNames4_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames4.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES6.ts === var s: string; >s : string diff --git a/tests/baselines/reference/computedPropertyNames5.errors.txt b/tests/baselines/reference/computedPropertyNames5_ES6.errors.txt similarity index 64% rename from tests/baselines/reference/computedPropertyNames5.errors.txt rename to tests/baselines/reference/computedPropertyNames5_ES6.errors.txt index 2b8cf5503b8..17075e697e9 100644 --- a/tests/baselines/reference/computedPropertyNames5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames5_ES6.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts (6 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts (6 errors) ==== var b: boolean; var v = { [b]: 0, diff --git a/tests/baselines/reference/computedPropertyNames5.js b/tests/baselines/reference/computedPropertyNames5_ES6.js similarity index 73% rename from tests/baselines/reference/computedPropertyNames5.js rename to tests/baselines/reference/computedPropertyNames5_ES6.js index d0158da6400..0ac309b8ed0 100644 --- a/tests/baselines/reference/computedPropertyNames5.js +++ b/tests/baselines/reference/computedPropertyNames5_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames5.ts] +//// [computedPropertyNames5_ES6.ts] var b: boolean; var v = { [b]: 0, @@ -9,7 +9,7 @@ var v = { [null]: null } -//// [computedPropertyNames5.js] +//// [computedPropertyNames5_ES6.js] var b; var v = { [b]: 0, diff --git a/tests/baselines/reference/computedPropertyNames6.errors.txt b/tests/baselines/reference/computedPropertyNames6_ES6.errors.txt similarity index 68% rename from tests/baselines/reference/computedPropertyNames6.errors.txt rename to tests/baselines/reference/computedPropertyNames6_ES6.errors.txt index 57798e9f6b6..9df1179948e 100644 --- a/tests/baselines/reference/computedPropertyNames6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames6_ES6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts (2 errors) ==== var p1: number | string; var p2: number | number[]; var p3: string | boolean; diff --git a/tests/baselines/reference/computedPropertyNames6.js b/tests/baselines/reference/computedPropertyNames6_ES6.js similarity index 70% rename from tests/baselines/reference/computedPropertyNames6.js rename to tests/baselines/reference/computedPropertyNames6_ES6.js index e131ef4417f..1efc6fe004c 100644 --- a/tests/baselines/reference/computedPropertyNames6.js +++ b/tests/baselines/reference/computedPropertyNames6_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames6.ts] +//// [computedPropertyNames6_ES6.ts] var p1: number | string; var p2: number | number[]; var p3: string | boolean; @@ -8,7 +8,7 @@ var v = { [p3]: 2 } -//// [computedPropertyNames6.js] +//// [computedPropertyNames6_ES6.js] var p1; var p2; var p3; diff --git a/tests/baselines/reference/computedPropertyNames7.js b/tests/baselines/reference/computedPropertyNames7_ES6.js similarity index 66% rename from tests/baselines/reference/computedPropertyNames7.js rename to tests/baselines/reference/computedPropertyNames7_ES6.js index 075b149522b..5714fb747a6 100644 --- a/tests/baselines/reference/computedPropertyNames7.js +++ b/tests/baselines/reference/computedPropertyNames7_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames7.ts] +//// [computedPropertyNames7_ES6.ts] enum E { member } @@ -6,7 +6,7 @@ var v = { [E.member]: 0 } -//// [computedPropertyNames7.js] +//// [computedPropertyNames7_ES6.js] var E; (function (E) { E[E["member"] = 0] = "member"; diff --git a/tests/baselines/reference/computedPropertyNames7.types b/tests/baselines/reference/computedPropertyNames7_ES6.types similarity index 85% rename from tests/baselines/reference/computedPropertyNames7.types rename to tests/baselines/reference/computedPropertyNames7_ES6.types index 0b5f26614fc..371176acc16 100644 --- a/tests/baselines/reference/computedPropertyNames7.types +++ b/tests/baselines/reference/computedPropertyNames7_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNames7.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES6.ts === enum E { >E : E diff --git a/tests/baselines/reference/computedPropertyNames8.errors.txt b/tests/baselines/reference/computedPropertyNames8_ES6.errors.txt similarity index 68% rename from tests/baselines/reference/computedPropertyNames8.errors.txt rename to tests/baselines/reference/computedPropertyNames8_ES6.errors.txt index 515af1f4fc4..d1fb8429738 100644 --- a/tests/baselines/reference/computedPropertyNames8.errors.txt +++ b/tests/baselines/reference/computedPropertyNames8_ES6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts (2 errors) ==== function f() { var t: T; var u: U; diff --git a/tests/baselines/reference/computedPropertyNames8.js b/tests/baselines/reference/computedPropertyNames8_ES6.js similarity index 70% rename from tests/baselines/reference/computedPropertyNames8.js rename to tests/baselines/reference/computedPropertyNames8_ES6.js index 44a21d79a1c..2290de66c71 100644 --- a/tests/baselines/reference/computedPropertyNames8.js +++ b/tests/baselines/reference/computedPropertyNames8_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames8.ts] +//// [computedPropertyNames8_ES6.ts] function f() { var t: T; var u: U; @@ -8,7 +8,7 @@ function f() { }; } -//// [computedPropertyNames8.js] +//// [computedPropertyNames8_ES6.js] function f() { var t; var u; diff --git a/tests/baselines/reference/computedPropertyNames9.errors.txt b/tests/baselines/reference/computedPropertyNames9_ES6.errors.txt similarity index 74% rename from tests/baselines/reference/computedPropertyNames9.errors.txt rename to tests/baselines/reference/computedPropertyNames9_ES6.errors.txt index d87576f1f77..39d04647615 100644 --- a/tests/baselines/reference/computedPropertyNames9.errors.txt +++ b/tests/baselines/reference/computedPropertyNames9_ES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES6.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES6.ts (1 errors) ==== function f(s: string): string; function f(n: number): number; function f(x: T): T; diff --git a/tests/baselines/reference/computedPropertyNames9.js b/tests/baselines/reference/computedPropertyNames9_ES6.js similarity index 74% rename from tests/baselines/reference/computedPropertyNames9.js rename to tests/baselines/reference/computedPropertyNames9_ES6.js index ede8bb3012b..8f111935b06 100644 --- a/tests/baselines/reference/computedPropertyNames9.js +++ b/tests/baselines/reference/computedPropertyNames9_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNames9.ts] +//// [computedPropertyNames9_ES6.ts] function f(s: string): string; function f(n: number): number; function f(x: T): T; @@ -10,7 +10,7 @@ var v = { [f(true)]: 0 } -//// [computedPropertyNames9.js] +//// [computedPropertyNames9_ES6.js] function f(x) { } var v = { diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.errors.txt similarity index 79% rename from tests/baselines/reference/computedPropertyNamesContextualType10.errors.txt rename to tests/baselines/reference/computedPropertyNamesContextualType10_ES6.errors.txt index 5e9fbe7b45b..116cd1a2531 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType10.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts(5,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES6.ts(5,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES6.ts (1 errors) ==== interface I { [s: number]: boolean; } diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10.js b/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.js similarity index 55% rename from tests/baselines/reference/computedPropertyNamesContextualType10.js rename to tests/baselines/reference/computedPropertyNamesContextualType10_ES6.js index 125a014852e..fa08b5db3d2 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType10.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType10.ts] +//// [computedPropertyNamesContextualType10_ES6.ts] interface I { [s: number]: boolean; } @@ -8,7 +8,7 @@ var o: I = { [+"bar"]: 0 } -//// [computedPropertyNamesContextualType10.js] +//// [computedPropertyNamesContextualType10_ES6.js] var o = { [+"foo"]: "", [+"bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.js similarity index 72% rename from tests/baselines/reference/computedPropertyNamesContextualType1.js rename to tests/baselines/reference/computedPropertyNamesContextualType1_ES6.js index 82429be9c40..8a1192e49c4 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType1.ts] +//// [computedPropertyNamesContextualType1_ES6.ts] interface I { [s: string]: (x: string) => number; [s: number]: (x: any) => number; // Doesn't get hit @@ -9,7 +9,7 @@ var o: I = { ["" + 1]: y => y.length } -//// [computedPropertyNamesContextualType1.js] +//// [computedPropertyNamesContextualType1_ES6.js] var o = { ["" + 0](y) { return y.length; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1.types b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.types similarity index 90% rename from tests/baselines/reference/computedPropertyNamesContextualType1.types rename to tests/baselines/reference/computedPropertyNamesContextualType1_ES6.types index 1697542fba6..44bc8a51113 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES6.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.js similarity index 72% rename from tests/baselines/reference/computedPropertyNamesContextualType2.js rename to tests/baselines/reference/computedPropertyNamesContextualType2_ES6.js index 028e797be18..ff86acfb5c6 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType2.ts] +//// [computedPropertyNamesContextualType2_ES6.ts] interface I { [s: string]: (x: any) => number; // Doesn't get hit [s: number]: (x: string) => number; @@ -9,7 +9,7 @@ var o: I = { [+"bar"]: y => y.length } -//// [computedPropertyNamesContextualType2.js] +//// [computedPropertyNamesContextualType2_ES6.js] var o = { [+"foo"](y) { return y.length; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2.types b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.types similarity index 90% rename from tests/baselines/reference/computedPropertyNamesContextualType2.types rename to tests/baselines/reference/computedPropertyNamesContextualType2_ES6.types index 408fd6a5062..222004cf8e3 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES6.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.js similarity index 68% rename from tests/baselines/reference/computedPropertyNamesContextualType3.js rename to tests/baselines/reference/computedPropertyNamesContextualType3_ES6.js index 944bb3595d4..de02400d878 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType3.ts] +//// [computedPropertyNamesContextualType3_ES6.ts] interface I { [s: string]: (x: string) => number; } @@ -8,7 +8,7 @@ var o: I = { [+"bar"]: y => y.length } -//// [computedPropertyNamesContextualType3.js] +//// [computedPropertyNamesContextualType3_ES6.js] var o = { [+"foo"](y) { return y.length; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3.types b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.types similarity index 89% rename from tests/baselines/reference/computedPropertyNamesContextualType3.types rename to tests/baselines/reference/computedPropertyNamesContextualType3_ES6.types index a1a36c1b7e9..bc36ad8ae2c 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES6.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4.js b/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.js similarity index 60% rename from tests/baselines/reference/computedPropertyNamesContextualType4.js rename to tests/baselines/reference/computedPropertyNamesContextualType4_ES6.js index 6ddd22baf6e..87cc54b4a59 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType4.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType4.ts] +//// [computedPropertyNamesContextualType4_ES6.ts] interface I { [s: string]: any; [s: number]: any; @@ -9,7 +9,7 @@ var o: I = { [""+"bar"]: 0 } -//// [computedPropertyNamesContextualType4.js] +//// [computedPropertyNamesContextualType4_ES6.js] var o = { ["" + "foo"]: "", ["" + "bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4.types b/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.types similarity index 86% rename from tests/baselines/reference/computedPropertyNamesContextualType4.types rename to tests/baselines/reference/computedPropertyNamesContextualType4_ES6.types index d22f56f24fe..82424f9410c 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType4.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES6.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5.js b/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.js similarity index 58% rename from tests/baselines/reference/computedPropertyNamesContextualType5.js rename to tests/baselines/reference/computedPropertyNamesContextualType5_ES6.js index f2bd79644a0..775e8931efe 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType5.ts] +//// [computedPropertyNamesContextualType5_ES6.ts] interface I { [s: string]: any; [s: number]: any; @@ -9,7 +9,7 @@ var o: I = { [+"bar"]: 0 } -//// [computedPropertyNamesContextualType5.js] +//// [computedPropertyNamesContextualType5_ES6.js] var o = { [+"foo"]: "", [+"bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5.types b/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.types similarity index 86% rename from tests/baselines/reference/computedPropertyNamesContextualType5.types rename to tests/baselines/reference/computedPropertyNamesContextualType5_ES6.types index 12c3332acfa..6ab28f9583d 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType5.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES6.ts === interface I { >I : I diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.js similarity index 71% rename from tests/baselines/reference/computedPropertyNamesContextualType6.js rename to tests/baselines/reference/computedPropertyNamesContextualType6_ES6.js index a92958871d9..1abb62419cf 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType6.ts] +//// [computedPropertyNamesContextualType6_ES6.ts] interface I { [s: string]: T; } @@ -13,7 +13,7 @@ foo({ [+"hi"]: [0] }); -//// [computedPropertyNamesContextualType6.js] +//// [computedPropertyNamesContextualType6_ES6.js] foo({ p: "", 0: () => { diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6.types b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types similarity index 91% rename from tests/baselines/reference/computedPropertyNamesContextualType6.types rename to tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types index acbae75ad4c..1684bfc573f 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES6.ts === interface I { >I : I >T : T diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.js similarity index 71% rename from tests/baselines/reference/computedPropertyNamesContextualType7.js rename to tests/baselines/reference/computedPropertyNamesContextualType7_ES6.js index 00103bc76db..6886f4ea263 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType7.ts] +//// [computedPropertyNamesContextualType7_ES6.ts] interface I { [s: number]: T; } @@ -13,7 +13,7 @@ foo({ [+"hi"]: [0] }); -//// [computedPropertyNamesContextualType7.js] +//// [computedPropertyNamesContextualType7_ES6.js] foo({ p: "", 0: () => { diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7.types b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types similarity index 91% rename from tests/baselines/reference/computedPropertyNamesContextualType7.types rename to tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types index da059d490b0..c9ed4437760 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7.types +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES6.ts === interface I { >I : I >T : T diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt similarity index 78% rename from tests/baselines/reference/computedPropertyNamesContextualType8.errors.txt rename to tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt index 07b55b799e4..e4540337ed4 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts (1 errors) ==== interface I { [s: string]: boolean; [s: number]: boolean; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8.js b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.js similarity index 61% rename from tests/baselines/reference/computedPropertyNamesContextualType8.js rename to tests/baselines/reference/computedPropertyNamesContextualType8_ES6.js index d98538c40c1..6a18fa0b92b 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType8.ts] +//// [computedPropertyNamesContextualType8_ES6.ts] interface I { [s: string]: boolean; [s: number]: boolean; @@ -9,7 +9,7 @@ var o: I = { [""+"bar"]: 0 } -//// [computedPropertyNamesContextualType8.js] +//// [computedPropertyNamesContextualType8_ES6.js] var o = { ["" + "foo"]: "", ["" + "bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.errors.txt similarity index 78% rename from tests/baselines/reference/computedPropertyNamesContextualType9.errors.txt rename to tests/baselines/reference/computedPropertyNamesContextualType9_ES6.errors.txt index 6a1d9316fd7..eca1360c26f 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts (1 errors) ==== interface I { [s: string]: boolean; [s: number]: boolean; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9.js b/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.js similarity index 60% rename from tests/baselines/reference/computedPropertyNamesContextualType9.js rename to tests/baselines/reference/computedPropertyNamesContextualType9_ES6.js index ed8791a51e0..e94ded1a47a 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesContextualType9.ts] +//// [computedPropertyNamesContextualType9_ES6.ts] interface I { [s: string]: boolean; [s: number]: boolean; @@ -9,7 +9,7 @@ var o: I = { [+"bar"]: 0 } -//// [computedPropertyNamesContextualType9.js] +//// [computedPropertyNamesContextualType9_ES6.js] var o = { [+"foo"]: "", [+"bar"]: 0 diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.js similarity index 74% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.js index bc8b5d0e910..eb7dab0b660 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.js @@ -1,11 +1,11 @@ -//// [computedPropertyNamesDeclarationEmit1.ts] +//// [computedPropertyNamesDeclarationEmit1_ES6.ts] class C { ["" + ""]() { } get ["" + ""]() { return 0; } set ["" + ""](x) { } } -//// [computedPropertyNamesDeclarationEmit1.js] +//// [computedPropertyNamesDeclarationEmit1_ES6.js] var C = (function () { function C() { } @@ -28,6 +28,6 @@ var C = (function () { })(); -//// [computedPropertyNamesDeclarationEmit1.d.ts] +//// [computedPropertyNamesDeclarationEmit1_ES6.d.ts] declare class C { } diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.types similarity index 82% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit1.types rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.types index e8e184a652e..a48c85f8602 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.types +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES6.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.js similarity index 74% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.js index 647f3fab135..3912113905c 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.js @@ -1,11 +1,11 @@ -//// [computedPropertyNamesDeclarationEmit2.ts] +//// [computedPropertyNamesDeclarationEmit2_ES6.ts] class C { static ["" + ""]() { } static get ["" + ""]() { return 0; } static set ["" + ""](x) { } } -//// [computedPropertyNamesDeclarationEmit2.js] +//// [computedPropertyNamesDeclarationEmit2_ES6.js] var C = (function () { function C() { } @@ -28,6 +28,6 @@ var C = (function () { })(); -//// [computedPropertyNamesDeclarationEmit2.d.ts] +//// [computedPropertyNamesDeclarationEmit2_ES6.d.ts] declare class C { } diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.types similarity index 83% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit2.types rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.types index df1da17abea..eec55608a08 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.types +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES6.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.js deleted file mode 100644 index df351acf6e9..00000000000 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.js +++ /dev/null @@ -1,6 +0,0 @@ -//// [computedPropertyNamesDeclarationEmit3.ts] -interface I { - ["" + ""](): void; -} - -//// [computedPropertyNamesDeclarationEmit3.js] diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.errors.txt similarity index 62% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.errors.txt index 69ff2b9e452..aee49a107c4 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES6.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES6.ts (1 errors) ==== interface I { ["" + ""](): void; ~~~~~~~~~ diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.js new file mode 100644 index 00000000000..55e657c2325 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES6.js @@ -0,0 +1,6 @@ +//// [computedPropertyNamesDeclarationEmit3_ES6.ts] +interface I { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit3_ES6.js] diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.js deleted file mode 100644 index 870f87bb613..00000000000 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.js +++ /dev/null @@ -1,7 +0,0 @@ -//// [computedPropertyNamesDeclarationEmit4.ts] -var v: { - ["" + ""](): void; -} - -//// [computedPropertyNamesDeclarationEmit4.js] -var v; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.errors.txt similarity index 62% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.errors.txt index 53eb057f8a1..08ed0cb6005 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts(2,5): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES6.ts(2,5): error TS1170: Computed property names are not allowed in type literals. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts (1 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES6.ts (1 errors) ==== var v: { ["" + ""](): void; ~~~~~~~~~ diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.js new file mode 100644 index 00000000000..c3b26b97c9b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES6.js @@ -0,0 +1,7 @@ +//// [computedPropertyNamesDeclarationEmit4_ES6.ts] +var v: { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit4_ES6.js] +var v; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.js similarity index 60% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.js index d7ac3319eca..0ae3eaf62b5 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesDeclarationEmit5.ts] +//// [computedPropertyNamesDeclarationEmit5_ES6.ts] var v = { ["" + ""]: 0, ["" + ""]() { }, @@ -6,7 +6,7 @@ var v = { set ["" + ""](x) { } } -//// [computedPropertyNamesDeclarationEmit5.js] +//// [computedPropertyNamesDeclarationEmit5_ES6.js] var v = { ["" + ""]: 0, ["" + ""]() { @@ -19,5 +19,5 @@ var v = { }; -//// [computedPropertyNamesDeclarationEmit5.d.ts] +//// [computedPropertyNamesDeclarationEmit5_ES6.d.ts] declare var v: {}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.types similarity index 87% rename from tests/baselines/reference/computedPropertyNamesDeclarationEmit5.types rename to tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.types index c63d6d0d5c3..10b70587e32 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.types +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES6.ts === var v = { >v : {} >{ ["" + ""]: 0, ["" + ""]() { }, get ["" + ""]() { return 0; }, set ["" + ""](x) { }} : {} diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.errors.txt similarity index 68% rename from tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt rename to tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.errors.txt index b3c2957a13f..e98095f13f2 100644 --- a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(4,5): error TS1168: Computed property names are not allowed in method overloads. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(5,5): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts(4,5): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts(5,5): error TS1168: Computed property names are not allowed in method overloads. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts (2 errors) ==== var methodName = "method"; var accessorName = "accessor"; class C { diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads.js b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.js similarity index 75% rename from tests/baselines/reference/computedPropertyNamesOnOverloads.js rename to tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.js index 1db857620e9..264a6a75074 100644 --- a/tests/baselines/reference/computedPropertyNamesOnOverloads.js +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES6.js @@ -1,4 +1,4 @@ -//// [computedPropertyNamesOnOverloads.ts] +//// [computedPropertyNamesOnOverloads_ES6.ts] var methodName = "method"; var accessorName = "accessor"; class C { @@ -7,7 +7,7 @@ class C { [methodName](v?: string) { } } -//// [computedPropertyNamesOnOverloads.js] +//// [computedPropertyNamesOnOverloads_ES6.js] var methodName = "method"; var accessorName = "accessor"; var C = (function () { diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap1.js.map deleted file mode 100644 index 5833df72f7f..00000000000 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [computedPropertyNamesSourceMap1.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap1.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1.ts"],"names":["C","C.constructor","C[\"hello\"]"],"mappings":"AAAA,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAIPC,CAACA;IAHGD,YAACA,OAAOA,CAACA,GAATA;QACIE,QAAQA,CAACA;IACbA,CAACA;IACLF,QAACA;AAADA,CAACA,AAJD,IAIC"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.js b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js similarity index 53% rename from tests/baselines/reference/computedPropertyNamesSourceMap1.js rename to tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js index b65e3f0ce5b..f7dc9e17836 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1.js +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js @@ -1,11 +1,11 @@ -//// [computedPropertyNamesSourceMap1.ts] +//// [computedPropertyNamesSourceMap1_ES6.ts] class C { ["hello"]() { debugger; } } -//// [computedPropertyNamesSourceMap1.js] +//// [computedPropertyNamesSourceMap1_ES6.js] var C = (function () { function C() { } @@ -14,4 +14,4 @@ var C = (function () { }; return C; })(); -//# sourceMappingURL=computedPropertyNamesSourceMap1.js.map \ No newline at end of file +//# sourceMappingURL=computedPropertyNamesSourceMap1_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js.map new file mode 100644 index 00000000000..51154cc4676 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap1_ES6.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap1_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES6.ts"],"names":["C","C.constructor","C[\"hello\"]"],"mappings":"AAAA,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAIPC,CAACA;IAHGD,YAACA,OAAOA,CAACA,GAATA;QACIE,QAAQA,CAACA;IACbA,CAACA;IACLF,QAACA;AAADA,CAACA,AAJD,IAIC"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.sourcemap.txt similarity index 85% rename from tests/baselines/reference/computedPropertyNamesSourceMap1.sourcemap.txt rename to tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.sourcemap.txt index e806eee1aa7..bb482f68cba 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.sourcemap.txt @@ -1,12 +1,12 @@ =================================================================== -JsFile: computedPropertyNamesSourceMap1.js -mapUrl: computedPropertyNamesSourceMap1.js.map +JsFile: computedPropertyNamesSourceMap1_ES6.js +mapUrl: computedPropertyNamesSourceMap1_ES6.js.map sourceRoot: -sources: computedPropertyNamesSourceMap1.ts +sources: computedPropertyNamesSourceMap1_ES6.ts =================================================================== ------------------------------------------------------------------- -emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.js -sourceFile:computedPropertyNamesSourceMap1.ts +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.js +sourceFile:computedPropertyNamesSourceMap1_ES6.ts ------------------------------------------------------------------- >>>var C = (function () { 1 > @@ -97,7 +97,7 @@ sourceFile:computedPropertyNamesSourceMap1.ts 2 >^ 3 > 4 > ^^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 >} 3 > @@ -111,4 +111,4 @@ sourceFile:computedPropertyNamesSourceMap1.ts 3 >Emitted(8, 2) Source(1, 1) + SourceIndex(0) 4 >Emitted(8, 6) Source(5, 2) + SourceIndex(0) --- ->>>//# sourceMappingURL=computedPropertyNamesSourceMap1.js.map \ No newline at end of file +>>>//# sourceMappingURL=computedPropertyNamesSourceMap1_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1.types b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.types similarity index 76% rename from tests/baselines/reference/computedPropertyNamesSourceMap1.types rename to tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.types index 54a2a9f19d0..d5dc8a857a0 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1.types +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.ts === class C { >C : C diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.js b/tests/baselines/reference/computedPropertyNamesSourceMap2.js deleted file mode 100644 index d967cb0d468..00000000000 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2.js +++ /dev/null @@ -1,14 +0,0 @@ -//// [computedPropertyNamesSourceMap2.ts] -var v = { - ["hello"]() { - debugger; - } -} - -//// [computedPropertyNamesSourceMap2.js] -var v = { - ["hello"]() { - debugger; - } -}; -//# sourceMappingURL=computedPropertyNamesSourceMap2.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2.js.map deleted file mode 100644 index 6c485c24f6f..00000000000 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2.js.map +++ /dev/null @@ -1,2 +0,0 @@ -//// [computedPropertyNamesSourceMap2.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap2.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;CACJ,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js new file mode 100644 index 00000000000..3d0274e65c7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js @@ -0,0 +1,14 @@ +//// [computedPropertyNamesSourceMap2_ES6.ts] +var v = { + ["hello"]() { + debugger; + } +} + +//// [computedPropertyNamesSourceMap2_ES6.js] +var v = { + ["hello"]() { + debugger; + } +}; +//# sourceMappingURL=computedPropertyNamesSourceMap2_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js.map new file mode 100644 index 00000000000..251171232e0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap2_ES6.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap2_ES6.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES6.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;CACJ,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.sourcemap.txt similarity index 79% rename from tests/baselines/reference/computedPropertyNamesSourceMap2.sourcemap.txt rename to tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.sourcemap.txt index 29f11b95e1f..48149aee0b5 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.sourcemap.txt @@ -1,12 +1,12 @@ =================================================================== -JsFile: computedPropertyNamesSourceMap2.js -mapUrl: computedPropertyNamesSourceMap2.js.map +JsFile: computedPropertyNamesSourceMap2_ES6.js +mapUrl: computedPropertyNamesSourceMap2_ES6.js.map sourceRoot: -sources: computedPropertyNamesSourceMap2.ts +sources: computedPropertyNamesSourceMap2_ES6.ts =================================================================== ------------------------------------------------------------------- -emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.js -sourceFile:computedPropertyNamesSourceMap2.ts +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.js +sourceFile:computedPropertyNamesSourceMap2_ES6.ts ------------------------------------------------------------------- >>>var v = { 1 > @@ -63,11 +63,11 @@ sourceFile:computedPropertyNamesSourceMap2.ts >>>}; 1 >^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >} 2 > 1 >Emitted(5, 2) Source(5, 2) + SourceIndex(0) 2 >Emitted(5, 3) Source(5, 2) + SourceIndex(0) --- ->>>//# sourceMappingURL=computedPropertyNamesSourceMap2.js.map \ No newline at end of file +>>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES6.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2.types b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types similarity index 81% rename from tests/baselines/reference/computedPropertyNamesSourceMap2.types rename to tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types index 972259eb3e2..9a1c71364a2 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2.types +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES6.types @@ -1,4 +1,4 @@ -=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.ts === +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts === var v = { >v : {} >{ ["hello"]() { debugger; }} : {} diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames10.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames10.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames11.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames11.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames13.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames13.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames16.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames16.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames18.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames18.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames19.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames1.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames20.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames20.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames21.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames22.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames22.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames23.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames24.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames25.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames25.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames26.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames27.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames28.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames28.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames29.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames29.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames2.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames30.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames31.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames31.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames33.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames33.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames34.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames36.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames37.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames37.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames38.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames39.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames40.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames41.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames41.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames43.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames44.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames45.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames46.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames46.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames47.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames47.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames48.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames48.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames4.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames4.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames7.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames7.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES6.ts diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts similarity index 100% rename from tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2.ts rename to tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES6.ts From 657d46539896a4dd436ededc4e2138dab82455a7 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Tue, 3 Feb 2015 17:43:31 -0800 Subject: [PATCH 003/162] Added ES5 tests for computed properties. --- .../computedPropertyNames10_ES5.errors.txt | 52 ++++++++ .../reference/computedPropertyNames10_ES5.js | 46 +++++++ .../computedPropertyNames11_ES5.errors.txt | 85 +++++++++++++ .../reference/computedPropertyNames11_ES5.js | 52 ++++++++ .../computedPropertyNames12_ES5.errors.txt | 52 ++++++++ .../reference/computedPropertyNames12_ES5.js | 31 +++++ .../computedPropertyNames13_ES5.errors.txt | 52 ++++++++ .../reference/computedPropertyNames13_ES5.js | 49 ++++++++ .../computedPropertyNames14_ES5.errors.txt | 48 ++++++++ .../reference/computedPropertyNames14_ES5.js | 30 +++++ .../computedPropertyNames15_ES5.errors.txt | 26 ++++ .../reference/computedPropertyNames15_ES5.js | 25 ++++ .../computedPropertyNames16_ES5.errors.txt | 52 ++++++++ .../reference/computedPropertyNames16_ES5.js | 99 +++++++++++++++ .../computedPropertyNames17_ES5.errors.txt | 48 ++++++++ .../reference/computedPropertyNames17_ES5.js | 57 +++++++++ .../computedPropertyNames18_ES5.errors.txt | 11 ++ .../reference/computedPropertyNames18_ES5.js | 13 ++ .../computedPropertyNames19_ES5.errors.txt | 14 +++ .../reference/computedPropertyNames19_ES5.js | 14 +++ .../computedPropertyNames1_ES5.errors.txt | 19 +++ .../reference/computedPropertyNames1_ES5.js | 14 +++ .../computedPropertyNames20_ES5.errors.txt | 9 ++ .../reference/computedPropertyNames20_ES5.js | 9 ++ .../computedPropertyNames21_ES5.errors.txt | 15 +++ .../reference/computedPropertyNames21_ES5.js | 19 +++ .../computedPropertyNames22_ES5.errors.txt | 14 +++ .../reference/computedPropertyNames22_ES5.js | 23 ++++ .../computedPropertyNames23_ES5.errors.txt | 22 ++++ .../reference/computedPropertyNames23_ES5.js | 21 ++++ .../computedPropertyNames24_ES5.errors.txt | 19 +++ .../reference/computedPropertyNames24_ES5.js | 38 ++++++ .../computedPropertyNames25_ES5.errors.txt | 19 +++ .../reference/computedPropertyNames25_ES5.js | 44 +++++++ .../computedPropertyNames26_ES5.errors.txt | 26 ++++ .../reference/computedPropertyNames26_ES5.js | 40 ++++++ .../computedPropertyNames27_ES5.errors.txt | 14 +++ .../reference/computedPropertyNames27_ES5.js | 28 +++++ .../computedPropertyNames28_ES5.errors.txt | 16 +++ .../reference/computedPropertyNames28_ES5.js | 35 ++++++ .../computedPropertyNames29_ES5.errors.txt | 16 +++ .../reference/computedPropertyNames29_ES5.js | 28 +++++ .../computedPropertyNames2_ES5.errors.txt | 37 ++++++ .../reference/computedPropertyNames2_ES5.js | 48 ++++++++ .../computedPropertyNames30_ES5.errors.txt | 24 ++++ .../reference/computedPropertyNames30_ES5.js | 45 +++++++ .../computedPropertyNames31_ES5.errors.txt | 21 ++++ .../reference/computedPropertyNames31_ES5.js | 49 ++++++++ .../computedPropertyNames32_ES5.errors.txt | 16 +++ .../reference/computedPropertyNames32_ES5.js | 23 ++++ .../computedPropertyNames33_ES5.errors.txt | 15 +++ .../reference/computedPropertyNames33_ES5.js | 27 +++++ .../computedPropertyNames34_ES5.errors.txt | 18 +++ .../reference/computedPropertyNames34_ES5.js | 27 +++++ .../computedPropertyNames35_ES5.errors.txt | 14 +++ .../reference/computedPropertyNames35_ES5.js | 11 ++ .../computedPropertyNames36_ES5.errors.txt | 22 ++++ .../reference/computedPropertyNames36_ES5.js | 42 +++++++ .../computedPropertyNames37_ES5.errors.txt | 19 +++ .../reference/computedPropertyNames37_ES5.js | 42 +++++++ .../computedPropertyNames38_ES5.errors.txt | 22 ++++ .../reference/computedPropertyNames38_ES5.js | 42 +++++++ .../computedPropertyNames39_ES5.errors.txt | 22 ++++ .../reference/computedPropertyNames39_ES5.js | 42 +++++++ .../computedPropertyNames3_ES5.errors.txt | 48 ++++++++ .../reference/computedPropertyNames3_ES5.js | 47 ++++++++ .../computedPropertyNames40_ES5.errors.txt | 22 ++++ .../reference/computedPropertyNames40_ES5.js | 35 ++++++ .../computedPropertyNames41_ES5.errors.txt | 15 +++ .../reference/computedPropertyNames41_ES5.js | 31 +++++ .../computedPropertyNames42_ES5.errors.txt | 18 +++ .../reference/computedPropertyNames42_ES5.js | 27 +++++ .../computedPropertyNames43_ES5.errors.txt | 24 ++++ .../reference/computedPropertyNames43_ES5.js | 57 +++++++++ .../computedPropertyNames44_ES5.errors.txt | 26 ++++ .../reference/computedPropertyNames44_ES5.js | 55 +++++++++ .../computedPropertyNames45_ES5.errors.txt | 24 ++++ .../reference/computedPropertyNames45_ES5.js | 56 +++++++++ .../computedPropertyNames46_ES5.errors.txt | 9 ++ .../reference/computedPropertyNames46_ES5.js | 9 ++ .../computedPropertyNames47_ES5.errors.txt | 11 ++ .../reference/computedPropertyNames47_ES5.js | 19 +++ .../computedPropertyNames48_ES5.errors.txt | 38 ++++++ .../reference/computedPropertyNames48_ES5.js | 34 ++++++ .../computedPropertyNames4_ES5.errors.txt | 52 ++++++++ .../reference/computedPropertyNames4_ES5.js | 35 ++++++ .../computedPropertyNames5_ES5.errors.txt | 48 ++++++++ .../reference/computedPropertyNames5_ES5.js | 21 ++++ .../computedPropertyNames6_ES5.errors.txt | 26 ++++ .../reference/computedPropertyNames6_ES5.js | 19 +++ .../computedPropertyNames7_ES5.errors.txt | 12 ++ .../reference/computedPropertyNames7_ES5.js | 16 +++ .../computedPropertyNames8_ES5.errors.txt | 23 ++++ .../reference/computedPropertyNames8_ES5.js | 19 +++ .../computedPropertyNames9_ES5.errors.txt | 25 ++++ .../reference/computedPropertyNames9_ES5.js | 20 +++ ...opertyNamesContextualType10_ES5.errors.txt | 26 ++++ ...mputedPropertyNamesContextualType10_ES5.js | 15 +++ ...ropertyNamesContextualType1_ES5.errors.txt | 18 +++ ...omputedPropertyNamesContextualType1_ES5.js | 18 +++ ...ropertyNamesContextualType2_ES5.errors.txt | 18 +++ ...omputedPropertyNamesContextualType2_ES5.js | 18 +++ ...ropertyNamesContextualType3_ES5.errors.txt | 17 +++ ...omputedPropertyNamesContextualType3_ES5.js | 17 +++ ...ropertyNamesContextualType4_ES5.errors.txt | 18 +++ ...omputedPropertyNamesContextualType4_ES5.js | 16 +++ ...ropertyNamesContextualType5_ES5.errors.txt | 18 +++ ...omputedPropertyNamesContextualType5_ES5.js | 16 +++ ...ropertyNamesContextualType6_ES5.errors.txt | 34 ++++++ ...omputedPropertyNamesContextualType6_ES5.js | 24 ++++ ...ropertyNamesContextualType7_ES5.errors.txt | 34 ++++++ ...omputedPropertyNamesContextualType7_ES5.js | 24 ++++ ...ropertyNamesContextualType8_ES5.errors.txt | 27 +++++ ...omputedPropertyNamesContextualType8_ES5.js | 16 +++ ...ropertyNamesContextualType9_ES5.errors.txt | 27 +++++ ...omputedPropertyNamesContextualType9_ES5.js | 16 +++ ...opertyNamesDeclarationEmit1_ES5.errors.txt | 17 +++ ...mputedPropertyNamesDeclarationEmit1_ES5.js | 28 +++++ ...opertyNamesDeclarationEmit2_ES5.errors.txt | 17 +++ ...mputedPropertyNamesDeclarationEmit2_ES5.js | 28 +++++ ...opertyNamesDeclarationEmit3_ES5.errors.txt | 9 ++ ...mputedPropertyNamesDeclarationEmit3_ES5.js | 6 + ...opertyNamesDeclarationEmit4_ES5.errors.txt | 9 ++ ...mputedPropertyNamesDeclarationEmit4_ES5.js | 7 ++ ...opertyNamesDeclarationEmit5_ES5.errors.txt | 27 +++++ ...mputedPropertyNamesDeclarationEmit5_ES5.js | 19 +++ ...tedPropertyNamesOnOverloads_ES5.errors.txt | 19 +++ .../computedPropertyNamesOnOverloads_ES5.js | 19 +++ ...utedPropertyNamesSourceMap1_ES5.errors.txt | 11 ++ .../computedPropertyNamesSourceMap1_ES5.js | 17 +++ ...computedPropertyNamesSourceMap1_ES5.js.map | 2 + ...dPropertyNamesSourceMap1_ES5.sourcemap.txt | 114 ++++++++++++++++++ ...utedPropertyNamesSourceMap2_ES5.errors.txt | 11 ++ .../computedPropertyNamesSourceMap2_ES5.js | 14 +++ ...computedPropertyNamesSourceMap2_ES5.js.map | 2 + ...dPropertyNamesSourceMap2_ES5.sourcemap.txt | 73 +++++++++++ .../computedPropertyNames10_ES5.ts | 17 +++ .../computedPropertyNames11_ES5.ts | 17 +++ .../computedPropertyNames12_ES5.ts | 17 +++ .../computedPropertyNames13_ES5.ts | 17 +++ .../computedPropertyNames14_ES5.ts | 10 ++ .../computedPropertyNames15_ES5.ts | 9 ++ .../computedPropertyNames16_ES5.ts | 17 +++ .../computedPropertyNames17_ES5.ts | 10 ++ .../computedPropertyNames18_ES5.ts | 6 + .../computedPropertyNames19_ES5.ts | 6 + .../computedPropertyNames1_ES5.ts | 5 + .../computedPropertyNames20_ES5.ts | 4 + .../computedPropertyNames21_ES5.ts | 7 ++ .../computedPropertyNames22_ES5.ts | 9 ++ .../computedPropertyNames23_ES5.ts | 9 ++ .../computedPropertyNames24_ES5.ts | 11 ++ .../computedPropertyNames25_ES5.ts | 14 +++ .../computedPropertyNames26_ES5.ts | 13 ++ .../computedPropertyNames27_ES5.ts | 6 + .../computedPropertyNames28_ES5.ts | 11 ++ .../computedPropertyNames29_ES5.ts | 11 ++ .../computedPropertyNames2_ES5.ts | 11 ++ .../computedPropertyNames30_ES5.ts | 16 +++ .../computedPropertyNames31_ES5.ts | 16 +++ .../computedPropertyNames32_ES5.ts | 8 ++ .../computedPropertyNames33_ES5.ts | 10 ++ .../computedPropertyNames34_ES5.ts | 10 ++ .../computedPropertyNames35_ES5.ts | 6 + .../computedPropertyNames36_ES5.ts | 11 ++ .../computedPropertyNames37_ES5.ts | 11 ++ .../computedPropertyNames38_ES5.ts | 11 ++ .../computedPropertyNames39_ES5.ts | 11 ++ .../computedPropertyNames3_ES5.ts | 10 ++ .../computedPropertyNames40_ES5.ts | 11 ++ .../computedPropertyNames41_ES5.ts | 10 ++ .../computedPropertyNames42_ES5.ts | 10 ++ .../computedPropertyNames43_ES5.ts | 13 ++ .../computedPropertyNames44_ES5.ts | 12 ++ .../computedPropertyNames45_ES5.ts | 13 ++ .../computedPropertyNames46_ES5.ts | 4 + .../computedPropertyNames47_ES5.ts | 6 + .../computedPropertyNames48_ES5.ts | 18 +++ .../computedPropertyNames4_ES5.ts | 17 +++ .../computedPropertyNames5_ES5.ts | 10 ++ .../computedPropertyNames6_ES5.ts | 9 ++ .../computedPropertyNames7_ES5.ts | 7 ++ .../computedPropertyNames8_ES5.ts | 9 ++ .../computedPropertyNames9_ES5.ts | 11 ++ ...mputedPropertyNamesContextualType10_ES5.ts | 9 ++ ...omputedPropertyNamesContextualType1_ES5.ts | 10 ++ ...omputedPropertyNamesContextualType2_ES5.ts | 10 ++ ...omputedPropertyNamesContextualType3_ES5.ts | 9 ++ ...omputedPropertyNamesContextualType4_ES5.ts | 10 ++ ...omputedPropertyNamesContextualType5_ES5.ts | 10 ++ ...omputedPropertyNamesContextualType6_ES5.ts | 14 +++ ...omputedPropertyNamesContextualType7_ES5.ts | 14 +++ ...omputedPropertyNamesContextualType8_ES5.ts | 10 ++ ...omputedPropertyNamesContextualType9_ES5.ts | 10 ++ ...mputedPropertyNamesDeclarationEmit1_ES5.ts | 7 ++ ...mputedPropertyNamesDeclarationEmit2_ES5.ts | 7 ++ ...mputedPropertyNamesDeclarationEmit3_ES5.ts | 5 + ...mputedPropertyNamesDeclarationEmit4_ES5.ts | 5 + ...mputedPropertyNamesDeclarationEmit5_ES5.ts | 8 ++ .../computedPropertyNamesOnOverloads_ES5.ts | 8 ++ .../computedPropertyNamesSourceMap1_ES5.ts | 7 ++ .../computedPropertyNamesSourceMap2_ES5.ts | 7 ++ 202 files changed, 4436 insertions(+) create mode 100644 tests/baselines/reference/computedPropertyNames10_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames10_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames11_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames11_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames12_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames12_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames13_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames13_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames14_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames14_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames15_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames15_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames16_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames16_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames17_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames17_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames18_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames18_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames19_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames19_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames1_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames1_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames20_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames20_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames21_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames21_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames22_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames22_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames23_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames23_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames24_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames24_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames25_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames25_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames26_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames26_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames27_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames27_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames28_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames28_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames29_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames29_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames2_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames2_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames30_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames30_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames31_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames31_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames32_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames32_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames33_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames33_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames34_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames34_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames35_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames35_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames36_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames36_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames37_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames37_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames38_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames38_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames39_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames39_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames3_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames3_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames40_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames40_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames41_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames41_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames42_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames42_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames43_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames43_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames44_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames44_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames45_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames45_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames46_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames46_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames47_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames47_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames48_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames48_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames4_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames4_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames5_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames5_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames6_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames6_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames7_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames7_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames8_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames8_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames9_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames9_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType1_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType2_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType3_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType4_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType5_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType6_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType7_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames10_ES5.errors.txt new file mode 100644 index 00000000000..30a5f07c271 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames10_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(13,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(14,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(15,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts (11 errors) ==== + var s: string; + var n: number; + var a: any; + var v = { + [s]() { }, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [n]() { }, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [s + s]() { }, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [s + n]() { }, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+s]() { }, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [""]() { }, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [0]() { }, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [a]() { }, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [true]() { }, + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [`hello bye`]() { }, + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [`hello ${a} bye`]() { } + ~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.js b/tests/baselines/reference/computedPropertyNames10_ES5.js new file mode 100644 index 00000000000..cb015e76dff --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames10_ES5.js @@ -0,0 +1,46 @@ +//// [computedPropertyNames10_ES5.ts] +var s: string; +var n: number; +var a: any; +var v = { + [s]() { }, + [n]() { }, + [s + s]() { }, + [s + n]() { }, + [+s]() { }, + [""]() { }, + [0]() { }, + [a]() { }, + [true]() { }, + [`hello bye`]() { }, + [`hello ${a} bye`]() { } +} + +//// [computedPropertyNames10_ES5.js] +var s; +var n; +var a; +var v = { + [s]: function () { + }, + [n]: function () { + }, + [s + s]: function () { + }, + [s + n]: function () { + }, + [+s]: function () { + }, + [""]: function () { + }, + [0]: function () { + }, + [a]: function () { + }, + [true]: function () { + }, + ["hello bye"]: function () { + }, + ["hello " + a + " bye"]: function () { + } +}; diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames11_ES5.errors.txt new file mode 100644 index 00000000000..21f8c8ef0eb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames11_ES5.errors.txt @@ -0,0 +1,85 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(7,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(7,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(10,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(10,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(12,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(12,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(13,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(13,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(14,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(14,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(15,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(15,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts (22 errors) ==== + var s: string; + var n: number; + var a: any; + var v = { + get [s]() { return 0; }, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [n](v) { }, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get [s + s]() { return 0; }, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [s + n](v) { }, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get [+s]() { return 0; }, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [""](v) { }, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get [0]() { return 0; }, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [a](v) { }, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get [true]() { return 0; }, + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [`hello bye`](v) { }, + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get [`hello ${a} bye`]() { return 0; } + ~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.js b/tests/baselines/reference/computedPropertyNames11_ES5.js new file mode 100644 index 00000000000..e716515b95c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames11_ES5.js @@ -0,0 +1,52 @@ +//// [computedPropertyNames11_ES5.ts] +var s: string; +var n: number; +var a: any; +var v = { + get [s]() { return 0; }, + set [n](v) { }, + get [s + s]() { return 0; }, + set [s + n](v) { }, + get [+s]() { return 0; }, + set [""](v) { }, + get [0]() { return 0; }, + set [a](v) { }, + get [true]() { return 0; }, + set [`hello bye`](v) { }, + get [`hello ${a} bye`]() { return 0; } +} + +//// [computedPropertyNames11_ES5.js] +var s; +var n; +var a; +var v = { + get [s]() { + return 0; + }, + set [n](v) { + }, + get [s + s]() { + return 0; + }, + set [s + n](v) { + }, + get [+s]() { + return 0; + }, + set [""](v) { + }, + get [0]() { + return 0; + }, + set [a](v) { + }, + get [true]() { + return 0; + }, + set ["hello bye"](v) { + }, + get ["hello " + a + " bye"]() { + return 0; + } +}; diff --git a/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt new file mode 100644 index 00000000000..ab25e1b1614 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames12_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(5,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(6,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(7,12): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(10,12): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(11,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(12,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(13,12): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(14,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts(15,12): error TS1166: Computed property names are not allowed in class property declarations. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts (11 errors) ==== + var s: string; + var n: number; + var a: any; + class C { + [s]: number; + ~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + [n] = n; + ~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + static [s + s]: string; + ~~~~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + [s + n] = 2; + ~~~~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + [+s]: typeof s; + ~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + static [""]: number; + ~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + [0]: number; + ~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + [a]: number; + ~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + static [true]: number; + ~~~~~~~~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + [`hello bye`] = 0; + ~~~~~~~~~~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + static [`hello ${a} bye`] = 0 + ~~~~~~~~~~~~~~~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames12_ES5.js b/tests/baselines/reference/computedPropertyNames12_ES5.js new file mode 100644 index 00000000000..c73ea11286f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames12_ES5.js @@ -0,0 +1,31 @@ +//// [computedPropertyNames12_ES5.ts] +var s: string; +var n: number; +var a: any; +class C { + [s]: number; + [n] = n; + static [s + s]: string; + [s + n] = 2; + [+s]: typeof s; + static [""]: number; + [0]: number; + [a]: number; + static [true]: number; + [`hello bye`] = 0; + static [`hello ${a} bye`] = 0 +} + +//// [computedPropertyNames12_ES5.js] +var s; +var n; +var a; +var C = (function () { + function C() { + this[n] = n; + this[s + n] = 2; + this["hello bye"] = 0; + } + C["hello " + a + " bye"] = 0; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames13_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames13_ES5.errors.txt new file mode 100644 index 00000000000..15d43c41c91 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames13_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(7,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(10,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(13,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(14,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(15,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts (11 errors) ==== + var s: string; + var n: number; + var a: any; + class C { + [s]() {} + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [n]() { } + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static [s + s]() { } + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [s + n]() { } + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+s]() { } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static [""]() { } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [0]() { } + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [a]() { } + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static [true]() { } + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [`hello bye`]() { } + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static [`hello ${a} bye`]() { } + ~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames13_ES5.js b/tests/baselines/reference/computedPropertyNames13_ES5.js new file mode 100644 index 00000000000..7933d6f9830 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames13_ES5.js @@ -0,0 +1,49 @@ +//// [computedPropertyNames13_ES5.ts] +var s: string; +var n: number; +var a: any; +class C { + [s]() {} + [n]() { } + static [s + s]() { } + [s + n]() { } + [+s]() { } + static [""]() { } + [0]() { } + [a]() { } + static [true]() { } + [`hello bye`]() { } + static [`hello ${a} bye`]() { } +} + +//// [computedPropertyNames13_ES5.js] +var s; +var n; +var a; +var C = (function () { + function C() { + } + C.prototype[s] = function () { + }; + C.prototype[n] = function () { + }; + C[s + s] = function () { + }; + C.prototype[s + n] = function () { + }; + C.prototype[+s] = function () { + }; + C[""] = function () { + }; + C.prototype[0] = function () { + }; + C.prototype[a] = function () { + }; + C[true] = function () { + }; + C.prototype["hello bye"] = function () { + }; + C["hello " + a + " bye"] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames14_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames14_ES5.errors.txt new file mode 100644 index 00000000000..b1a59252b61 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames14_ES5.errors.txt @@ -0,0 +1,48 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(3,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(4,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(6,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(8,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts (12 errors) ==== + var b: boolean; + class C { + [b]() {} + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static [true]() { } + ~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [[]]() { } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static [{}]() { } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [undefined]() { } + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static [null]() { } + ~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames14_ES5.js b/tests/baselines/reference/computedPropertyNames14_ES5.js new file mode 100644 index 00000000000..3a53e4106fc --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames14_ES5.js @@ -0,0 +1,30 @@ +//// [computedPropertyNames14_ES5.ts] +var b: boolean; +class C { + [b]() {} + static [true]() { } + [[]]() { } + static [{}]() { } + [undefined]() { } + static [null]() { } +} + +//// [computedPropertyNames14_ES5.js] +var b; +var C = (function () { + function C() { + } + C.prototype[b] = function () { + }; + C[true] = function () { + }; + C.prototype[[]] = function () { + }; + C[{}] = function () { + }; + C.prototype[undefined] = function () { + }; + C[null] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames15_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames15_ES5.errors.txt new file mode 100644 index 00000000000..8d450c673cd --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames15_ES5.errors.txt @@ -0,0 +1,26 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts (5 errors) ==== + var p1: number | string; + var p2: number | number[]; + var p3: string | boolean; + class C { + [p1]() { } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [p2]() { } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [p3]() { } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames15_ES5.js b/tests/baselines/reference/computedPropertyNames15_ES5.js new file mode 100644 index 00000000000..7e0db9855dd --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames15_ES5.js @@ -0,0 +1,25 @@ +//// [computedPropertyNames15_ES5.ts] +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +class C { + [p1]() { } + [p2]() { } + [p3]() { } +} + +//// [computedPropertyNames15_ES5.js] +var p1; +var p2; +var p3; +var C = (function () { + function C() { + } + C.prototype[p1] = function () { + }; + C.prototype[p2] = function () { + }; + C.prototype[p3] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames16_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames16_ES5.errors.txt new file mode 100644 index 00000000000..bb98073f363 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames16_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(7,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(10,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(12,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(13,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(14,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(15,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts (11 errors) ==== + var s: string; + var n: number; + var a: any; + class C { + get [s]() { return 0;} + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [n](v) { } + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static get [s + s]() { return 0; } + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [s + n](v) { } + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get [+s]() { return 0; } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static set [""](v) { } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get [0]() { return 0; } + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [a](v) { } + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static get [true]() { return 0; } + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [`hello bye`](v) { } + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get [`hello ${a} bye`]() { return 0; } + ~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames16_ES5.js b/tests/baselines/reference/computedPropertyNames16_ES5.js new file mode 100644 index 00000000000..b8c4991bee4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames16_ES5.js @@ -0,0 +1,99 @@ +//// [computedPropertyNames16_ES5.ts] +var s: string; +var n: number; +var a: any; +class C { + get [s]() { return 0;} + set [n](v) { } + static get [s + s]() { return 0; } + set [s + n](v) { } + get [+s]() { return 0; } + static set [""](v) { } + get [0]() { return 0; } + set [a](v) { } + static get [true]() { return 0; } + set [`hello bye`](v) { } + get [`hello ${a} bye`]() { return 0; } +} + +//// [computedPropertyNames16_ES5.js] +var s; +var n; +var a; +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, s, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, n, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, s + s, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, s + n, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, +s, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "", { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, 0, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, a, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, true, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "hello bye", { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "hello " + a + " bye", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames17_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames17_ES5.errors.txt new file mode 100644 index 00000000000..3b6da1d1e08 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames17_ES5.errors.txt @@ -0,0 +1,48 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(4,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(7,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts (12 errors) ==== + var b: boolean; + class C { + get [b]() { return 0;} + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static set [true](v) { } + ~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + get [[]]() { return 0; } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + set [{}](v) { } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static get [undefined]() { return 0; } + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + set [null](v) { } + ~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames17_ES5.js b/tests/baselines/reference/computedPropertyNames17_ES5.js new file mode 100644 index 00000000000..33bc5bfd3c8 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames17_ES5.js @@ -0,0 +1,57 @@ +//// [computedPropertyNames17_ES5.ts] +var b: boolean; +class C { + get [b]() { return 0;} + static set [true](v) { } + get [[]]() { return 0; } + set [{}](v) { } + static get [undefined]() { return 0; } + set [null](v) { } +} + +//// [computedPropertyNames17_ES5.js] +var b; +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, b, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, true, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, [], { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, {}, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, undefined, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, null, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames18_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames18_ES5.errors.txt new file mode 100644 index 00000000000..69b787530cd --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames18_ES5.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts (1 errors) ==== + function foo() { + var obj = { + [this.bar]: 0 + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames18_ES5.js b/tests/baselines/reference/computedPropertyNames18_ES5.js new file mode 100644 index 00000000000..8472e355cd1 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames18_ES5.js @@ -0,0 +1,13 @@ +//// [computedPropertyNames18_ES5.ts] +function foo() { + var obj = { + [this.bar]: 0 + } +} + +//// [computedPropertyNames18_ES5.js] +function foo() { + var obj = { + [this.bar]: 0 + }; +} diff --git a/tests/baselines/reference/computedPropertyNames19_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames19_ES5.errors.txt new file mode 100644 index 00000000000..9fbad563f8a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames19_ES5.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts(3,10): error TS2331: 'this' cannot be referenced in a module body. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts (2 errors) ==== + module M { + var obj = { + [this.bar]: 0 + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2331: 'this' cannot be referenced in a module body. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames19_ES5.js b/tests/baselines/reference/computedPropertyNames19_ES5.js new file mode 100644 index 00000000000..50fbd89595d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames19_ES5.js @@ -0,0 +1,14 @@ +//// [computedPropertyNames19_ES5.ts] +module M { + var obj = { + [this.bar]: 0 + } +} + +//// [computedPropertyNames19_ES5.js] +var M; +(function (M) { + var obj = { + [this.bar]: 0 + }; +})(M || (M = {})); diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames1_ES5.errors.txt new file mode 100644 index 00000000000..f5c28a0cab8 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames1_ES5.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts(2,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts(2,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts (4 errors) ==== + var v = { + get [0 + 1]() { return 0 }, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [0 + 1](v: string) { } //No error + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.js b/tests/baselines/reference/computedPropertyNames1_ES5.js new file mode 100644 index 00000000000..3c58cca5b22 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames1_ES5.js @@ -0,0 +1,14 @@ +//// [computedPropertyNames1_ES5.ts] +var v = { + get [0 + 1]() { return 0 }, + set [0 + 1](v: string) { } //No error +} + +//// [computedPropertyNames1_ES5.js] +var v = { + get [0 + 1]() { + return 0; + }, + set [0 + 1](v) { + } //No error +}; diff --git a/tests/baselines/reference/computedPropertyNames20_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames20_ES5.errors.txt new file mode 100644 index 00000000000..c8f79ea944a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames20_ES5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts (1 errors) ==== + var obj = { + [this.bar]: 0 + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames20_ES5.js b/tests/baselines/reference/computedPropertyNames20_ES5.js new file mode 100644 index 00000000000..347bbd71abc --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames20_ES5.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames20_ES5.ts] +var obj = { + [this.bar]: 0 +} + +//// [computedPropertyNames20_ES5.js] +var obj = { + [this.bar]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames21_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames21_ES5.errors.txt new file mode 100644 index 00000000000..437417107a6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames21_ES5.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts(5,6): error TS2465: 'this' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts (2 errors) ==== + class C { + bar() { + return 0; + } + [this.bar()]() { } + ~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2465: 'this' cannot be referenced in a computed property name. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames21_ES5.js b/tests/baselines/reference/computedPropertyNames21_ES5.js new file mode 100644 index 00000000000..2678cdc2286 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames21_ES5.js @@ -0,0 +1,19 @@ +//// [computedPropertyNames21_ES5.ts] +class C { + bar() { + return 0; + } + [this.bar()]() { } +} + +//// [computedPropertyNames21_ES5.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + return 0; + }; + C.prototype[this.bar()] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames22_ES5.errors.txt new file mode 100644 index 00000000000..1ec6413b117 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames22_ES5.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts(4,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts (1 errors) ==== + class C { + bar() { + var obj = { + [this.bar()]() { } + ~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }; + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.js b/tests/baselines/reference/computedPropertyNames22_ES5.js new file mode 100644 index 00000000000..a3881b01845 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames22_ES5.js @@ -0,0 +1,23 @@ +//// [computedPropertyNames22_ES5.ts] +class C { + bar() { + var obj = { + [this.bar()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames22_ES5.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + var obj = { + [this.bar()]: function () { + } + }; + return 0; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames23_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames23_ES5.errors.txt new file mode 100644 index 00000000000..76227dccaf5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames23_ES5.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts(6,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts(6,12): error TS2465: 'this' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts (3 errors) ==== + class C { + bar() { + return 0; + } + [ + ~ + { [this.bar()]: 1 }[0] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2465: 'this' cannot be referenced in a computed property name. + ]() { } + ~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames23_ES5.js b/tests/baselines/reference/computedPropertyNames23_ES5.js new file mode 100644 index 00000000000..6e0e63dcf6a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames23_ES5.js @@ -0,0 +1,21 @@ +//// [computedPropertyNames23_ES5.ts] +class C { + bar() { + return 0; + } + [ + { [this.bar()]: 1 }[0] + ]() { } +} + +//// [computedPropertyNames23_ES5.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + return 0; + }; + C.prototype[{ [this.bar()]: 1 }[0]] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames24_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames24_ES5.errors.txt new file mode 100644 index 00000000000..2cb804133aa --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames24_ES5.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts(9,6): error TS2466: 'super' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts (2 errors) ==== + class Base { + bar() { + return 0; + } + } + class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [super.bar()]() { } + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~ +!!! error TS2466: 'super' cannot be referenced in a computed property name. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames24_ES5.js b/tests/baselines/reference/computedPropertyNames24_ES5.js new file mode 100644 index 00000000000..d24f406c1ad --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames24_ES5.js @@ -0,0 +1,38 @@ +//// [computedPropertyNames24_ES5.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [super.bar()]() { } +} + +//// [computedPropertyNames24_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + C.prototype[super.bar.call(this)] = function () { + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames25_ES5.errors.txt new file mode 100644 index 00000000000..38142b2d177 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames25_ES5.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts(9,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts (1 errors) ==== + class Base { + bar() { + return 0; + } + } + class C extends Base { + foo() { + var obj = { + [super.bar()]() { } + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }; + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js new file mode 100644 index 00000000000..532751416f2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -0,0 +1,44 @@ +//// [computedPropertyNames25_ES5.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + var obj = { + [super.bar()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames25_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype.foo = function () { + var obj = { + [_super.prototype.bar.call(this)]: function () { + } + }; + return 0; + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames26_ES5.errors.txt new file mode 100644 index 00000000000..fbef1d95ad4 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames26_ES5.errors.txt @@ -0,0 +1,26 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(10,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(10,12): error TS2466: 'super' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts (3 errors) ==== + class Base { + bar() { + return 0; + } + } + class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [ + ~ + { [super.bar()]: 1 }[0] + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~ +!!! error TS2466: 'super' cannot be referenced in a computed property name. + ]() { } + ~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.js b/tests/baselines/reference/computedPropertyNames26_ES5.js new file mode 100644 index 00000000000..fd76bf20ed8 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -0,0 +1,40 @@ +//// [computedPropertyNames26_ES5.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [ + { [super.bar()]: 1 }[0] + ]() { } +} + +//// [computedPropertyNames26_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + C.prototype[{ [super.bar.call(this)]: 1 }[0]] = function () { + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames27_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames27_ES5.errors.txt new file mode 100644 index 00000000000..4508574cde1 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames27_ES5.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts(4,7): error TS2466: 'super' cannot be referenced in a computed property name. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts (2 errors) ==== + class Base { + } + class C extends Base { + [(super(), "prop")]() { } + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~ +!!! error TS2466: 'super' cannot be referenced in a computed property name. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames27_ES5.js b/tests/baselines/reference/computedPropertyNames27_ES5.js new file mode 100644 index 00000000000..2f550731dfb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames27_ES5.js @@ -0,0 +1,28 @@ +//// [computedPropertyNames27_ES5.ts] +class Base { +} +class C extends Base { + [(super(), "prop")]() { } +} + +//// [computedPropertyNames27_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype[(_super.call(this), "prop")] = function () { + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames28_ES5.errors.txt new file mode 100644 index 00000000000..1e52db34288 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames28_ES5.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts(7,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts (1 errors) ==== + class Base { + } + class C extends Base { + constructor() { + super(); + var obj = { + [(super(), "prop")]() { } + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js new file mode 100644 index 00000000000..c79357908da --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -0,0 +1,35 @@ +//// [computedPropertyNames28_ES5.ts] +class Base { +} +class C extends Base { + constructor() { + super(); + var obj = { + [(super(), "prop")]() { } + }; + } +} + +//// [computedPropertyNames28_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.call(this); + var obj = { + [(_super.call(this), "prop")]: function () { + } + }; + } + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames29_ES5.errors.txt new file mode 100644 index 00000000000..0b248e0d9ca --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames29_ES5.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts(5,17): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts (1 errors) ==== + class C { + bar() { + () => { + var obj = { + [this.bar()]() { } // needs capture + ~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }; + } + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.js b/tests/baselines/reference/computedPropertyNames29_ES5.js new file mode 100644 index 00000000000..de0667a874c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames29_ES5.js @@ -0,0 +1,28 @@ +//// [computedPropertyNames29_ES5.ts] +class C { + bar() { + () => { + var obj = { + [this.bar()]() { } // needs capture + }; + } + return 0; + } +} + +//// [computedPropertyNames29_ES5.js] +var C = (function () { + function C() { + } + C.prototype.bar = function () { + var _this = this; + (function () { + var obj = { + [_this.bar()]: function () { + } // needs capture + }; + }); + return 0; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt new file mode 100644 index 00000000000..e25f3b765e9 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt @@ -0,0 +1,37 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(5,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(7,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(8,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(9,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts (8 errors) ==== + var methodName = "method"; + var accessorName = "accessor"; + class C { + [methodName]() { } + ~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static [methodName]() { } + ~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get [accessorName]() { } + ~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + set [accessorName](v) { } + ~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static get [accessorName]() { } + ~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + static set [accessorName](v) { } + ~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames2_ES5.js b/tests/baselines/reference/computedPropertyNames2_ES5.js new file mode 100644 index 00000000000..97d9a673bbb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames2_ES5.js @@ -0,0 +1,48 @@ +//// [computedPropertyNames2_ES5.ts] +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName]() { } + static [methodName]() { } + get [accessorName]() { } + set [accessorName](v) { } + static get [accessorName]() { } + static set [accessorName](v) { } +} + +//// [computedPropertyNames2_ES5.js] +var methodName = "method"; +var accessorName = "accessor"; +var C = (function () { + function C() { + } + C.prototype[methodName] = function () { + }; + C[methodName] = function () { + }; + Object.defineProperty(C.prototype, accessorName, { + get: function () { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, accessorName, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, accessorName, { + get: function () { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, accessorName, { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames30_ES5.errors.txt new file mode 100644 index 00000000000..a8c51a03246 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames30_ES5.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts(11,17): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts (2 errors) ==== + class Base { + } + class C extends Base { + constructor() { + super(); + () => { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(super(), "prop")]() { } + ~~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~ +!!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors + }; + } + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js new file mode 100644 index 00000000000..995cb2f8bf0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -0,0 +1,45 @@ +//// [computedPropertyNames30_ES5.ts] +class Base { +} +class C extends Base { + constructor() { + super(); + () => { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(super(), "prop")]() { } + }; + } + } +} + +//// [computedPropertyNames30_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.call(this); + (function () { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(_super.call(this), "prop")]: function () { + } + }; + }); + } + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames31_ES5.errors.txt new file mode 100644 index 00000000000..ab2f4783e36 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames31_ES5.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts(10,17): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts (1 errors) ==== + class Base { + bar() { + return 0; + } + } + class C extends Base { + foo() { + () => { + var obj = { + [super.bar()]() { } // needs capture + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }; + } + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js new file mode 100644 index 00000000000..81d91a3ba31 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -0,0 +1,49 @@ +//// [computedPropertyNames31_ES5.ts] +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + () => { + var obj = { + [super.bar()]() { } // needs capture + }; + } + return 0; + } +} + +//// [computedPropertyNames31_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Base = (function () { + function Base() { + } + Base.prototype.bar = function () { + return 0; + }; + return Base; +})(); +var C = (function (_super) { + __extends(C, _super); + function C() { + _super.apply(this, arguments); + } + C.prototype.foo = function () { + var _this = this; + (function () { + var obj = { + [_super.prototype.bar.call(_this)]: function () { + } // needs capture + }; + }); + return 0; + }; + return C; +})(Base); diff --git a/tests/baselines/reference/computedPropertyNames32_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames32_ES5.errors.txt new file mode 100644 index 00000000000..2cbba4b9b62 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames32_ES5.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts(6,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts (2 errors) ==== + function foo() { return '' } + class C { + bar() { + return 0; + } + [foo()]() { } + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~ +!!! error TS2466: A computed property name cannot reference a type parameter from its containing type. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames32_ES5.js b/tests/baselines/reference/computedPropertyNames32_ES5.js new file mode 100644 index 00000000000..5a541202582 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames32_ES5.js @@ -0,0 +1,23 @@ +//// [computedPropertyNames32_ES5.ts] +function foo() { return '' } +class C { + bar() { + return 0; + } + [foo()]() { } +} + +//// [computedPropertyNames32_ES5.js] +function foo() { + return ''; +} +var C = (function () { + function C() { + } + C.prototype.bar = function () { + return 0; + }; + C.prototype[foo()] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames33_ES5.errors.txt new file mode 100644 index 00000000000..ce79d83627c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames33_ES5.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts(5,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts (1 errors) ==== + function foo() { return '' } + class C { + bar() { + var obj = { + [foo()]() { } + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }; + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.js b/tests/baselines/reference/computedPropertyNames33_ES5.js new file mode 100644 index 00000000000..982f6e69c46 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames33_ES5.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames33_ES5.ts] +function foo() { return '' } +class C { + bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames33_ES5.js] +function foo() { + return ''; +} +var C = (function () { + function C() { + } + C.prototype.bar = function () { + var obj = { + [foo()]: function () { + } + }; + return 0; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames34_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames34_ES5.errors.txt new file mode 100644 index 00000000000..99f53d8b13b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames34_ES5.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts(5,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts(5,18): error TS2302: Static members cannot reference class type parameters. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts (2 errors) ==== + function foo() { return '' } + class C { + static bar() { + var obj = { + [foo()]() { } + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~ +!!! error TS2302: Static members cannot reference class type parameters. + }; + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames34_ES5.js b/tests/baselines/reference/computedPropertyNames34_ES5.js new file mode 100644 index 00000000000..3c588af07df --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames34_ES5.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames34_ES5.ts] +function foo() { return '' } +class C { + static bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} + +//// [computedPropertyNames34_ES5.js] +function foo() { + return ''; +} +var C = (function () { + function C() { + } + C.bar = function () { + var obj = { + [foo()]: function () { + } + }; + return 0; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames35_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames35_ES5.errors.txt new file mode 100644 index 00000000000..4f94b54d3c7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames35_ES5.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts(4,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts(4,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts (2 errors) ==== + function foo() { return '' } + interface I { + bar(): string; + [foo()](): void; + ~~~~~~~~~~ +!!! error TS1169: Computed property names are not allowed in interfaces. + ~ +!!! error TS2466: A computed property name cannot reference a type parameter from its containing type. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames35_ES5.js b/tests/baselines/reference/computedPropertyNames35_ES5.js new file mode 100644 index 00000000000..b55743a2d83 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames35_ES5.js @@ -0,0 +1,11 @@ +//// [computedPropertyNames35_ES5.ts] +function foo() { return '' } +interface I { + bar(): string; + [foo()](): void; +} + +//// [computedPropertyNames35_ES5.js] +function foo() { + return ''; +} diff --git a/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt new file mode 100644 index 00000000000..fe90ccf2a71 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts (3 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set ["set1"](p: Foo2) { } + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames36_ES5.js b/tests/baselines/reference/computedPropertyNames36_ES5.js new file mode 100644 index 00000000000..fa92da7b7b6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames36_ES5.js @@ -0,0 +1,42 @@ +//// [computedPropertyNames36_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} + +//// [computedPropertyNames36_ES5.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + // Computed properties + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "set1", { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames37_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames37_ES5.errors.txt new file mode 100644 index 00000000000..562f3756e59 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames37_ES5.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts (2 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: number]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set ["set1"](p: Foo2) { } + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames37_ES5.js b/tests/baselines/reference/computedPropertyNames37_ES5.js new file mode 100644 index 00000000000..f185e93db3c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames37_ES5.js @@ -0,0 +1,42 @@ +//// [computedPropertyNames37_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} + +//// [computedPropertyNames37_ES5.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + // Computed properties + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "set1", { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt new file mode 100644 index 00000000000..7f7579d9eea --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts (3 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [1 << 6](p: Foo2) { } + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames38_ES5.js b/tests/baselines/reference/computedPropertyNames38_ES5.js new file mode 100644 index 00000000000..42115927b30 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames38_ES5.js @@ -0,0 +1,42 @@ +//// [computedPropertyNames38_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} + +//// [computedPropertyNames38_ES5.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, 1 << 6, { + // Computed properties + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, 1 << 6, { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt new file mode 100644 index 00000000000..7f4389794fb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts (3 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: number]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set [1 << 6](p: Foo2) { } + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames39_ES5.js b/tests/baselines/reference/computedPropertyNames39_ES5.js new file mode 100644 index 00000000000..12cc55f1315 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames39_ES5.js @@ -0,0 +1,42 @@ +//// [computedPropertyNames39_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} + +//// [computedPropertyNames39_ES5.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, 1 << 6, { + // Computed properties + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, 1 << 6, { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt new file mode 100644 index 00000000000..b484ee7269f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt @@ -0,0 +1,48 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(3,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(4,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(8,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts (12 errors) ==== + var id; + class C { + [0 + 1]() { } + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static [() => { }]() { } + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + get [delete id]() { } + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + set [[0, 1]](v) { } + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static get [""]() { } + ~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~ +!!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. + ~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + static set [id.toString()](v) { } + ~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames3_ES5.js b/tests/baselines/reference/computedPropertyNames3_ES5.js new file mode 100644 index 00000000000..fe0b0ec1841 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames3_ES5.js @@ -0,0 +1,47 @@ +//// [computedPropertyNames3_ES5.ts] +var id; +class C { + [0 + 1]() { } + static [() => { }]() { } + get [delete id]() { } + set [[0, 1]](v) { } + static get [""]() { } + static set [id.toString()](v) { } +} + +//// [computedPropertyNames3_ES5.js] +var id; +var C = (function () { + function C() { + } + C.prototype[0 + 1] = function () { + }; + C[function () { + }] = function () { + }; + Object.defineProperty(C.prototype, delete id, { + get: function () { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, [0, 1], { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "", { + get: function () { + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, id.toString(), { + set: function (v) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt new file mode 100644 index 00000000000..762d2d44e20 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(8,5): error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts (3 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: () => Foo2; + + // Computed properties + [""]() { return new Foo } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. + [""]() { return new Foo2 } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames40_ES5.js b/tests/baselines/reference/computedPropertyNames40_ES5.js new file mode 100644 index 00000000000..887c5c3847e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames40_ES5.js @@ -0,0 +1,35 @@ +//// [computedPropertyNames40_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + [""]() { return new Foo } + [""]() { return new Foo2 } +} + +//// [computedPropertyNames40_ES5.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + // Computed properties + C.prototype[""] = function () { + return new Foo; + }; + C.prototype[""] = function () { + return new Foo2; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames41_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames41_ES5.errors.txt new file mode 100644 index 00000000000..a2251da6a86 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames41_ES5.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts(8,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts (1 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: () => Foo2; + + // Computed properties + static [""]() { return new Foo } + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames41_ES5.js b/tests/baselines/reference/computedPropertyNames41_ES5.js new file mode 100644 index 00000000000..b4223ec5217 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames41_ES5.js @@ -0,0 +1,31 @@ +//// [computedPropertyNames41_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + static [""]() { return new Foo } +} + +//// [computedPropertyNames41_ES5.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + // Computed properties + C[""] = function () { + return new Foo; + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt new file mode 100644 index 00000000000..35a47c4e54a --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames42_ES5.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts (2 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + + // Computed properties + [""]: Foo; + ~~~~ +!!! error TS1166: Computed property names are not allowed in class property declarations. + ~~~~~~~~~~ +!!! error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames42_ES5.js b/tests/baselines/reference/computedPropertyNames42_ES5.js new file mode 100644 index 00000000000..f4fda8fc829 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames42_ES5.js @@ -0,0 +1,27 @@ +//// [computedPropertyNames42_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + [""]: Foo; +} + +//// [computedPropertyNames42_ES5.js] +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt new file mode 100644 index 00000000000..2654d0076e3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(10,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts (3 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + } + + class D extends C { + // Computed properties + get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set ["set1"](p: Foo2) { } + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames43_ES5.js b/tests/baselines/reference/computedPropertyNames43_ES5.js new file mode 100644 index 00000000000..f7faa347986 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames43_ES5.js @@ -0,0 +1,57 @@ +//// [computedPropertyNames43_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; +} + +class D extends C { + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} + +//// [computedPropertyNames43_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "get1", { + // Computed properties + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(D.prototype, "set1", { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return D; +})(C); diff --git a/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt new file mode 100644 index 00000000000..27921efa1fb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt @@ -0,0 +1,26 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(10,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts (4 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + [s: string]: Foo2; + get ["get1"]() { return new Foo } + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } + + class D extends C { + set ["set1"](p: Foo) { } + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames44_ES5.js b/tests/baselines/reference/computedPropertyNames44_ES5.js new file mode 100644 index 00000000000..072b3e90681 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames44_ES5.js @@ -0,0 +1,55 @@ +//// [computedPropertyNames44_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + get ["get1"]() { return new Foo } +} + +class D extends C { + set ["set1"](p: Foo) { } +} + +//// [computedPropertyNames44_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "set1", { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return D; +})(C); diff --git a/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt new file mode 100644 index 00000000000..92b87702561 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts (3 errors) ==== + class Foo { x } + class Foo2 { x; y } + + class C { + get ["get1"]() { return new Foo } + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } + + class D extends C { + // No error when the indexer is in a class more derived than the computed property + [s: string]: Foo2; + set ["set1"](p: Foo) { } + ~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames45_ES5.js b/tests/baselines/reference/computedPropertyNames45_ES5.js new file mode 100644 index 00000000000..4389b32a835 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames45_ES5.js @@ -0,0 +1,56 @@ +//// [computedPropertyNames45_ES5.ts] +class Foo { x } +class Foo2 { x; y } + +class C { + get ["get1"]() { return new Foo } +} + +class D extends C { + // No error when the indexer is in a class more derived than the computed property + [s: string]: Foo2; + set ["set1"](p: Foo) { } +} + +//// [computedPropertyNames45_ES5.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var Foo = (function () { + function Foo() { + } + return Foo; +})(); +var Foo2 = (function () { + function Foo2() { + } + return Foo2; +})(); +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, "get1", { + get: function () { + return new Foo; + }, + enumerable: true, + configurable: true + }); + return C; +})(); +var D = (function (_super) { + __extends(D, _super); + function D() { + _super.apply(this, arguments); + } + Object.defineProperty(D.prototype, "set1", { + set: function (p) { + }, + enumerable: true, + configurable: true + }); + return D; +})(C); diff --git a/tests/baselines/reference/computedPropertyNames46_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames46_ES5.errors.txt new file mode 100644 index 00000000000..6af18c9e685 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames46_ES5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts (1 errors) ==== + var o = { + ["" || 0]: 0 + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }; \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames46_ES5.js b/tests/baselines/reference/computedPropertyNames46_ES5.js new file mode 100644 index 00000000000..6c7a393ccbe --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames46_ES5.js @@ -0,0 +1,9 @@ +//// [computedPropertyNames46_ES5.ts] +var o = { + ["" || 0]: 0 +}; + +//// [computedPropertyNames46_ES5.js] +var o = { + ["" || 0]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames47_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames47_ES5.errors.txt new file mode 100644 index 00000000000..2f5af797b64 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames47_ES5.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts (1 errors) ==== + enum E1 { x } + enum E2 { x } + var o = { + [E1.x || E2.x]: 0 + ~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }; \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames47_ES5.js b/tests/baselines/reference/computedPropertyNames47_ES5.js new file mode 100644 index 00000000000..10e31bd9599 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames47_ES5.js @@ -0,0 +1,19 @@ +//// [computedPropertyNames47_ES5.ts] +enum E1 { x } +enum E2 { x } +var o = { + [E1.x || E2.x]: 0 +}; + +//// [computedPropertyNames47_ES5.js] +var E1; +(function (E1) { + E1[E1["x"] = 0] = "x"; +})(E1 || (E1 = {})); +var E2; +(function (E2) { + E2[E2["x"] = 0] = "x"; +})(E2 || (E2 = {})); +var o = { + [0 /* x */ || 0 /* x */]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames48_ES5.errors.txt new file mode 100644 index 00000000000..cbda0c73c1f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames48_ES5.errors.txt @@ -0,0 +1,38 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(16,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(16,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts (6 errors) ==== + declare function extractIndexer(p: { [n: number]: T }): T; + + enum E { x } + + var a: any; + + extractIndexer({ + [a]: "" + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }); // Should return string + + extractIndexer({ + [E.x]: "" + ~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }); // Should return string + + extractIndexer({ + ["" || 0]: "" + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }); // Should return any (widened form of undefined) \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.js b/tests/baselines/reference/computedPropertyNames48_ES5.js new file mode 100644 index 00000000000..eb1c50857c7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames48_ES5.js @@ -0,0 +1,34 @@ +//// [computedPropertyNames48_ES5.ts] +declare function extractIndexer(p: { [n: number]: T }): T; + +enum E { x } + +var a: any; + +extractIndexer({ + [a]: "" +}); // Should return string + +extractIndexer({ + [E.x]: "" +}); // Should return string + +extractIndexer({ + ["" || 0]: "" +}); // Should return any (widened form of undefined) + +//// [computedPropertyNames48_ES5.js] +var E; +(function (E) { + E[E["x"] = 0] = "x"; +})(E || (E = {})); +var a; +extractIndexer({ + [a]: "" +}); // Should return string +extractIndexer({ + [0 /* x */]: "" +}); // Should return string +extractIndexer({ + ["" || 0]: "" +}); // Should return any (widened form of undefined) diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames4_ES5.errors.txt new file mode 100644 index 00000000000..39765b8365e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames4_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(13,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(14,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(15,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts (11 errors) ==== + var s: string; + var n: number; + var a: any; + var v = { + [s]: 0, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [n]: n, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [s + s]: 1, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [s + n]: 2, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+s]: s, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [""]: 0, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [0]: 0, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [a]: 1, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [true]: 0, + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [`hello bye`]: 0, + ~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [`hello ${a} bye`]: 0 + ~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.js b/tests/baselines/reference/computedPropertyNames4_ES5.js new file mode 100644 index 00000000000..f5a41bd58aa --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames4_ES5.js @@ -0,0 +1,35 @@ +//// [computedPropertyNames4_ES5.ts] +var s: string; +var n: number; +var a: any; +var v = { + [s]: 0, + [n]: n, + [s + s]: 1, + [s + n]: 2, + [+s]: s, + [""]: 0, + [0]: 0, + [a]: 1, + [true]: 0, + [`hello bye`]: 0, + [`hello ${a} bye`]: 0 +} + +//// [computedPropertyNames4_ES5.js] +var s; +var n; +var a; +var v = { + [s]: 0, + [n]: n, + [s + s]: 1, + [s + n]: 2, + [+s]: s, + [""]: 0, + [0]: 0, + [a]: 1, + [true]: 0, + ["hello bye"]: 0, + ["hello " + a + " bye"]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames5_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames5_ES5.errors.txt new file mode 100644 index 00000000000..b65197056f7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames5_ES5.errors.txt @@ -0,0 +1,48 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(3,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts (12 errors) ==== + var b: boolean; + var v = { + [b]: 0, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [true]: 1, + ~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [[]]: 0, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [{}]: 0, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [undefined]: undefined, + ~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [null]: null + ~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames5_ES5.js b/tests/baselines/reference/computedPropertyNames5_ES5.js new file mode 100644 index 00000000000..5bdeb8a6637 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames5_ES5.js @@ -0,0 +1,21 @@ +//// [computedPropertyNames5_ES5.ts] +var b: boolean; +var v = { + [b]: 0, + [true]: 1, + [[]]: 0, + [{}]: 0, + [undefined]: undefined, + [null]: null +} + +//// [computedPropertyNames5_ES5.js] +var b; +var v = { + [b]: 0, + [true]: 1, + [[]]: 0, + [{}]: 0, + [undefined]: undefined, + [null]: null +}; diff --git a/tests/baselines/reference/computedPropertyNames6_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames6_ES5.errors.txt new file mode 100644 index 00000000000..c7cc95a06ae --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames6_ES5.errors.txt @@ -0,0 +1,26 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts (5 errors) ==== + var p1: number | string; + var p2: number | number[]; + var p3: string | boolean; + var v = { + [p1]: 0, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [p2]: 1, + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [p3]: 2 + ~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames6_ES5.js b/tests/baselines/reference/computedPropertyNames6_ES5.js new file mode 100644 index 00000000000..5772dc9ab89 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames6_ES5.js @@ -0,0 +1,19 @@ +//// [computedPropertyNames6_ES5.ts] +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +var v = { + [p1]: 0, + [p2]: 1, + [p3]: 2 +} + +//// [computedPropertyNames6_ES5.js] +var p1; +var p2; +var p3; +var v = { + [p1]: 0, + [p2]: 1, + [p3]: 2 +}; diff --git a/tests/baselines/reference/computedPropertyNames7_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames7_ES5.errors.txt new file mode 100644 index 00000000000..389d47c2e0e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames7_ES5.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts (1 errors) ==== + enum E { + member + } + var v = { + [E.member]: 0 + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames7_ES5.js b/tests/baselines/reference/computedPropertyNames7_ES5.js new file mode 100644 index 00000000000..32a0bdc70d1 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames7_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNames7_ES5.ts] +enum E { + member +} +var v = { + [E.member]: 0 +} + +//// [computedPropertyNames7_ES5.js] +var E; +(function (E) { + E[E["member"] = 0] = "member"; +})(E || (E = {})); +var v = { + [0 /* member */]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNames8_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames8_ES5.errors.txt new file mode 100644 index 00000000000..e66d445fdda --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames8_ES5.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts (4 errors) ==== + function f() { + var t: T; + var u: U; + var v = { + [t]: 0, + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + [u]: 1 + ~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + }; + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames8_ES5.js b/tests/baselines/reference/computedPropertyNames8_ES5.js new file mode 100644 index 00000000000..8381a681534 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames8_ES5.js @@ -0,0 +1,19 @@ +//// [computedPropertyNames8_ES5.ts] +function f() { + var t: T; + var u: U; + var v = { + [t]: 0, + [u]: 1 + }; +} + +//// [computedPropertyNames8_ES5.js] +function f() { + var t; + var u; + var v = { + [t]: 0, + [u]: 1 + }; +} diff --git a/tests/baselines/reference/computedPropertyNames9_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames9_ES5.errors.txt new file mode 100644 index 00000000000..1b97c1bfc5c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames9_ES5.errors.txt @@ -0,0 +1,25 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts (4 errors) ==== + function f(s: string): string; + function f(n: number): number; + function f(x: T): T; + function f(x): any { } + + var v = { + [f("")]: 0, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [f(0)]: 0, + ~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [f(true)]: 0 + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames9_ES5.js b/tests/baselines/reference/computedPropertyNames9_ES5.js new file mode 100644 index 00000000000..e1092d0d3ec --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames9_ES5.js @@ -0,0 +1,20 @@ +//// [computedPropertyNames9_ES5.ts] +function f(s: string): string; +function f(n: number): number; +function f(x: T): T; +function f(x): any { } + +var v = { + [f("")]: 0, + [f(0)]: 0, + [f(true)]: 0 +} + +//// [computedPropertyNames9_ES5.js] +function f(x) { +} +var v = { + [f("")]: 0, + [f(0)]: 0, + [f(true)]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt new file mode 100644 index 00000000000..5bfd1959647 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt @@ -0,0 +1,26 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts(5,5): error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. + Index signatures are incompatible. + Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts (3 errors) ==== + interface I { + [s: number]: boolean; + } + + var o: I = { + ~ +!!! error TS2322: Type '{ [x: number]: string | number; }' is not assignable to type 'I'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + [+"foo"]: "", + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+"bar"]: 0 + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js new file mode 100644 index 00000000000..0435789b210 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js @@ -0,0 +1,15 @@ +//// [computedPropertyNamesContextualType10_ES5.ts] +interface I { + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType10_ES5.js] +var o = { + [+"foo"]: "", + [+"bar"]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.errors.txt new file mode 100644 index 00000000000..571a7142527 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts (2 errors) ==== + interface I { + [s: string]: (x: string) => number; + [s: number]: (x: any) => number; // Doesn't get hit + } + + var o: I = { + ["" + 0](y) { return y.length; }, + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ["" + 1]: y => y.length + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js new file mode 100644 index 00000000000..e58a4dfc86b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js @@ -0,0 +1,18 @@ +//// [computedPropertyNamesContextualType1_ES5.ts] +interface I { + [s: string]: (x: string) => number; + [s: number]: (x: any) => number; // Doesn't get hit +} + +var o: I = { + ["" + 0](y) { return y.length; }, + ["" + 1]: y => y.length +} + +//// [computedPropertyNamesContextualType1_ES5.js] +var o = { + ["" + 0]: function (y) { + return y.length; + }, + ["" + 1]: function (y) { return y.length; } +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.errors.txt new file mode 100644 index 00000000000..930d67155e0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts (2 errors) ==== + interface I { + [s: string]: (x: any) => number; // Doesn't get hit + [s: number]: (x: string) => number; + } + + var o: I = { + [+"foo"](y) { return y.length; }, + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+"bar"]: y => y.length + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js new file mode 100644 index 00000000000..d7ebdedddbb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js @@ -0,0 +1,18 @@ +//// [computedPropertyNamesContextualType2_ES5.ts] +interface I { + [s: string]: (x: any) => number; // Doesn't get hit + [s: number]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} + +//// [computedPropertyNamesContextualType2_ES5.js] +var o = { + [+"foo"]: function (y) { + return y.length; + }, + [+"bar"]: function (y) { return y.length; } +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.errors.txt new file mode 100644 index 00000000000..487fdd9a9a6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts (2 errors) ==== + interface I { + [s: string]: (x: string) => number; + } + + var o: I = { + [+"foo"](y) { return y.length; }, + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+"bar"]: y => y.length + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js new file mode 100644 index 00000000000..92a18b720fe --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesContextualType3_ES5.ts] +interface I { + [s: string]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} + +//// [computedPropertyNamesContextualType3_ES5.js] +var o = { + [+"foo"]: function (y) { + return y.length; + }, + [+"bar"]: function (y) { return y.length; } +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.errors.txt new file mode 100644 index 00000000000..76f6cfa990f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts (2 errors) ==== + interface I { + [s: string]: any; + [s: number]: any; + } + + var o: I = { + [""+"foo"]: "", + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [""+"bar"]: 0 + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js new file mode 100644 index 00000000000..8777f196d7c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType4_ES5.ts] +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType4_ES5.js] +var o = { + ["" + "foo"]: "", + ["" + "bar"]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.errors.txt new file mode 100644 index 00000000000..4510a92ddf0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts (2 errors) ==== + interface I { + [s: string]: any; + [s: number]: any; + } + + var o: I = { + [+"foo"]: "", + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+"bar"]: 0 + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js new file mode 100644 index 00000000000..e1197bddd30 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType5_ES5.ts] +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType5_ES5.js] +var o = { + [+"foo"]: "", + [+"bar"]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.errors.txt new file mode 100644 index 00000000000..a72b98c1efc --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts (6 errors) ==== + interface I { + [s: string]: T; + } + + declare function foo(obj: I): T + + foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + ~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [0 + 1]: 0, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+"hi"]: [0] + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }); \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js new file mode 100644 index 00000000000..65bc1fd667c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js @@ -0,0 +1,24 @@ +//// [computedPropertyNamesContextualType6_ES5.ts] +interface I { + [s: string]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); + +//// [computedPropertyNamesContextualType6_ES5.js] +foo({ + p: "", + 0: function () { + }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.errors.txt new file mode 100644 index 00000000000..153bfc1fbde --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts (6 errors) ==== + interface I { + [s: number]: T; + } + + declare function foo(obj: I): T + + foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + ~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [0 + 1]: 0, + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+"hi"]: [0] + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + }); \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js new file mode 100644 index 00000000000..2b87d4732ff --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js @@ -0,0 +1,24 @@ +//// [computedPropertyNamesContextualType7_ES5.ts] +interface I { + [s: number]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); + +//// [computedPropertyNamesContextualType7_ES5.js] +foo({ + p: "", + 0: function () { + }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt new file mode 100644 index 00000000000..74a235bf087 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. + Index signatures are incompatible. + Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts (3 errors) ==== + interface I { + [s: string]: boolean; + [s: number]: boolean; + } + + var o: I = { + ~ +!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: undefined; }' is not assignable to type 'I'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + [""+"foo"]: "", + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [""+"bar"]: 0 + ~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js new file mode 100644 index 00000000000..1729c08fe5b --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType8_ES5.ts] +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType8_ES5.js] +var o = { + ["" + "foo"]: "", + ["" + "bar"]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt new file mode 100644 index 00000000000..79807602de2 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts(6,5): error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. + Index signatures are incompatible. + Type 'string | number' is not assignable to type 'boolean'. + Type 'string' is not assignable to type 'boolean'. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts (3 errors) ==== + interface I { + [s: string]: boolean; + [s: number]: boolean; + } + + var o: I = { + ~ +!!! error TS2322: Type '{ [x: string]: string | number; [x: number]: string | number; }' is not assignable to type 'I'. +!!! error TS2322: Index signatures are incompatible. +!!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. +!!! error TS2322: Type 'string' is not assignable to type 'boolean'. + [+"foo"]: "", + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + [+"bar"]: 0 + ~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js new file mode 100644 index 00000000000..8f57c58804f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js @@ -0,0 +1,16 @@ +//// [computedPropertyNamesContextualType9_ES5.ts] +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} + +//// [computedPropertyNamesContextualType9_ES5.js] +var o = { + [+"foo"]: "", + [+"bar"]: 0 +}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.errors.txt new file mode 100644 index 00000000000..cc370681e4e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts(4,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts (3 errors) ==== + class C { + ["" + ""]() { } + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get ["" + ""]() { return 0; } + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set ["" + ""](x) { } + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js new file mode 100644 index 00000000000..246b22230bb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js @@ -0,0 +1,28 @@ +//// [computedPropertyNamesDeclarationEmit1_ES5.ts] +class C { + ["" + ""]() { } + get ["" + ""]() { return 0; } + set ["" + ""](x) { } +} + +//// [computedPropertyNamesDeclarationEmit1_ES5.js] +var C = (function () { + function C() { + } + C.prototype["" + ""] = function () { + }; + Object.defineProperty(C.prototype, "" + "", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, "" + "", { + set: function (x) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.errors.txt new file mode 100644 index 00000000000..01263bdd7cf --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts(2,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts(3,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts(4,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts (3 errors) ==== + class C { + static ["" + ""]() { } + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static get ["" + ""]() { return 0; } + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + static set ["" + ""](x) { } + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js new file mode 100644 index 00000000000..a3e4e6afd40 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js @@ -0,0 +1,28 @@ +//// [computedPropertyNamesDeclarationEmit2_ES5.ts] +class C { + static ["" + ""]() { } + static get ["" + ""]() { return 0; } + static set ["" + ""](x) { } +} + +//// [computedPropertyNamesDeclarationEmit2_ES5.js] +var C = (function () { + function C() { + } + C["" + ""] = function () { + }; + Object.defineProperty(C, "" + "", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C, "" + "", { + set: function (x) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt new file mode 100644 index 00000000000..48deb3be505 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts (1 errors) ==== + interface I { + ["" + ""](): void; + ~~~~~~~~~ +!!! error TS1169: Computed property names are not allowed in interfaces. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.js new file mode 100644 index 00000000000..1f339b36faf --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3_ES5.js @@ -0,0 +1,6 @@ +//// [computedPropertyNamesDeclarationEmit3_ES5.ts] +interface I { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit3_ES5.js] diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt new file mode 100644 index 00000000000..ec16af85fa7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts(2,5): error TS1170: Computed property names are not allowed in type literals. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts (1 errors) ==== + var v: { + ["" + ""](): void; + ~~~~~~~~~ +!!! error TS1170: Computed property names are not allowed in type literals. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.js new file mode 100644 index 00000000000..bca1ddbfdc7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4_ES5.js @@ -0,0 +1,7 @@ +//// [computedPropertyNamesDeclarationEmit4_ES5.ts] +var v: { + ["" + ""](): void; +} + +//// [computedPropertyNamesDeclarationEmit4_ES5.js] +var v; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.errors.txt new file mode 100644 index 00000000000..4c8a2270d28 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts(3,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts(4,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts(4,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts (6 errors) ==== + var v = { + ["" + ""]: 0, + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ["" + ""]() { }, + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + get ["" + ""]() { return 0; }, + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + set ["" + ""](x) { } + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js new file mode 100644 index 00000000000..ced7e199a4c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js @@ -0,0 +1,19 @@ +//// [computedPropertyNamesDeclarationEmit5_ES5.ts] +var v = { + ["" + ""]: 0, + ["" + ""]() { }, + get ["" + ""]() { return 0; }, + set ["" + ""](x) { } +} + +//// [computedPropertyNamesDeclarationEmit5_ES5.js] +var v = { + ["" + ""]: 0, + ["" + ""]: function () { + }, + get ["" + ""]() { + return 0; + }, + set ["" + ""](x) { + } +}; diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt new file mode 100644 index 00000000000..d02a636938c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts(4,5): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts(5,5): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts (3 errors) ==== + var methodName = "method"; + var accessorName = "accessor"; + class C { + [methodName](v: string); + ~~~~~~~~~~~~ +!!! error TS1168: Computed property names are not allowed in method overloads. + [methodName](); + ~~~~~~~~~~~~ +!!! error TS1168: Computed property names are not allowed in method overloads. + [methodName](v?: string) { } + ~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.js b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.js new file mode 100644 index 00000000000..c922b87f470 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.js @@ -0,0 +1,19 @@ +//// [computedPropertyNamesOnOverloads_ES5.ts] +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName](v: string); + [methodName](); + [methodName](v?: string) { } +} + +//// [computedPropertyNamesOnOverloads_ES5.js] +var methodName = "method"; +var accessorName = "accessor"; +var C = (function () { + function C() { + } + C.prototype[methodName] = function (v) { + }; + return C; +})(); diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.errors.txt new file mode 100644 index 00000000000..41ece97ba82 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts (1 errors) ==== + class C { + ["hello"]() { + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + debugger; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js new file mode 100644 index 00000000000..5b99f534002 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js @@ -0,0 +1,17 @@ +//// [computedPropertyNamesSourceMap1_ES5.ts] +class C { + ["hello"]() { + debugger; + } +} + +//// [computedPropertyNamesSourceMap1_ES5.js] +var C = (function () { + function C() { + } + C.prototype["hello"] = function () { + debugger; + }; + return C; +})(); +//# sourceMappingURL=computedPropertyNamesSourceMap1_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map new file mode 100644 index 00000000000..f3881a54bd5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap1_ES5.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap1_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap1_ES5.ts"],"names":["C","C.constructor","C[\"hello\"]"],"mappings":"AAAA,IAAM,CAAC;IAAPA,SAAMA,CAACA;IAIPC,CAACA;IAHGD,YAACA,OAAOA,CAACA,GAATA;QACIE,QAAQA,CAACA;IACbA,CAACA;IACLF,QAACA;AAADA,CAACA,AAJD,IAIC"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt new file mode 100644 index 00000000000..607d51ca5dc --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.sourcemap.txt @@ -0,0 +1,114 @@ +=================================================================== +JsFile: computedPropertyNamesSourceMap1_ES5.js +mapUrl: computedPropertyNamesSourceMap1_ES5.js.map +sourceRoot: +sources: computedPropertyNamesSourceMap1_ES5.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.js +sourceFile:computedPropertyNamesSourceMap1_ES5.ts +------------------------------------------------------------------- +>>>var C = (function () { +1 > +2 >^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^-> +1 > +2 >class +3 > C +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 7) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 8) + SourceIndex(0) +--- +>>> function C() { +1->^^^^ +2 > ^^^^^^^^^ +3 > ^ +1-> +2 > class +3 > C +1->Emitted(2, 5) Source(1, 1) + SourceIndex(0) name (C) +2 >Emitted(2, 14) Source(1, 7) + SourceIndex(0) name (C) +3 >Emitted(2, 15) Source(1, 8) + SourceIndex(0) name (C) +--- +>>> } +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > { + > ["hello"]() { + > debugger; + > } + > +2 > } +1 >Emitted(3, 5) Source(5, 1) + SourceIndex(0) name (C.constructor) +2 >Emitted(3, 6) Source(5, 2) + SourceIndex(0) name (C.constructor) +--- +>>> C.prototype["hello"] = function () { +1->^^^^ +2 > ^^^^^^^^^^^^ +3 > ^^^^^^^ +4 > ^ +5 > ^^^ +1-> +2 > [ +3 > "hello" +4 > ] +5 > +1->Emitted(4, 5) Source(2, 5) + SourceIndex(0) name (C) +2 >Emitted(4, 17) Source(2, 6) + SourceIndex(0) name (C) +3 >Emitted(4, 24) Source(2, 13) + SourceIndex(0) name (C) +4 >Emitted(4, 25) Source(2, 14) + SourceIndex(0) name (C) +5 >Emitted(4, 28) Source(2, 5) + SourceIndex(0) name (C) +--- +>>> debugger; +1 >^^^^^^^^ +2 > ^^^^^^^^ +3 > ^ +1 >["hello"]() { + > +2 > debugger +3 > ; +1 >Emitted(5, 9) Source(3, 9) + SourceIndex(0) name (C["hello"]) +2 >Emitted(5, 17) Source(3, 17) + SourceIndex(0) name (C["hello"]) +3 >Emitted(5, 18) Source(3, 18) + SourceIndex(0) name (C["hello"]) +--- +>>> }; +1 >^^^^ +2 > ^ +3 > ^^^^^^^^^-> +1 > + > +2 > } +1 >Emitted(6, 5) Source(4, 5) + SourceIndex(0) name (C["hello"]) +2 >Emitted(6, 6) Source(4, 6) + SourceIndex(0) name (C["hello"]) +--- +>>> return C; +1->^^^^ +2 > ^^^^^^^^ +1-> + > +2 > } +1->Emitted(7, 5) Source(5, 1) + SourceIndex(0) name (C) +2 >Emitted(7, 13) Source(5, 2) + SourceIndex(0) name (C) +--- +>>>})(); +1 > +2 >^ +3 > +4 > ^^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >} +3 > +4 > class C { + > ["hello"]() { + > debugger; + > } + > } +1 >Emitted(8, 1) Source(5, 1) + SourceIndex(0) name (C) +2 >Emitted(8, 2) Source(5, 2) + SourceIndex(0) name (C) +3 >Emitted(8, 2) Source(1, 1) + SourceIndex(0) +4 >Emitted(8, 6) Source(5, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=computedPropertyNamesSourceMap1_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.errors.txt new file mode 100644 index 00000000000..d95aa2a1adb --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts (1 errors) ==== + var v = { + ["hello"]() { + ~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + debugger; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js new file mode 100644 index 00000000000..6d11c62050c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js @@ -0,0 +1,14 @@ +//// [computedPropertyNamesSourceMap2_ES5.ts] +var v = { + ["hello"]() { + debugger; + } +} + +//// [computedPropertyNamesSourceMap2_ES5.js] +var v = { + ["hello"]: function () { + debugger; + } +}; +//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map new file mode 100644 index 00000000000..9f985290f09 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map @@ -0,0 +1,2 @@ +//// [computedPropertyNamesSourceMap2_ES5.js.map] +{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;CACJ,CAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt new file mode 100644 index 00000000000..ff49e979ae3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt @@ -0,0 +1,73 @@ +=================================================================== +JsFile: computedPropertyNamesSourceMap2_ES5.js +mapUrl: computedPropertyNamesSourceMap2_ES5.js.map +sourceRoot: +sources: computedPropertyNamesSourceMap2_ES5.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.js +sourceFile:computedPropertyNamesSourceMap2_ES5.ts +------------------------------------------------------------------- +>>>var v = { +1 > +2 >^^^^ +3 > ^ +4 > ^^^ +5 > ^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >var +3 > v +4 > = +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) +3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) +4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) +--- +>>> ["hello"]: function () { +1->^^^^ +2 > ^ +3 > ^^^^^^^ +4 > ^ +5 > ^^^^^-> +1->{ + > +2 > [ +3 > "hello" +4 > ] +1->Emitted(2, 5) Source(2, 5) + SourceIndex(0) +2 >Emitted(2, 6) Source(2, 6) + SourceIndex(0) +3 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) +4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) +--- +>>> debugger; +1->^^^^^^^^ +2 > ^^^^^^^^ +3 > ^ +1->() { + > +2 > debugger +3 > ; +1->Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (["hello"]) +2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0) name (["hello"]) +3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0) name (["hello"]) +--- +>>> } +1 >^^^^ +2 > ^ +1 > + > +2 > } +1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0) name (["hello"]) +2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0) name (["hello"]) +--- +>>>}; +1 >^ +2 > ^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > + >} +2 > +1 >Emitted(5, 2) Source(5, 2) + SourceIndex(0) +2 >Emitted(5, 3) Source(5, 2) + SourceIndex(0) +--- +>>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts new file mode 100644 index 00000000000..59a8e9d3420 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +var v = { + [s]() { }, + [n]() { }, + [s + s]() { }, + [s + n]() { }, + [+s]() { }, + [""]() { }, + [0]() { }, + [a]() { }, + [true]() { }, + [`hello bye`]() { }, + [`hello ${a} bye`]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts new file mode 100644 index 00000000000..33288184b16 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +var v = { + get [s]() { return 0; }, + set [n](v) { }, + get [s + s]() { return 0; }, + set [s + n](v) { }, + get [+s]() { return 0; }, + set [""](v) { }, + get [0]() { return 0; }, + set [a](v) { }, + get [true]() { return 0; }, + set [`hello bye`](v) { }, + get [`hello ${a} bye`]() { return 0; } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts new file mode 100644 index 00000000000..365ca67c1a3 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames12_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +class C { + [s]: number; + [n] = n; + static [s + s]: string; + [s + n] = 2; + [+s]: typeof s; + static [""]: number; + [0]: number; + [a]: number; + static [true]: number; + [`hello bye`] = 0; + static [`hello ${a} bye`] = 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts new file mode 100644 index 00000000000..fb44bfb4145 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +class C { + [s]() {} + [n]() { } + static [s + s]() { } + [s + n]() { } + [+s]() { } + static [""]() { } + [0]() { } + [a]() { } + static [true]() { } + [`hello bye`]() { } + static [`hello ${a} bye`]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts new file mode 100644 index 00000000000..8f78f279eba --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var b: boolean; +class C { + [b]() {} + static [true]() { } + [[]]() { } + static [{}]() { } + [undefined]() { } + static [null]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts new file mode 100644 index 00000000000..2baa39cf61a --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +class C { + [p1]() { } + [p2]() { } + [p3]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts new file mode 100644 index 00000000000..01204a1e619 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +class C { + get [s]() { return 0;} + set [n](v) { } + static get [s + s]() { return 0; } + set [s + n](v) { } + get [+s]() { return 0; } + static set [""](v) { } + get [0]() { return 0; } + set [a](v) { } + static get [true]() { return 0; } + set [`hello bye`](v) { } + get [`hello ${a} bye`]() { return 0; } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts new file mode 100644 index 00000000000..e52067cc7f4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var b: boolean; +class C { + get [b]() { return 0;} + static set [true](v) { } + get [[]]() { return 0; } + set [{}](v) { } + static get [undefined]() { return 0; } + set [null](v) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts new file mode 100644 index 00000000000..3c929b20ddf --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +function foo() { + var obj = { + [this.bar]: 0 + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts new file mode 100644 index 00000000000..87a1bf81178 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +module M { + var obj = { + [this.bar]: 0 + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts new file mode 100644 index 00000000000..70ba98a818c --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts @@ -0,0 +1,5 @@ +// @target: es5 +var v = { + get [0 + 1]() { return 0 }, + set [0 + 1](v: string) { } //No error +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts new file mode 100644 index 00000000000..6cff3715d83 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts @@ -0,0 +1,4 @@ +// @target: es5 +var obj = { + [this.bar]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts new file mode 100644 index 00000000000..caee82c8ea3 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +class C { + bar() { + return 0; + } + [this.bar()]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts new file mode 100644 index 00000000000..41142951421 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +class C { + bar() { + var obj = { + [this.bar()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts new file mode 100644 index 00000000000..e0a86c21842 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +class C { + bar() { + return 0; + } + [ + { [this.bar()]: 1 }[0] + ]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts new file mode 100644 index 00000000000..ff94b6c9617 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [super.bar()]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts new file mode 100644 index 00000000000..d791b8b9178 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts @@ -0,0 +1,14 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + var obj = { + [super.bar()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts new file mode 100644 index 00000000000..4b0d794b1a7 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts @@ -0,0 +1,13 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + // Gets emitted as super, not _super, which is consistent with + // use of super in static properties initializers. + [ + { [super.bar()]: 1 }[0] + ]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts new file mode 100644 index 00000000000..1cae37aa093 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +class Base { +} +class C extends Base { + [(super(), "prop")]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts new file mode 100644 index 00000000000..c82d7b000e2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Base { +} +class C extends Base { + constructor() { + super(); + var obj = { + [(super(), "prop")]() { } + }; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts new file mode 100644 index 00000000000..c650c6e6c3f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class C { + bar() { + () => { + var obj = { + [this.bar()]() { } // needs capture + }; + } + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts new file mode 100644 index 00000000000..7c2517cd514 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName]() { } + static [methodName]() { } + get [accessorName]() { } + set [accessorName](v) { } + static get [accessorName]() { } + static set [accessorName](v) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts new file mode 100644 index 00000000000..528e9b7c583 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts @@ -0,0 +1,16 @@ +// @target: es5 +class Base { +} +class C extends Base { + constructor() { + super(); + () => { + var obj = { + // Ideally, we would capture this. But the reference is + // illegal, and not capturing this is consistent with + //treatment of other similar violations. + [(super(), "prop")]() { } + }; + } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts new file mode 100644 index 00000000000..39c5ca2b747 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts @@ -0,0 +1,16 @@ +// @target: es5 +class Base { + bar() { + return 0; + } +} +class C extends Base { + foo() { + () => { + var obj = { + [super.bar()]() { } // needs capture + }; + } + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts new file mode 100644 index 00000000000..f9c17c632ae --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 +function foo() { return '' } +class C { + bar() { + return 0; + } + [foo()]() { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts new file mode 100644 index 00000000000..0dcbabf4063 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +function foo() { return '' } +class C { + bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts new file mode 100644 index 00000000000..b6892f1bd80 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +function foo() { return '' } +class C { + static bar() { + var obj = { + [foo()]() { } + }; + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts new file mode 100644 index 00000000000..7d3df135b10 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames35_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +function foo() { return '' } +interface I { + bar(): string; + [foo()](): void; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts new file mode 100644 index 00000000000..95099715ad8 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts new file mode 100644 index 00000000000..cb931fc31d6 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts new file mode 100644 index 00000000000..5ea07aa1605 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts new file mode 100644 index 00000000000..929332c5d32 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: number]: Foo2; + + // Computed properties + get [1 << 6]() { return new Foo } + set [1 << 6](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts new file mode 100644 index 00000000000..1f34f9ad287 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var id; +class C { + [0 + 1]() { } + static [() => { }]() { } + get [delete id]() { } + set [[0, 1]](v) { } + static get [""]() { } + static set [id.toString()](v) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts new file mode 100644 index 00000000000..bba1068fef3 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + [""]() { return new Foo } + [""]() { return new Foo2 } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts new file mode 100644 index 00000000000..1e8ed7d6cd1 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: () => Foo2; + + // Computed properties + static [""]() { return new Foo } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts new file mode 100644 index 00000000000..fc181d5a548 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames42_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + + // Computed properties + [""]: Foo; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts new file mode 100644 index 00000000000..c130692c118 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts @@ -0,0 +1,13 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; +} + +class D extends C { + // Computed properties + get ["get1"]() { return new Foo } + set ["set1"](p: Foo2) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts new file mode 100644 index 00000000000..4c9422ed44e --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts @@ -0,0 +1,12 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + [s: string]: Foo2; + get ["get1"]() { return new Foo } +} + +class D extends C { + set ["set1"](p: Foo) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts new file mode 100644 index 00000000000..c1eb09275c5 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts @@ -0,0 +1,13 @@ +// @target: es5 +class Foo { x } +class Foo2 { x; y } + +class C { + get ["get1"]() { return new Foo } +} + +class D extends C { + // No error when the indexer is in a class more derived than the computed property + [s: string]: Foo2; + set ["set1"](p: Foo) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts new file mode 100644 index 00000000000..d009c960d6b --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts @@ -0,0 +1,4 @@ +// @target: es5 +var o = { + ["" || 0]: 0 +}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts new file mode 100644 index 00000000000..b158ef76447 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts @@ -0,0 +1,6 @@ +// @target: es5 +enum E1 { x } +enum E2 { x } +var o = { + [E1.x || E2.x]: 0 +}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts new file mode 100644 index 00000000000..1c854603b09 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts @@ -0,0 +1,18 @@ +// @target: es5 +declare function extractIndexer(p: { [n: number]: T }): T; + +enum E { x } + +var a: any; + +extractIndexer({ + [a]: "" +}); // Should return string + +extractIndexer({ + [E.x]: "" +}); // Should return string + +extractIndexer({ + ["" || 0]: "" +}); // Should return any (widened form of undefined) \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts new file mode 100644 index 00000000000..17089b7244f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts @@ -0,0 +1,17 @@ +// @target: es5 +var s: string; +var n: number; +var a: any; +var v = { + [s]: 0, + [n]: n, + [s + s]: 1, + [s + n]: 2, + [+s]: s, + [""]: 0, + [0]: 0, + [a]: 1, + [true]: 0, + [`hello bye`]: 0, + [`hello ${a} bye`]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts new file mode 100644 index 00000000000..e9d7d6ffab4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +var b: boolean; +var v = { + [b]: 0, + [true]: 1, + [[]]: 0, + [{}]: 0, + [undefined]: undefined, + [null]: null +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts new file mode 100644 index 00000000000..0521873d70c --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +var p1: number | string; +var p2: number | number[]; +var p3: string | boolean; +var v = { + [p1]: 0, + [p2]: 1, + [p3]: 2 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts new file mode 100644 index 00000000000..e3b379602b9 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +enum E { + member +} +var v = { + [E.member]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts new file mode 100644 index 00000000000..0723552edc2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +function f() { + var t: T; + var u: U; + var v = { + [t]: 0, + [u]: 1 + }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts new file mode 100644 index 00000000000..e1c675d95e4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts @@ -0,0 +1,11 @@ +// @target: es5 +function f(s: string): string; +function f(n: number): number; +function f(x: T): T; +function f(x): any { } + +var v = { + [f("")]: 0, + [f(0)]: 0, + [f(true)]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts new file mode 100644 index 00000000000..dd208340520 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +interface I { + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts new file mode 100644 index 00000000000..d8aad5bf468 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: (x: string) => number; + [s: number]: (x: any) => number; // Doesn't get hit +} + +var o: I = { + ["" + 0](y) { return y.length; }, + ["" + 1]: y => y.length +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts new file mode 100644 index 00000000000..c9a425b5a99 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: (x: any) => number; // Doesn't get hit + [s: number]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts new file mode 100644 index 00000000000..3f5a6f7f91f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts @@ -0,0 +1,9 @@ +// @target: es5 +interface I { + [s: string]: (x: string) => number; +} + +var o: I = { + [+"foo"](y) { return y.length; }, + [+"bar"]: y => y.length +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts new file mode 100644 index 00000000000..8ce0503c449 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts new file mode 100644 index 00000000000..42acf42ee2a --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: any; + [s: number]: any; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts new file mode 100644 index 00000000000..9e6248878b9 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts @@ -0,0 +1,14 @@ +// @target: es5 +interface I { + [s: string]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts new file mode 100644 index 00000000000..722891c2f6a --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts @@ -0,0 +1,14 @@ +// @target: es5 +interface I { + [s: number]: T; +} + +declare function foo(obj: I): T + +foo({ + p: "", + 0: () => { }, + ["hi" + "bye"]: true, + [0 + 1]: 0, + [+"hi"]: [0] +}); \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts new file mode 100644 index 00000000000..5e6835b5948 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [""+"foo"]: "", + [""+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts new file mode 100644 index 00000000000..aa30d333d11 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts @@ -0,0 +1,10 @@ +// @target: es5 +interface I { + [s: string]: boolean; + [s: number]: boolean; +} + +var o: I = { + [+"foo"]: "", + [+"bar"]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts new file mode 100644 index 00000000000..1091304b6b2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @declaration: true +class C { + ["" + ""]() { } + get ["" + ""]() { return 0; } + set ["" + ""](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts new file mode 100644 index 00000000000..b30b8e13062 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @declaration: true +class C { + static ["" + ""]() { } + static get ["" + ""]() { return 0; } + static set ["" + ""](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts new file mode 100644 index 00000000000..aa4e3b2cf2f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3_ES5.ts @@ -0,0 +1,5 @@ +// @target: es5 +// @declaration: true +interface I { + ["" + ""](): void; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts new file mode 100644 index 00000000000..9a6e17f4c93 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4_ES5.ts @@ -0,0 +1,5 @@ +// @target: es5 +// @declaration: true +var v: { + ["" + ""](): void; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts new file mode 100644 index 00000000000..eb12ea9b471 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 +// @declaration: true +var v = { + ["" + ""]: 0, + ["" + ""]() { }, + get ["" + ""]() { return 0; }, + set ["" + ""](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts new file mode 100644 index 00000000000..a025a074e31 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts @@ -0,0 +1,8 @@ +// @target: es5 +var methodName = "method"; +var accessorName = "accessor"; +class C { + [methodName](v: string); + [methodName](); + [methodName](v?: string) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts new file mode 100644 index 00000000000..9454483cdb4 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @sourceMap: true +class C { + ["hello"]() { + debugger; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts new file mode 100644 index 00000000000..3d35cd12430 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts @@ -0,0 +1,7 @@ +// @target: es5 +// @sourceMap: true +var v = { + ["hello"]() { + debugger; + } +} \ No newline at end of file From d6b2c6d0bb6668785ab9c691a8cf531ecf50a14a Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 4 Feb 2015 15:33:53 -0800 Subject: [PATCH 004/162] Stop erroring on computed properties for ES3/ES5 emit. --- src/compiler/checker.ts | 5 +- .../FunctionDeclaration8_es6.errors.txt | 5 +- .../FunctionDeclaration9_es6.errors.txt | 5 +- ...unctionPropertyAssignments5_es6.errors.txt | 5 +- .../computedPropertyNames10_ES5.errors.txt | 52 ------------ .../computedPropertyNames10_ES5.types | 46 ++++++++++ .../computedPropertyNames11_ES5.errors.txt | 85 ------------------- .../computedPropertyNames11_ES5.types | 53 ++++++++++++ .../computedPropertyNames13_ES5.errors.txt | 52 ------------ .../computedPropertyNames13_ES5.types | 45 ++++++++++ .../computedPropertyNames14_ES5.errors.txt | 20 +---- .../computedPropertyNames15_ES5.errors.txt | 11 +-- .../computedPropertyNames16_ES5.errors.txt | 52 ------------ .../computedPropertyNames16_ES5.types | 52 ++++++++++++ .../computedPropertyNames17_ES5.errors.txt | 20 +---- .../computedPropertyNames18_ES5.errors.txt | 11 --- .../computedPropertyNames18_ES5.types | 14 +++ .../computedPropertyNames19_ES5.errors.txt | 5 +- .../computedPropertyNames1_ES5.errors.txt | 19 ----- .../computedPropertyNames1_ES5.types | 12 +++ .../computedPropertyNames20_ES5.errors.txt | 9 -- .../computedPropertyNames20_ES5.types | 10 +++ .../computedPropertyNames21_ES5.errors.txt | 5 +- .../computedPropertyNames22_ES5.errors.txt | 14 --- .../computedPropertyNames22_ES5.types | 21 +++++ .../computedPropertyNames23_ES5.errors.txt | 10 +-- .../computedPropertyNames24_ES5.errors.txt | 5 +- .../computedPropertyNames25_ES5.errors.txt | 19 ----- .../computedPropertyNames25_ES5.types | 31 +++++++ .../computedPropertyNames26_ES5.errors.txt | 10 +-- .../computedPropertyNames27_ES5.errors.txt | 5 +- .../computedPropertyNames28_ES5.errors.txt | 16 ---- .../computedPropertyNames28_ES5.types | 26 ++++++ .../computedPropertyNames29_ES5.errors.txt | 16 ---- .../computedPropertyNames29_ES5.types | 25 ++++++ .../computedPropertyNames2_ES5.errors.txt | 20 +---- .../computedPropertyNames30_ES5.errors.txt | 5 +- .../computedPropertyNames31_ES5.errors.txt | 21 ----- .../computedPropertyNames31_ES5.types | 35 ++++++++ .../computedPropertyNames32_ES5.errors.txt | 5 +- .../computedPropertyNames33_ES5.errors.txt | 15 ---- .../computedPropertyNames33_ES5.types | 25 ++++++ .../computedPropertyNames34_ES5.errors.txt | 5 +- .../computedPropertyNames36_ES5.errors.txt | 8 +- .../computedPropertyNames37_ES5.errors.txt | 19 ----- .../computedPropertyNames37_ES5.types | 26 ++++++ .../computedPropertyNames38_ES5.errors.txt | 8 +- .../computedPropertyNames39_ES5.errors.txt | 8 +- .../computedPropertyNames3_ES5.errors.txt | 20 +---- .../computedPropertyNames40_ES5.errors.txt | 8 +- .../computedPropertyNames41_ES5.errors.txt | 15 ---- .../computedPropertyNames41_ES5.types | 22 +++++ .../computedPropertyNames43_ES5.errors.txt | 8 +- .../computedPropertyNames44_ES5.errors.txt | 8 +- .../computedPropertyNames45_ES5.errors.txt | 8 +- .../computedPropertyNames46_ES5.errors.txt | 9 -- .../computedPropertyNames46_ES5.types | 9 ++ .../computedPropertyNames47_ES5.errors.txt | 11 --- .../computedPropertyNames47_ES5.types | 23 +++++ .../computedPropertyNames48_ES5.errors.txt | 38 --------- .../computedPropertyNames48_ES5.types | 47 ++++++++++ .../computedPropertyNames4_ES5.errors.txt | 52 ------------ .../computedPropertyNames4_ES5.types | 48 +++++++++++ .../computedPropertyNames5_ES5.errors.txt | 20 +---- .../computedPropertyNames6_ES5.errors.txt | 11 +-- .../computedPropertyNames7_ES5.errors.txt | 12 --- .../computedPropertyNames7_ES5.types | 16 ++++ .../computedPropertyNames8_ES5.errors.txt | 8 +- .../computedPropertyNames9_ES5.errors.txt | 11 +-- ...opertyNamesContextualType10_ES5.errors.txt | 8 +- ...ropertyNamesContextualType1_ES5.errors.txt | 18 ---- ...utedPropertyNamesContextualType1_ES5.types | 33 +++++++ ...ropertyNamesContextualType2_ES5.errors.txt | 18 ---- ...utedPropertyNamesContextualType2_ES5.types | 33 +++++++ ...ropertyNamesContextualType3_ES5.errors.txt | 17 ---- ...utedPropertyNamesContextualType3_ES5.types | 29 +++++++ ...ropertyNamesContextualType4_ES5.errors.txt | 18 ---- ...utedPropertyNamesContextualType4_ES5.types | 22 +++++ ...ropertyNamesContextualType5_ES5.errors.txt | 18 ---- ...utedPropertyNamesContextualType5_ES5.types | 22 +++++ ...ropertyNamesContextualType6_ES5.errors.txt | 34 -------- ...utedPropertyNamesContextualType6_ES5.types | 40 +++++++++ ...ropertyNamesContextualType7_ES5.errors.txt | 34 -------- ...utedPropertyNamesContextualType7_ES5.types | 40 +++++++++ ...ropertyNamesContextualType8_ES5.errors.txt | 8 +- ...ropertyNamesContextualType9_ES5.errors.txt | 8 +- ...opertyNamesDeclarationEmit1_ES5.errors.txt | 17 ---- ...mputedPropertyNamesDeclarationEmit1_ES5.js | 5 ++ ...tedPropertyNamesDeclarationEmit1_ES5.types | 14 +++ ...opertyNamesDeclarationEmit2_ES5.errors.txt | 17 ---- ...mputedPropertyNamesDeclarationEmit2_ES5.js | 5 ++ ...tedPropertyNamesDeclarationEmit2_ES5.types | 14 +++ ...opertyNamesDeclarationEmit5_ES5.errors.txt | 27 ------ ...mputedPropertyNamesDeclarationEmit5_ES5.js | 4 + ...tedPropertyNamesDeclarationEmit5_ES5.types | 18 ++++ ...tedPropertyNamesOnOverloads_ES5.errors.txt | 5 +- ...utedPropertyNamesSourceMap1_ES5.errors.txt | 11 --- .../computedPropertyNamesSourceMap1_ES5.types | 8 ++ ...utedPropertyNamesSourceMap2_ES5.errors.txt | 11 --- .../computedPropertyNamesSourceMap2_ES5.types | 9 ++ .../parserES5ComputedPropertyName2.errors.txt | 5 +- .../parserES5ComputedPropertyName3.errors.txt | 5 +- .../parserES5ComputedPropertyName4.errors.txt | 5 +- 103 files changed, 918 insertions(+), 1057 deletions(-) delete mode 100644 tests/baselines/reference/computedPropertyNames10_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames10_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames11_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames11_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames13_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames13_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames16_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames16_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames18_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames18_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames1_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames1_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames20_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames20_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames22_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames22_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames25_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames25_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames28_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames28_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames29_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames29_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames31_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames31_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames33_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames33_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames37_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames37_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames41_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames41_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames46_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames46_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames47_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames47_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames48_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames48_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames4_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames4_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNames7_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames7_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNamesContextualType1_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType1_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNamesContextualType2_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType2_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNamesContextualType3_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType3_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNamesContextualType4_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType4_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNamesContextualType5_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType5_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNamesContextualType6_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNamesContextualType7_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.types delete mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index f44c9b118f8..91a1926573a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10626,10 +10626,7 @@ module ts { } var computedPropertyName = node; - if (languageVersion < ScriptTarget.ES6) { - return grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); - } - else if (computedPropertyName.expression.kind === SyntaxKind.BinaryExpression && (computedPropertyName.expression).operator === SyntaxKind.CommaToken) { + if (computedPropertyName.expression.kind === SyntaxKind.BinaryExpression && (computedPropertyName.expression).operator === SyntaxKind.CommaToken) { return grammarErrorOnNode(computedPropertyName.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt index 2c8d034649e..c35015af7cf 100644 --- a/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration8_es6.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,12): error TS2304: Cannot find name 'yield'. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts(1,20): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (3 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration8_es6.ts (2 errors) ==== var v = { [yield]: foo } - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~ !!! error TS2304: Cannot find name 'yield'. ~~~ diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt index ef744681fa1..152b1ffc7cc 100644 --- a/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt +++ b/tests/baselines/reference/FunctionDeclaration9_es6.errors.txt @@ -1,15 +1,12 @@ tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(1,10): error TS9001: Generators are not currently supported. -tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts(2,14): error TS9000: 'yield' expressions are not currently supported. -==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (3 errors) ==== +==== tests/cases/conformance/es6/functionDeclarations/FunctionDeclaration9_es6.ts (2 errors) ==== function * foo() { ~ !!! error TS9001: Generators are not currently supported. var v = { [yield]: foo } - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~ !!! error TS9000: 'yield' expressions are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt index c8c356a57ad..596764e58ea 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.errors.txt @@ -1,13 +1,10 @@ tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,11): error TS9001: Generators are not currently supported. -tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts(1,13): error TS2304: Cannot find name 'foo'. -==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (3 errors) ==== +==== tests/cases/conformance/es6/functionPropertyAssignments/FunctionPropertyAssignments5_es6.ts (2 errors) ==== var v = { *[foo()]() { } } ~ !!! error TS9001: Generators are not currently supported. - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~ !!! error TS2304: Cannot find name 'foo'. \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames10_ES5.errors.txt deleted file mode 100644 index 30a5f07c271..00000000000 --- a/tests/baselines/reference/computedPropertyNames10_ES5.errors.txt +++ /dev/null @@ -1,52 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(13,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(14,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts(15,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts (11 errors) ==== - var s: string; - var n: number; - var a: any; - var v = { - [s]() { }, - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [n]() { }, - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [s + s]() { }, - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [s + n]() { }, - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [+s]() { }, - ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [""]() { }, - ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [0]() { }, - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [a]() { }, - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [true]() { }, - ~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [`hello bye`]() { }, - ~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [`hello ${a} bye`]() { } - ~~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.types b/tests/baselines/reference/computedPropertyNames10_ES5.types new file mode 100644 index 00000000000..cb49d5c3384 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames10_ES5.types @@ -0,0 +1,46 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames10_ES5.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +var v = { +>v : {} +>{ [s]() { }, [n]() { }, [s + s]() { }, [s + n]() { }, [+s]() { }, [""]() { }, [0]() { }, [a]() { }, [true]() { }, [`hello bye`]() { }, [`hello ${a} bye`]() { }} : {} + + [s]() { }, +>s : string + + [n]() { }, +>n : number + + [s + s]() { }, +>s + s : string +>s : string +>s : string + + [s + n]() { }, +>s + n : string +>s : string +>n : number + + [+s]() { }, +>+s : number +>s : string + + [""]() { }, + [0]() { }, + [a]() { }, +>a : any + + [true]() { }, +>true : any + + [`hello bye`]() { }, + [`hello ${a} bye`]() { } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames11_ES5.errors.txt deleted file mode 100644 index 21f8c8ef0eb..00000000000 --- a/tests/baselines/reference/computedPropertyNames11_ES5.errors.txt +++ /dev/null @@ -1,85 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(7,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(7,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(10,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(10,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(12,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(12,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(13,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(13,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(14,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(14,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(15,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts(15,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts (22 errors) ==== - var s: string; - var n: number; - var a: any; - var v = { - get [s]() { return 0; }, - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - set [n](v) { }, - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - get [s + s]() { return 0; }, - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - set [s + n](v) { }, - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - get [+s]() { return 0; }, - ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - set [""](v) { }, - ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - get [0]() { return 0; }, - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - set [a](v) { }, - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - get [true]() { return 0; }, - ~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - set [`hello bye`](v) { }, - ~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - get [`hello ${a} bye`]() { return 0; } - ~~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.types b/tests/baselines/reference/computedPropertyNames11_ES5.types new file mode 100644 index 00000000000..ed3c51302b7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames11_ES5.types @@ -0,0 +1,53 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames11_ES5.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +var v = { +>v : {} +>{ get [s]() { return 0; }, set [n](v) { }, get [s + s]() { return 0; }, set [s + n](v) { }, get [+s]() { return 0; }, set [""](v) { }, get [0]() { return 0; }, set [a](v) { }, get [true]() { return 0; }, set [`hello bye`](v) { }, get [`hello ${a} bye`]() { return 0; }} : {} + + get [s]() { return 0; }, +>s : string + + set [n](v) { }, +>n : number +>v : any + + get [s + s]() { return 0; }, +>s + s : string +>s : string +>s : string + + set [s + n](v) { }, +>s + n : string +>s : string +>n : number +>v : any + + get [+s]() { return 0; }, +>+s : number +>s : string + + set [""](v) { }, +>v : any + + get [0]() { return 0; }, + set [a](v) { }, +>a : any +>v : any + + get [true]() { return 0; }, +>true : any + + set [`hello bye`](v) { }, +>v : any + + get [`hello ${a} bye`]() { return 0; } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames13_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames13_ES5.errors.txt deleted file mode 100644 index 15d43c41c91..00000000000 --- a/tests/baselines/reference/computedPropertyNames13_ES5.errors.txt +++ /dev/null @@ -1,52 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(7,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(10,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(13,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(14,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts(15,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts (11 errors) ==== - var s: string; - var n: number; - var a: any; - class C { - [s]() {} - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [n]() { } - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - static [s + s]() { } - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [s + n]() { } - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [+s]() { } - ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - static [""]() { } - ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [0]() { } - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [a]() { } - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - static [true]() { } - ~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [`hello bye`]() { } - ~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - static [`hello ${a} bye`]() { } - ~~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames13_ES5.types b/tests/baselines/reference/computedPropertyNames13_ES5.types new file mode 100644 index 00000000000..ff98a3189a7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames13_ES5.types @@ -0,0 +1,45 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames13_ES5.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +class C { +>C : C + + [s]() {} +>s : string + + [n]() { } +>n : number + + static [s + s]() { } +>s + s : string +>s : string +>s : string + + [s + n]() { } +>s + n : string +>s : string +>n : number + + [+s]() { } +>+s : number +>s : string + + static [""]() { } + [0]() { } + [a]() { } +>a : any + + static [true]() { } +>true : any + + [`hello bye`]() { } + static [`hello ${a} bye`]() { } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames14_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames14_ES5.errors.txt index b1a59252b61..acb73015c72 100644 --- a/tests/baselines/reference/computedPropertyNames14_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames14_ES5.errors.txt @@ -1,48 +1,30 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(3,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(4,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(6,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(8,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts (12 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14_ES5.ts (6 errors) ==== var b: boolean; class C { [b]() {} ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. static [true]() { } ~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. [[]]() { } ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. static [{}]() { } ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. [undefined]() { } ~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. static [null]() { } ~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames15_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames15_ES5.errors.txt index 8d450c673cd..2a9a95210fd 100644 --- a/tests/baselines/reference/computedPropertyNames15_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames15_ES5.errors.txt @@ -1,26 +1,17 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts (5 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15_ES5.ts (2 errors) ==== var p1: number | string; var p2: number | number[]; var p3: string | boolean; class C { [p1]() { } - ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. [p2]() { } ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. [p3]() { } ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames16_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames16_ES5.errors.txt deleted file mode 100644 index bb98073f363..00000000000 --- a/tests/baselines/reference/computedPropertyNames16_ES5.errors.txt +++ /dev/null @@ -1,52 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(7,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(10,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(12,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(13,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(14,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts(15,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts (11 errors) ==== - var s: string; - var n: number; - var a: any; - class C { - get [s]() { return 0;} - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - set [n](v) { } - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - static get [s + s]() { return 0; } - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - set [s + n](v) { } - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - get [+s]() { return 0; } - ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - static set [""](v) { } - ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - get [0]() { return 0; } - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - set [a](v) { } - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - static get [true]() { return 0; } - ~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - set [`hello bye`](v) { } - ~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - get [`hello ${a} bye`]() { return 0; } - ~~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames16_ES5.types b/tests/baselines/reference/computedPropertyNames16_ES5.types new file mode 100644 index 00000000000..3914093c766 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames16_ES5.types @@ -0,0 +1,52 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames16_ES5.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +class C { +>C : C + + get [s]() { return 0;} +>s : string + + set [n](v) { } +>n : number +>v : any + + static get [s + s]() { return 0; } +>s + s : string +>s : string +>s : string + + set [s + n](v) { } +>s + n : string +>s : string +>n : number +>v : any + + get [+s]() { return 0; } +>+s : number +>s : string + + static set [""](v) { } +>v : any + + get [0]() { return 0; } + set [a](v) { } +>a : any +>v : any + + static get [true]() { return 0; } +>true : any + + set [`hello bye`](v) { } +>v : any + + get [`hello ${a} bye`]() { return 0; } +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames17_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames17_ES5.errors.txt index 3b6da1d1e08..57e9944a435 100644 --- a/tests/baselines/reference/computedPropertyNames17_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames17_ES5.errors.txt @@ -1,48 +1,30 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(4,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(7,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts (12 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17_ES5.ts (6 errors) ==== var b: boolean; class C { get [b]() { return 0;} ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. static set [true](v) { } ~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. get [[]]() { return 0; } ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. set [{}](v) { } ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. static get [undefined]() { return 0; } ~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. set [null](v) { } ~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames18_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames18_ES5.errors.txt deleted file mode 100644 index 69b787530cd..00000000000 --- a/tests/baselines/reference/computedPropertyNames18_ES5.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts (1 errors) ==== - function foo() { - var obj = { - [this.bar]: 0 - ~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames18_ES5.types b/tests/baselines/reference/computedPropertyNames18_ES5.types new file mode 100644 index 00000000000..732de08e2d6 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames18_ES5.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames18_ES5.ts === +function foo() { +>foo : () => void + + var obj = { +>obj : {} +>{ [this.bar]: 0 } : {} + + [this.bar]: 0 +>this.bar : any +>this : any +>bar : any + } +} diff --git a/tests/baselines/reference/computedPropertyNames19_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames19_ES5.errors.txt index 9fbad563f8a..49a1f008a05 100644 --- a/tests/baselines/reference/computedPropertyNames19_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames19_ES5.errors.txt @@ -1,13 +1,10 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts(3,10): error TS2331: 'this' cannot be referenced in a module body. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts (1 errors) ==== module M { var obj = { [this.bar]: 0 - ~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~ !!! error TS2331: 'this' cannot be referenced in a module body. } diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames1_ES5.errors.txt deleted file mode 100644 index f5c28a0cab8..00000000000 --- a/tests/baselines/reference/computedPropertyNames1_ES5.errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts(2,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts(2,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts (4 errors) ==== - var v = { - get [0 + 1]() { return 0 }, - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - set [0 + 1](v: string) { } //No error - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.types b/tests/baselines/reference/computedPropertyNames1_ES5.types new file mode 100644 index 00000000000..6627d53d1da --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames1_ES5.types @@ -0,0 +1,12 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames1_ES5.ts === +var v = { +>v : {} +>{ get [0 + 1]() { return 0 }, set [0 + 1](v: string) { } //No error} : {} + + get [0 + 1]() { return 0 }, +>0 + 1 : number + + set [0 + 1](v: string) { } //No error +>0 + 1 : number +>v : string +} diff --git a/tests/baselines/reference/computedPropertyNames20_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames20_ES5.errors.txt deleted file mode 100644 index c8f79ea944a..00000000000 --- a/tests/baselines/reference/computedPropertyNames20_ES5.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts (1 errors) ==== - var obj = { - [this.bar]: 0 - ~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames20_ES5.types b/tests/baselines/reference/computedPropertyNames20_ES5.types new file mode 100644 index 00000000000..eb2bbf34b7e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames20_ES5.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames20_ES5.ts === +var obj = { +>obj : {} +>{ [this.bar]: 0} : {} + + [this.bar]: 0 +>this.bar : any +>this : any +>bar : any +} diff --git a/tests/baselines/reference/computedPropertyNames21_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames21_ES5.errors.txt index 437417107a6..cb794d3865a 100644 --- a/tests/baselines/reference/computedPropertyNames21_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames21_ES5.errors.txt @@ -1,15 +1,12 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts(5,6): error TS2465: 'this' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames21_ES5.ts (1 errors) ==== class C { bar() { return 0; } [this.bar()]() { } - ~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~ !!! error TS2465: 'this' cannot be referenced in a computed property name. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames22_ES5.errors.txt deleted file mode 100644 index 1ec6413b117..00000000000 --- a/tests/baselines/reference/computedPropertyNames22_ES5.errors.txt +++ /dev/null @@ -1,14 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts(4,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts (1 errors) ==== - class C { - bar() { - var obj = { - [this.bar()]() { } - ~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - }; - return 0; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.types b/tests/baselines/reference/computedPropertyNames22_ES5.types new file mode 100644 index 00000000000..7afeeb75fa3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames22_ES5.types @@ -0,0 +1,21 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames22_ES5.ts === +class C { +>C : C + + bar() { +>bar : () => number + + var obj = { +>obj : {} +>{ [this.bar()]() { } } : {} + + [this.bar()]() { } +>this.bar() : number +>this.bar : () => number +>this : C +>bar : () => number + + }; + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames23_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames23_ES5.errors.txt index 76227dccaf5..ba827b91375 100644 --- a/tests/baselines/reference/computedPropertyNames23_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames23_ES5.errors.txt @@ -1,22 +1,14 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts(6,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts(6,12): error TS2465: 'this' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts (3 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames23_ES5.ts (1 errors) ==== class C { bar() { return 0; } [ - ~ { [this.bar()]: 1 }[0] - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~ !!! error TS2465: 'this' cannot be referenced in a computed property name. ]() { } - ~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames24_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames24_ES5.errors.txt index 2cb804133aa..a1290e06956 100644 --- a/tests/baselines/reference/computedPropertyNames24_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames24_ES5.errors.txt @@ -1,8 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts(9,6): error TS2466: 'super' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts (1 errors) ==== class Base { bar() { return 0; @@ -12,8 +11,6 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames24_ES5.ts(9, // Gets emitted as super, not _super, which is consistent with // use of super in static properties initializers. [super.bar()]() { } - ~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~ !!! error TS2466: 'super' cannot be referenced in a computed property name. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames25_ES5.errors.txt deleted file mode 100644 index 38142b2d177..00000000000 --- a/tests/baselines/reference/computedPropertyNames25_ES5.errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts(9,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts (1 errors) ==== - class Base { - bar() { - return 0; - } - } - class C extends Base { - foo() { - var obj = { - [super.bar()]() { } - ~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - }; - return 0; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.types b/tests/baselines/reference/computedPropertyNames25_ES5.types new file mode 100644 index 00000000000..6f34ce35b44 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames25_ES5.types @@ -0,0 +1,31 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames25_ES5.ts === +class Base { +>Base : Base + + bar() { +>bar : () => number + + return 0; + } +} +class C extends Base { +>C : C +>Base : Base + + foo() { +>foo : () => number + + var obj = { +>obj : {} +>{ [super.bar()]() { } } : {} + + [super.bar()]() { } +>super.bar() : number +>super.bar : () => number +>super : Base +>bar : () => number + + }; + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames26_ES5.errors.txt index fbef1d95ad4..77408f0a9f8 100644 --- a/tests/baselines/reference/computedPropertyNames26_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames26_ES5.errors.txt @@ -1,9 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(10,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(10,12): error TS2466: 'super' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts (3 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts (1 errors) ==== class Base { bar() { return 0; @@ -13,14 +11,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames26_ES5.ts(10 // Gets emitted as super, not _super, which is consistent with // use of super in static properties initializers. [ - ~ { [super.bar()]: 1 }[0] - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~ !!! error TS2466: 'super' cannot be referenced in a computed property name. ]() { } - ~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames27_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames27_ES5.errors.txt index 4508574cde1..1fbc7b37543 100644 --- a/tests/baselines/reference/computedPropertyNames27_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames27_ES5.errors.txt @@ -1,14 +1,11 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts(4,7): error TS2466: 'super' cannot be referenced in a computed property name. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames27_ES5.ts (1 errors) ==== class Base { } class C extends Base { [(super(), "prop")]() { } - ~~~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~ !!! error TS2466: 'super' cannot be referenced in a computed property name. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames28_ES5.errors.txt deleted file mode 100644 index 1e52db34288..00000000000 --- a/tests/baselines/reference/computedPropertyNames28_ES5.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts(7,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts (1 errors) ==== - class Base { - } - class C extends Base { - constructor() { - super(); - var obj = { - [(super(), "prop")]() { } - ~~~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - }; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.types b/tests/baselines/reference/computedPropertyNames28_ES5.types new file mode 100644 index 00000000000..278576ab1ca --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames28_ES5.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames28_ES5.ts === +class Base { +>Base : Base +} +class C extends Base { +>C : C +>Base : Base + + constructor() { + super(); +>super() : void +>super : typeof Base + + var obj = { +>obj : {} +>{ [(super(), "prop")]() { } } : {} + + [(super(), "prop")]() { } +>(super(), "prop") : string +>super(), "prop" : string +>super() : void +>super : typeof Base + + }; + } +} diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames29_ES5.errors.txt deleted file mode 100644 index 0b248e0d9ca..00000000000 --- a/tests/baselines/reference/computedPropertyNames29_ES5.errors.txt +++ /dev/null @@ -1,16 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts(5,17): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts (1 errors) ==== - class C { - bar() { - () => { - var obj = { - [this.bar()]() { } // needs capture - ~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - }; - } - return 0; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.types b/tests/baselines/reference/computedPropertyNames29_ES5.types new file mode 100644 index 00000000000..e0da4b10da8 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames29_ES5.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames29_ES5.ts === +class C { +>C : C + + bar() { +>bar : () => number + + () => { +>() => { var obj = { [this.bar()]() { } // needs capture }; } : () => void + + var obj = { +>obj : {} +>{ [this.bar()]() { } // needs capture } : {} + + [this.bar()]() { } // needs capture +>this.bar() : number +>this.bar : () => number +>this : C +>bar : () => number + + }; + } + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt index e25f3b765e9..2fbf68b4437 100644 --- a/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames2_ES5.errors.txt @@ -1,37 +1,19 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(5,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(6,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(7,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(8,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(8,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts(9,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts (8 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames2_ES5.ts (2 errors) ==== var methodName = "method"; var accessorName = "accessor"; class C { [methodName]() { } - ~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. static [methodName]() { } - ~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. get [accessorName]() { } ~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. set [accessorName](v) { } - ~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. static get [accessorName]() { } ~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. static set [accessorName](v) { } - ~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames30_ES5.errors.txt index a8c51a03246..1dfb605db33 100644 --- a/tests/baselines/reference/computedPropertyNames30_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames30_ES5.errors.txt @@ -1,8 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts(11,17): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts(11,19): error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts (1 errors) ==== class Base { } class C extends Base { @@ -14,8 +13,6 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames30_ES5.ts(11 // illegal, and not capturing this is consistent with //treatment of other similar violations. [(super(), "prop")]() { } - ~~~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~ !!! error TS2337: Super calls are not permitted outside constructors or in nested functions inside constructors }; diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames31_ES5.errors.txt deleted file mode 100644 index ab2f4783e36..00000000000 --- a/tests/baselines/reference/computedPropertyNames31_ES5.errors.txt +++ /dev/null @@ -1,21 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts(10,17): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts (1 errors) ==== - class Base { - bar() { - return 0; - } - } - class C extends Base { - foo() { - () => { - var obj = { - [super.bar()]() { } // needs capture - ~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - }; - } - return 0; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.types b/tests/baselines/reference/computedPropertyNames31_ES5.types new file mode 100644 index 00000000000..eb14b223ed3 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames31_ES5.types @@ -0,0 +1,35 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames31_ES5.ts === +class Base { +>Base : Base + + bar() { +>bar : () => number + + return 0; + } +} +class C extends Base { +>C : C +>Base : Base + + foo() { +>foo : () => number + + () => { +>() => { var obj = { [super.bar()]() { } // needs capture }; } : () => void + + var obj = { +>obj : {} +>{ [super.bar()]() { } // needs capture } : {} + + [super.bar()]() { } // needs capture +>super.bar() : number +>super.bar : () => number +>super : Base +>bar : () => number + + }; + } + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames32_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames32_ES5.errors.txt index 2cbba4b9b62..c61f748edb8 100644 --- a/tests/baselines/reference/computedPropertyNames32_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames32_ES5.errors.txt @@ -1,16 +1,13 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts(6,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32_ES5.ts (1 errors) ==== function foo() { return '' } class C { bar() { return 0; } [foo()]() { } - ~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2466: A computed property name cannot reference a type parameter from its containing type. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames33_ES5.errors.txt deleted file mode 100644 index ce79d83627c..00000000000 --- a/tests/baselines/reference/computedPropertyNames33_ES5.errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts(5,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts (1 errors) ==== - function foo() { return '' } - class C { - bar() { - var obj = { - [foo()]() { } - ~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - }; - return 0; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.types b/tests/baselines/reference/computedPropertyNames33_ES5.types new file mode 100644 index 00000000000..a0d99ec8615 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames33_ES5.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames33_ES5.ts === +function foo() { return '' } +>foo : () => string +>T : T + +class C { +>C : C +>T : T + + bar() { +>bar : () => number + + var obj = { +>obj : {} +>{ [foo()]() { } } : {} + + [foo()]() { } +>foo() : string +>foo : () => string +>T : T + + }; + return 0; + } +} diff --git a/tests/baselines/reference/computedPropertyNames34_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames34_ES5.errors.txt index 99f53d8b13b..30fa6642cbc 100644 --- a/tests/baselines/reference/computedPropertyNames34_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames34_ES5.errors.txt @@ -1,15 +1,12 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts(5,13): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts(5,18): error TS2302: Static members cannot reference class type parameters. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts (2 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames34_ES5.ts (1 errors) ==== function foo() { return '' } class C { static bar() { var obj = { [foo()]() { } - ~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2302: Static members cannot reference class type parameters. }; diff --git a/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt index fe90ccf2a71..6c38043c8e0 100644 --- a/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames36_ES5.errors.txt @@ -1,9 +1,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(8,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts (3 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } @@ -14,9 +12,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames36_ES5.ts(9, get ["get1"]() { return new Foo } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. set ["set1"](p: Foo2) { } - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames37_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames37_ES5.errors.txt deleted file mode 100644 index 562f3756e59..00000000000 --- a/tests/baselines/reference/computedPropertyNames37_ES5.errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts (2 errors) ==== - class Foo { x } - class Foo2 { x; y } - - class C { - [s: number]: Foo2; - - // Computed properties - get ["get1"]() { return new Foo } - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - set ["set1"](p: Foo2) { } - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames37_ES5.types b/tests/baselines/reference/computedPropertyNames37_ES5.types new file mode 100644 index 00000000000..a12324003bf --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames37_ES5.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames37_ES5.ts === +class Foo { x } +>Foo : Foo +>x : any + +class Foo2 { x; y } +>Foo2 : Foo2 +>x : any +>y : any + +class C { +>C : C + + [s: number]: Foo2; +>s : number +>Foo2 : Foo2 + + // Computed properties + get ["get1"]() { return new Foo } +>new Foo : Foo +>Foo : typeof Foo + + set ["set1"](p: Foo2) { } +>p : Foo2 +>Foo2 : Foo2 +} diff --git a/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt index 7f7579d9eea..acc08ee5527 100644 --- a/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames38_ES5.errors.txt @@ -1,9 +1,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(8,5): error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts (3 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } @@ -14,9 +12,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames38_ES5.ts(9, get [1 << 6]() { return new Foo } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2411: Property '[1 << 6]' of type 'Foo' is not assignable to string index type 'Foo2'. - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. set [1 << 6](p: Foo2) { } - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt index 7f4389794fb..669314676f9 100644 --- a/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames39_ES5.errors.txt @@ -1,9 +1,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(8,5): error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(8,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(9,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts (3 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } @@ -14,9 +12,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames39_ES5.ts(9, get [1 << 6]() { return new Foo } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2412: Property '[1 << 6]' of type 'Foo' is not assignable to numeric index type 'Foo2'. - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. set [1 << 6](p: Foo2) { } - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt index b484ee7269f..d044ea2abaf 100644 --- a/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3_ES5.errors.txt @@ -1,48 +1,30 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(3,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(4,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts(8,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts (12 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3_ES5.ts (6 errors) ==== var id; class C { [0 + 1]() { } - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. static [() => { }]() { } ~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. get [delete id]() { } ~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~~~~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. set [[0, 1]](v) { } ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. static get [""]() { } ~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~~~~~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. static set [id.toString()](v) { } - ~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt index 762d2d44e20..e8ceef0d581 100644 --- a/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames40_ES5.errors.txt @@ -1,9 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(8,5): error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts (3 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } @@ -12,11 +10,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames40_ES5.ts(9, // Computed properties [""]() { return new Foo } - ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2411: Property '[""]' of type '() => Foo' is not assignable to string index type '() => Foo2'. [""]() { return new Foo2 } - ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames41_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames41_ES5.errors.txt deleted file mode 100644 index a2251da6a86..00000000000 --- a/tests/baselines/reference/computedPropertyNames41_ES5.errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts(8,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts (1 errors) ==== - class Foo { x } - class Foo2 { x; y } - - class C { - [s: string]: () => Foo2; - - // Computed properties - static [""]() { return new Foo } - ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames41_ES5.types b/tests/baselines/reference/computedPropertyNames41_ES5.types new file mode 100644 index 00000000000..aac087ee958 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames41_ES5.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames41_ES5.ts === +class Foo { x } +>Foo : Foo +>x : any + +class Foo2 { x; y } +>Foo2 : Foo2 +>x : any +>y : any + +class C { +>C : C + + [s: string]: () => Foo2; +>s : string +>Foo2 : Foo2 + + // Computed properties + static [""]() { return new Foo } +>new Foo : Foo +>Foo : typeof Foo +} diff --git a/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt index 2654d0076e3..62c239a5a54 100644 --- a/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames43_ES5.errors.txt @@ -1,9 +1,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(10,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(10,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts (3 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } @@ -16,9 +14,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames43_ES5.ts(11 get ["get1"]() { return new Foo } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. set ["set1"](p: Foo2) { } - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt index 27921efa1fb..35ab422e093 100644 --- a/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames44_ES5.errors.txt @@ -1,10 +1,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(6,5): error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(10,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(10,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts (4 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts (2 errors) ==== class Foo { x } class Foo2 { x; y } @@ -13,14 +11,10 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames44_ES5.ts(10 get ["get1"]() { return new Foo } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2411: Property '["get1"]' of type 'Foo' is not assignable to string index type 'Foo2'. - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. } class D extends C { set ["set1"](p: Foo) { } ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt index 92b87702561..83855c5f0b7 100644 --- a/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames45_ES5.errors.txt @@ -1,16 +1,12 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11,5): error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts (3 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts (1 errors) ==== class Foo { x } class Foo2 { x; y } class C { get ["get1"]() { return new Foo } - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. } class D extends C { @@ -19,6 +15,4 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames45_ES5.ts(11 set ["set1"](p: Foo) { } ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2411: Property '["set1"]' of type 'Foo' is not assignable to string index type 'Foo2'. - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames46_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames46_ES5.errors.txt deleted file mode 100644 index 6af18c9e685..00000000000 --- a/tests/baselines/reference/computedPropertyNames46_ES5.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts (1 errors) ==== - var o = { - ["" || 0]: 0 - ~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - }; \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames46_ES5.types b/tests/baselines/reference/computedPropertyNames46_ES5.types new file mode 100644 index 00000000000..bdc2f2cf644 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames46_ES5.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames46_ES5.ts === +var o = { +>o : {} +>{ ["" || 0]: 0} : {} + + ["" || 0]: 0 +>"" || 0 : string | number + +}; diff --git a/tests/baselines/reference/computedPropertyNames47_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames47_ES5.errors.txt deleted file mode 100644 index 2f5af797b64..00000000000 --- a/tests/baselines/reference/computedPropertyNames47_ES5.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts (1 errors) ==== - enum E1 { x } - enum E2 { x } - var o = { - [E1.x || E2.x]: 0 - ~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - }; \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames47_ES5.types b/tests/baselines/reference/computedPropertyNames47_ES5.types new file mode 100644 index 00000000000..c79f2b20946 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames47_ES5.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames47_ES5.ts === +enum E1 { x } +>E1 : E1 +>x : E1 + +enum E2 { x } +>E2 : E2 +>x : E2 + +var o = { +>o : {} +>{ [E1.x || E2.x]: 0} : {} + + [E1.x || E2.x]: 0 +>E1.x || E2.x : E1 | E2 +>E1.x : E1 +>E1 : typeof E1 +>x : E1 +>E2.x : E2 +>E2 : typeof E2 +>x : E2 + +}; diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames48_ES5.errors.txt deleted file mode 100644 index cbda0c73c1f..00000000000 --- a/tests/baselines/reference/computedPropertyNames48_ES5.errors.txt +++ /dev/null @@ -1,38 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(16,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts(16,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts (6 errors) ==== - declare function extractIndexer(p: { [n: number]: T }): T; - - enum E { x } - - var a: any; - - extractIndexer({ - [a]: "" - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - }); // Should return string - - extractIndexer({ - [E.x]: "" - ~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - }); // Should return string - - extractIndexer({ - ["" || 0]: "" - ~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - }); // Should return any (widened form of undefined) \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.types b/tests/baselines/reference/computedPropertyNames48_ES5.types new file mode 100644 index 00000000000..3ff4c966e89 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames48_ES5.types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames48_ES5.ts === +declare function extractIndexer(p: { [n: number]: T }): T; +>extractIndexer : (p: { [n: number]: T; }) => T +>T : T +>p : { [n: number]: T; } +>n : number +>T : T +>T : T + +enum E { x } +>E : E +>x : E + +var a: any; +>a : any + +extractIndexer({ +>extractIndexer({ [a]: ""}) : string +>extractIndexer : (p: { [n: number]: T; }) => T +>{ [a]: ""} : { [x: number]: string; } + + [a]: "" +>a : any + +}); // Should return string + +extractIndexer({ +>extractIndexer({ [E.x]: ""}) : string +>extractIndexer : (p: { [n: number]: T; }) => T +>{ [E.x]: ""} : { [x: number]: string; } + + [E.x]: "" +>E.x : E +>E : typeof E +>x : E + +}); // Should return string + +extractIndexer({ +>extractIndexer({ ["" || 0]: ""}) : any +>extractIndexer : (p: { [n: number]: T; }) => T +>{ ["" || 0]: ""} : { [x: number]: undefined; } + + ["" || 0]: "" +>"" || 0 : string | number + +}); // Should return any (widened form of undefined) diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames4_ES5.errors.txt deleted file mode 100644 index 39765b8365e..00000000000 --- a/tests/baselines/reference/computedPropertyNames4_ES5.errors.txt +++ /dev/null @@ -1,52 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(13,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(14,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts(15,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts (11 errors) ==== - var s: string; - var n: number; - var a: any; - var v = { - [s]: 0, - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [n]: n, - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [s + s]: 1, - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [s + n]: 2, - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [+s]: s, - ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [""]: 0, - ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [0]: 0, - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [a]: 1, - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [true]: 0, - ~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [`hello bye`]: 0, - ~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [`hello ${a} bye`]: 0 - ~~~~~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.types b/tests/baselines/reference/computedPropertyNames4_ES5.types new file mode 100644 index 00000000000..7c26cae6444 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames4_ES5.types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames4_ES5.ts === +var s: string; +>s : string + +var n: number; +>n : number + +var a: any; +>a : any + +var v = { +>v : {} +>{ [s]: 0, [n]: n, [s + s]: 1, [s + n]: 2, [+s]: s, [""]: 0, [0]: 0, [a]: 1, [true]: 0, [`hello bye`]: 0, [`hello ${a} bye`]: 0} : {} + + [s]: 0, +>s : string + + [n]: n, +>n : number +>n : number + + [s + s]: 1, +>s + s : string +>s : string +>s : string + + [s + n]: 2, +>s + n : string +>s : string +>n : number + + [+s]: s, +>+s : number +>s : string +>s : string + + [""]: 0, + [0]: 0, + [a]: 1, +>a : any + + [true]: 0, +>true : any + + [`hello bye`]: 0, + [`hello ${a} bye`]: 0 +>a : any +} diff --git a/tests/baselines/reference/computedPropertyNames5_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames5_ES5.errors.txt index b65197056f7..a51bbedd4fe 100644 --- a/tests/baselines/reference/computedPropertyNames5_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames5_ES5.errors.txt @@ -1,48 +1,30 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(3,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts (12 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5_ES5.ts (6 errors) ==== var b: boolean; var v = { [b]: 0, ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. [true]: 1, ~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. [[]]: 0, ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. [{}]: 0, ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. [undefined]: undefined, ~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. [null]: null ~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames6_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames6_ES5.errors.txt index c7cc95a06ae..a38036c7a03 100644 --- a/tests/baselines/reference/computedPropertyNames6_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames6_ES5.errors.txt @@ -1,26 +1,17 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts (5 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6_ES5.ts (2 errors) ==== var p1: number | string; var p2: number | number[]; var p3: string | boolean; var v = { [p1]: 0, - ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. [p2]: 1, ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. [p3]: 2 ~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames7_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames7_ES5.errors.txt deleted file mode 100644 index 389d47c2e0e..00000000000 --- a/tests/baselines/reference/computedPropertyNames7_ES5.errors.txt +++ /dev/null @@ -1,12 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts(5,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts (1 errors) ==== - enum E { - member - } - var v = { - [E.member]: 0 - ~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames7_ES5.types b/tests/baselines/reference/computedPropertyNames7_ES5.types new file mode 100644 index 00000000000..209e07769c0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames7_ES5.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNames7_ES5.ts === +enum E { +>E : E + + member +>member : E +} +var v = { +>v : {} +>{ [E.member]: 0} : {} + + [E.member]: 0 +>E.member : E +>E : typeof E +>member : E +} diff --git a/tests/baselines/reference/computedPropertyNames8_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames8_ES5.errors.txt index e66d445fdda..14d9b6e3446 100644 --- a/tests/baselines/reference/computedPropertyNames8_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames8_ES5.errors.txt @@ -1,23 +1,17 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(6,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts (4 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8_ES5.ts (2 errors) ==== function f() { var t: T; var u: U; var v = { [t]: 0, ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. [u]: 1 ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. }; } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames9_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames9_ES5.errors.txt index 1b97c1bfc5c..6e8419828f7 100644 --- a/tests/baselines/reference/computedPropertyNames9_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames9_ES5.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(9,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts (4 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts (1 errors) ==== function f(s: string): string; function f(n: number): number; function f(x: T): T; @@ -12,14 +9,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames9_ES5.ts(9,5 var v = { [f("")]: 0, - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. [f(0)]: 0, - ~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. [f(true)]: 0 ~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt index 5bfd1959647..7fa95fe9426 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.errors.txt @@ -2,11 +2,9 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualTy Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts (3 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType10_ES5.ts (1 errors) ==== interface I { [s: number]: boolean; } @@ -18,9 +16,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualTy !!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. !!! error TS2322: Type 'string' is not assignable to type 'boolean'. [+"foo"]: "", - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. [+"bar"]: 0 - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.errors.txt deleted file mode 100644 index 571a7142527..00000000000 --- a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts (2 errors) ==== - interface I { - [s: string]: (x: string) => number; - [s: number]: (x: any) => number; // Doesn't get hit - } - - var o: I = { - ["" + 0](y) { return y.length; }, - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ["" + 1]: y => y.length - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.types new file mode 100644 index 00000000000..ad7ddc30567 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType1_ES5.ts === +interface I { +>I : I + + [s: string]: (x: string) => number; +>s : string +>x : string + + [s: number]: (x: any) => number; // Doesn't get hit +>s : number +>x : any +} + +var o: I = { +>o : I +>I : I +>{ ["" + 0](y) { return y.length; }, ["" + 1]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: undefined; } + + ["" + 0](y) { return y.length; }, +>"" + 0 : string +>y : string +>y.length : number +>y : string +>length : number + + ["" + 1]: y => y.length +>"" + 1 : string +>y => y.length : (y: string) => number +>y : string +>y.length : number +>y : string +>length : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.errors.txt deleted file mode 100644 index 930d67155e0..00000000000 --- a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts (2 errors) ==== - interface I { - [s: string]: (x: any) => number; // Doesn't get hit - [s: number]: (x: string) => number; - } - - var o: I = { - [+"foo"](y) { return y.length; }, - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [+"bar"]: y => y.length - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.types new file mode 100644 index 00000000000..0c1b9490abe --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType2_ES5.ts === +interface I { +>I : I + + [s: string]: (x: any) => number; // Doesn't get hit +>s : string +>x : any + + [s: number]: (x: string) => number; +>s : number +>x : string +} + +var o: I = { +>o : I +>I : I +>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; [x: number]: (y: string) => number; } + + [+"foo"](y) { return y.length; }, +>+"foo" : number +>y : string +>y.length : number +>y : string +>length : number + + [+"bar"]: y => y.length +>+"bar" : number +>y => y.length : (y: string) => number +>y : string +>y.length : number +>y : string +>length : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.errors.txt deleted file mode 100644 index 487fdd9a9a6..00000000000 --- a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.errors.txt +++ /dev/null @@ -1,17 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts (2 errors) ==== - interface I { - [s: string]: (x: string) => number; - } - - var o: I = { - [+"foo"](y) { return y.length; }, - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [+"bar"]: y => y.length - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.types new file mode 100644 index 00000000000..482d58c3ee0 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType3_ES5.ts === +interface I { +>I : I + + [s: string]: (x: string) => number; +>s : string +>x : string +} + +var o: I = { +>o : I +>I : I +>{ [+"foo"](y) { return y.length; }, [+"bar"]: y => y.length} : { [x: string]: (y: string) => number; } + + [+"foo"](y) { return y.length; }, +>+"foo" : number +>y : string +>y.length : number +>y : string +>length : number + + [+"bar"]: y => y.length +>+"bar" : number +>y => y.length : (y: string) => number +>y : string +>y.length : number +>y : string +>length : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.errors.txt deleted file mode 100644 index 76f6cfa990f..00000000000 --- a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts (2 errors) ==== - interface I { - [s: string]: any; - [s: number]: any; - } - - var o: I = { - [""+"foo"]: "", - ~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [""+"bar"]: 0 - ~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.types new file mode 100644 index 00000000000..c1662397527 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType4_ES5.ts === +interface I { +>I : I + + [s: string]: any; +>s : string + + [s: number]: any; +>s : number +} + +var o: I = { +>o : I +>I : I +>{ [""+"foo"]: "", [""+"bar"]: 0} : { [x: string]: string | number; [x: number]: undefined; } + + [""+"foo"]: "", +>""+"foo" : string + + [""+"bar"]: 0 +>""+"bar" : string +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.errors.txt deleted file mode 100644 index 4510a92ddf0..00000000000 --- a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.errors.txt +++ /dev/null @@ -1,18 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts (2 errors) ==== - interface I { - [s: string]: any; - [s: number]: any; - } - - var o: I = { - [+"foo"]: "", - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [+"bar"]: 0 - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.types new file mode 100644 index 00000000000..bb382ca136e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType5_ES5.ts === +interface I { +>I : I + + [s: string]: any; +>s : string + + [s: number]: any; +>s : number +} + +var o: I = { +>o : I +>I : I +>{ [+"foo"]: "", [+"bar"]: 0} : { [x: string]: string | number; [x: number]: string | number; } + + [+"foo"]: "", +>+"foo" : number + + [+"bar"]: 0 +>+"bar" : number +} diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.errors.txt deleted file mode 100644 index a72b98c1efc..00000000000 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.errors.txt +++ /dev/null @@ -1,34 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts (6 errors) ==== - interface I { - [s: string]: T; - } - - declare function foo(obj: I): T - - foo({ - p: "", - 0: () => { }, - ["hi" + "bye"]: true, - ~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [0 + 1]: 0, - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [+"hi"]: [0] - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - }); \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types new file mode 100644 index 00000000000..2e16c7cb140 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType6_ES5.ts === +interface I { +>I : I +>T : T + + [s: string]: T; +>s : string +>T : T +} + +declare function foo(obj: I): T +>foo : (obj: I) => T +>T : T +>obj : I +>I : I +>T : T +>T : T + +foo({ +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : string | number | boolean | number[] | (() => void) +>foo : (obj: I) => T +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: string]: string | number | boolean | number[] | (() => void); 0: () => void; p: string; } + + p: "", +>p : string + + 0: () => { }, +>() => { } : () => void + + ["hi" + "bye"]: true, +>"hi" + "bye" : string + + [0 + 1]: 0, +>0 + 1 : number + + [+"hi"]: [0] +>+"hi" : number +>[0] : number[] + +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.errors.txt deleted file mode 100644 index 153bfc1fbde..00000000000 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.errors.txt +++ /dev/null @@ -1,34 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts(10,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts(11,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts(12,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts (6 errors) ==== - interface I { - [s: number]: T; - } - - declare function foo(obj: I): T - - foo({ - p: "", - 0: () => { }, - ["hi" + "bye"]: true, - ~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [0 + 1]: 0, - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - [+"hi"]: [0] - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - }); \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types new file mode 100644 index 00000000000..80ba2b9224f --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType7_ES5.ts === +interface I { +>I : I +>T : T + + [s: number]: T; +>s : number +>T : T +} + +declare function foo(obj: I): T +>foo : (obj: I) => T +>T : T +>obj : I +>I : I +>T : T +>T : T + +foo({ +>foo({ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]}) : number | number[] | (() => void) +>foo : (obj: I) => T +>{ p: "", 0: () => { }, ["hi" + "bye"]: true, [0 + 1]: 0, [+"hi"]: [0]} : { [x: number]: number | number[] | (() => void); 0: () => void; p: string; } + + p: "", +>p : string + + 0: () => { }, +>() => { } : () => void + + ["hi" + "bye"]: true, +>"hi" + "bye" : string + + [0 + 1]: 0, +>0 + 1 : number + + [+"hi"]: [0] +>+"hi" : number +>[0] : number[] + +}); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt index 74a235bf087..3376243e370 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.errors.txt @@ -2,11 +2,9 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualTy Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts (3 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType8_ES5.ts (1 errors) ==== interface I { [s: string]: boolean; [s: number]: boolean; @@ -19,9 +17,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualTy !!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. !!! error TS2322: Type 'string' is not assignable to type 'boolean'. [""+"foo"]: "", - ~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. [""+"bar"]: 0 - ~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt index 79807602de2..d4085a37e60 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.errors.txt @@ -2,11 +2,9 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualTy Index signatures are incompatible. Type 'string | number' is not assignable to type 'boolean'. Type 'string' is not assignable to type 'boolean'. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts(8,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts (3 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualType9_ES5.ts (1 errors) ==== interface I { [s: string]: boolean; [s: number]: boolean; @@ -19,9 +17,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesContextualTy !!! error TS2322: Type 'string | number' is not assignable to type 'boolean'. !!! error TS2322: Type 'string' is not assignable to type 'boolean'. [+"foo"]: "", - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. [+"bar"]: 0 - ~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.errors.txt deleted file mode 100644 index cc370681e4e..00000000000 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.errors.txt +++ /dev/null @@ -1,17 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts(3,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts(4,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts (3 errors) ==== - class C { - ["" + ""]() { } - ~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - get ["" + ""]() { return 0; } - ~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - set ["" + ""](x) { } - ~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js index 246b22230bb..c091003735c 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.js @@ -26,3 +26,8 @@ var C = (function () { }); return C; })(); + + +//// [computedPropertyNamesDeclarationEmit1_ES5.d.ts] +declare class C { +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.types new file mode 100644 index 00000000000..a5fe3dc0fa1 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES5.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit1_ES5.ts === +class C { +>C : C + + ["" + ""]() { } +>"" + "" : string + + get ["" + ""]() { return 0; } +>"" + "" : string + + set ["" + ""](x) { } +>"" + "" : string +>x : any +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.errors.txt deleted file mode 100644 index 01263bdd7cf..00000000000 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.errors.txt +++ /dev/null @@ -1,17 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts(2,12): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts(3,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts(4,16): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts (3 errors) ==== - class C { - static ["" + ""]() { } - ~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - static get ["" + ""]() { return 0; } - ~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - static set ["" + ""](x) { } - ~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js index a3e4e6afd40..22a5b0d305d 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.js @@ -26,3 +26,8 @@ var C = (function () { }); return C; })(); + + +//// [computedPropertyNamesDeclarationEmit2_ES5.d.ts] +declare class C { +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.types new file mode 100644 index 00000000000..949d82596c7 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES5.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit2_ES5.ts === +class C { +>C : C + + static ["" + ""]() { } +>"" + "" : string + + static get ["" + ""]() { return 0; } +>"" + "" : string + + static set ["" + ""](x) { } +>"" + "" : string +>x : any +} diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.errors.txt deleted file mode 100644 index 4c8a2270d28..00000000000 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.errors.txt +++ /dev/null @@ -1,27 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts(3,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts(4,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts(4,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts (6 errors) ==== - var v = { - ["" + ""]: 0, - ~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ["" + ""]() { }, - ~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - get ["" + ""]() { return 0; }, - ~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - set ["" + ""](x) { } - ~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js index ced7e199a4c..9f05669d823 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js @@ -17,3 +17,7 @@ var v = { set ["" + ""](x) { } }; + + +//// [computedPropertyNamesDeclarationEmit5_ES5.d.ts] +declare var v: {}; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.types b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.types new file mode 100644 index 00000000000..3f5a7355a20 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.types @@ -0,0 +1,18 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit5_ES5.ts === +var v = { +>v : {} +>{ ["" + ""]: 0, ["" + ""]() { }, get ["" + ""]() { return 0; }, set ["" + ""](x) { }} : {} + + ["" + ""]: 0, +>"" + "" : string + + ["" + ""]() { }, +>"" + "" : string + + get ["" + ""]() { return 0; }, +>"" + "" : string + + set ["" + ""](x) { } +>"" + "" : string +>x : any +} diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt index d02a636938c..9e0128c7869 100644 --- a/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads_ES5.errors.txt @@ -1,9 +1,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts(4,5): error TS1168: Computed property names are not allowed in method overloads. tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts(5,5): error TS1168: Computed property names are not allowed in method overloads. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts(6,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts (3 errors) ==== +==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ES5.ts (2 errors) ==== var methodName = "method"; var accessorName = "accessor"; class C { @@ -14,6 +13,4 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads_ ~~~~~~~~~~~~ !!! error TS1168: Computed property names are not allowed in method overloads. [methodName](v?: string) { } - ~~~~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.errors.txt deleted file mode 100644 index 41ece97ba82..00000000000 --- a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts (1 errors) ==== - class C { - ["hello"]() { - ~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - debugger; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.types b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.types new file mode 100644 index 00000000000..1c57d97a7e8 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap1_ES5.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap1_ES5.ts === +class C { +>C : C + + ["hello"]() { + debugger; + } +} diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.errors.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.errors.txt deleted file mode 100644 index d95aa2a1adb..00000000000 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.errors.txt +++ /dev/null @@ -1,11 +0,0 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - - -==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts (1 errors) ==== - var v = { - ["hello"]() { - ~~~~~~~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - debugger; - } - } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types new file mode 100644 index 00000000000..1dcc49a8fae --- /dev/null +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.ts === +var v = { +>v : {} +>{ ["hello"]() { debugger; }} : {} + + ["hello"]() { + debugger; + } +} diff --git a/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt index 5918387942d..55176bf76f1 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName2.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts(1,12): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName2.ts (1 errors) ==== var v = { [e]: 1 }; - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt index 097ab1ea9cb..07ea47dd3f0 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName3.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,11): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts(1,12): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName3.ts (1 errors) ==== var v = { [e]() { } }; - ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt index ca69791c93c..cfb12152c94 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.errors.txt @@ -1,13 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,15): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts(1,16): error TS2304: Cannot find name 'e'. -==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName4.ts (2 errors) ==== var v = { get [e]() { } }; ~~~ -!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. - ~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file From ddb63d286b142be754f9ec97b62c490264a4a200 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 4 Feb 2015 18:35:04 -0800 Subject: [PATCH 005/162] Emit computed properties in ES3/ES5 properly. --- src/compiler/emitter.ts | 173 ++++++++++++++++-- .../reference/FunctionDeclaration8_es6.js | 3 +- .../reference/FunctionDeclaration9_es6.js | 3 +- .../FunctionPropertyAssignments5_es6.js | 5 +- .../reference/computedPropertyNames10_ES5.js | 29 +-- .../reference/computedPropertyNames11_ES5.js | 105 ++++++++--- .../reference/computedPropertyNames18_ES5.js | 7 +- .../reference/computedPropertyNames19_ES5.js | 7 +- .../reference/computedPropertyNames1_ES5.js | 24 ++- .../reference/computedPropertyNames20_ES5.js | 7 +- .../reference/computedPropertyNames22_ES5.js | 9 +- .../reference/computedPropertyNames23_ES5.js | 3 +- .../reference/computedPropertyNames25_ES5.js | 9 +- .../reference/computedPropertyNames26_ES5.js | 3 +- .../reference/computedPropertyNames28_ES5.js | 9 +- .../reference/computedPropertyNames29_ES5.js | 9 +- .../reference/computedPropertyNames30_ES5.js | 9 +- .../reference/computedPropertyNames31_ES5.js | 9 +- .../reference/computedPropertyNames33_ES5.js | 9 +- .../reference/computedPropertyNames34_ES5.js | 9 +- .../reference/computedPropertyNames46_ES5.js | 7 +- .../reference/computedPropertyNames47_ES5.js | 7 +- .../reference/computedPropertyNames48_ES5.js | 19 +- .../reference/computedPropertyNames4_ES5.js | 27 +-- .../reference/computedPropertyNames5_ES5.js | 17 +- .../reference/computedPropertyNames6_ES5.js | 11 +- .../reference/computedPropertyNames7_ES5.js | 7 +- .../reference/computedPropertyNames8_ES5.js | 9 +- .../reference/computedPropertyNames9_ES5.js | 11 +- ...mputedPropertyNamesContextualType10_ES5.js | 9 +- ...omputedPropertyNamesContextualType1_ES5.js | 9 +- ...omputedPropertyNamesContextualType2_ES5.js | 9 +- ...omputedPropertyNamesContextualType3_ES5.js | 9 +- ...omputedPropertyNamesContextualType4_ES5.js | 9 +- ...omputedPropertyNamesContextualType5_ES5.js | 9 +- ...omputedPropertyNamesContextualType6_ES5.js | 14 +- ...omputedPropertyNamesContextualType7_ES5.js | 14 +- ...omputedPropertyNamesContextualType8_ES5.js | 9 +- ...omputedPropertyNamesContextualType9_ES5.js | 9 +- ...mputedPropertyNamesDeclarationEmit5_ES5.js | 27 ++- .../computedPropertyNamesSourceMap2_ES5.js | 9 +- ...computedPropertyNamesSourceMap2_ES5.js.map | 2 +- ...dPropertyNamesSourceMap2_ES5.sourcemap.txt | 79 +++++--- .../parserES5ComputedPropertyName2.js | 3 +- .../parserES5ComputedPropertyName3.js | 5 +- .../parserES5ComputedPropertyName4.js | 8 +- tests/baselines/reference/privateIndexer2.js | 9 +- 47 files changed, 545 insertions(+), 253 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 086a402efb2..e6f3a08453e 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -271,7 +271,7 @@ module ts { }); } - function getAllAccessorDeclarations(node: ClassDeclaration, accessor: AccessorDeclaration) { + function getAllAccessorDeclarations(declarations: NodeArray, accessor: AccessorDeclaration) { var firstAccessor: AccessorDeclaration; var getAccessor: AccessorDeclaration; var setAccessor: AccessorDeclaration; @@ -288,7 +288,7 @@ module ts { } } else { - forEach(node.members,(member: Declaration) => { + forEach(declarations, (member: Declaration) => { if ((member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) && (member.name).text === (accessor.name).text && (member.flags & NodeFlags.Static) === (accessor.flags & NodeFlags.Static)) { @@ -1116,8 +1116,8 @@ module ts { if (hasDynamicName(node)) { return; } - - var accessors = getAllAccessorDeclarations(node.parent, node); + + var accessors = getAllAccessorDeclarations((node.parent).members, node); if (node === accessors.firstAccessor) { emitJsDocComments(accessors.getAccessor); emitJsDocComments(accessors.setAccessor); @@ -2220,7 +2220,10 @@ module ts { // This function specifically handles numeric/string literals for enum and accessor 'identifiers'. // In a sense, it does not actually emit identifiers as much as it declares a name for a specific property. + // For example, this is utilized when feeding in a result to Object.defineProperty. function emitExpressionForPropertyName(node: DeclarationName) { + Debug.assert(node.kind !== SyntaxKind.BindingElement); + if (node.kind === SyntaxKind.StringLiteral) { emitLiteral(node); } @@ -2417,22 +2420,167 @@ module ts { } } - function emitObjectLiteral(node: ObjectLiteralExpression) { + function emitObjectLiteralBody(node: ObjectLiteralExpression, numElements: number) { write("{"); - var properties = node.properties; - if (properties.length) { + + if (numElements > 0) { + var properties = node.properties; var multiLine = (node.flags & NodeFlags.MultiLine) !== 0; if (!multiLine) { write(" "); } - emitList(properties, 0, properties.length, /*multiLine*/ multiLine, + emitList(properties, 0, numElements, /*multiLine*/ multiLine, /*trailingComma*/ properties.hasTrailingComma && languageVersion >= ScriptTarget.ES5); if (!multiLine) { write(" "); } } + write("}"); } + + function emitDownlevelObjectLiteralWithComputedProperties(node: ObjectLiteralExpression, firstComputedPropertyIndex: number) { + var multiLine = (node.flags & NodeFlags.MultiLine) !== 0; + var properties = node.properties; + + write("("); + + // For computed properties, we need to create a unique handle to the object + // literal so we can modify it without risking internal assignments tainting the object. + var tempVar = createTempVariable(node); + recordTempDeclaration(tempVar); + + // Write out the first non-computed properties + // (or all properties if none of them are computed), + // then emit the rest through indexing on the temp variable. + emit(tempVar) + write(" = "); + emitObjectLiteralBody(node, firstComputedPropertyIndex); + + if (multiLine) { + increaseIndent(); + } + + for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) { + writeSeparator(); + + var property = properties[i]; + + emitStart(property) + if (property.kind === SyntaxKind.GetAccessor || property.kind === SyntaxKind.SetAccessor) { + // TODO (drosen): Reconcile with 'emitMemberFunctions'. + var accessors = getAllAccessorDeclarations(node.properties, property); + write("Object.defineProperty("); + emit(tempVar); + write(", "); + emitStart(node.name); + emitExpressionForPropertyName(property.name); + emitEnd(property.name); + write(", {"); + increaseIndent(); + if (accessors.getAccessor) { + writeLine() + emitLeadingComments(accessors.getAccessor); + write("get: "); + emitStart(accessors.getAccessor); + write("function "); + emitSignatureAndBody(accessors.getAccessor); + emitEnd(accessors.getAccessor); + emitTrailingComments(accessors.getAccessor); + write(","); + } + if (accessors.setAccessor) { + writeLine(); + emitLeadingComments(accessors.setAccessor); + write("set: "); + emitStart(accessors.setAccessor); + write("function "); + emitSignatureAndBody(accessors.setAccessor); + emitEnd(accessors.setAccessor); + emitTrailingComments(accessors.setAccessor); + write(","); + } + writeLine(); + write("enumerable: true,"); + writeLine(); + write("configurable: true"); + decreaseIndent(); + writeSeparator(); + write("})"); + emitEnd(property); + } + else { + emitLeadingComments(property); + emitStart(property.name); + emit(tempVar); + emitMemberAccessForPropertyName(property.name); + emitEnd(property.name); + + write(" = "); + + if (property.kind === SyntaxKind.PropertyAssignment) { + emit((property).initializer); + } + else if (property.kind === SyntaxKind.ShorthandPropertyAssignment) { + emitExpressionIdentifier((property).name); + } + else if (property.kind === SyntaxKind.MethodDeclaration) { + emitFunctionDeclaration(property); + } + else { + Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind); + } + } + + emitEnd(property); + } + + writeSeparator(); + emit(tempVar); + + write(")"); + + if (multiLine) { + decreaseIndent(); + } + + function writeSeparator() { + if (multiLine) { + write(","); + writeLine(); + } + else { + write(", "); + } + } + } + + function emitObjectLiteral(node: ObjectLiteralExpression) { + if (languageVersion >= ScriptTarget.ES6) { + emitObjectLiteralBody(node, node.properties.length); + return; + } + + var properties = node.properties; + + // Find the first computed property. + // Everything until that point can be emitted as part of the initial object literal. + var numInitialNonComputedProperties = properties.length; + forEach(properties, (property, i) => { + if (hasDynamicName(properties[i])) { + numInitialNonComputedProperties = i; + return true; + } + }); + + var hasComputedProperty = numInitialNonComputedProperties !== properties.length; + if (hasComputedProperty) { + emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); + } + else { + emitObjectLiteralBody(node, properties.length); + } + } function emitComputedPropertyName(node: ComputedPropertyName) { write("["); @@ -2464,7 +2612,7 @@ module ts { // export var obj = { y }; // } // The short-hand property in obj need to emit as such ... = { y : m.y } regardless of the TargetScript version - if (languageVersion < ScriptTarget.ES6 || resolver.getExpressionNamePrefix(node.name)) { + if (languageVersion <= ScriptTarget.ES5 || resolver.getExpressionNamePrefix(node.name)) { // Emit identifier as an identifier write(": "); // Even though this is stored as identifier treat it as an expression @@ -3446,6 +3594,7 @@ module ts { } function emitMemberAccessForPropertyName(memberName: DeclarationName) { + // TODO: (jfreeman,drosen): comment on why this is emitNode instead of emit here. if (memberName.kind === SyntaxKind.StringLiteral || memberName.kind === SyntaxKind.NumericLiteral) { write("["); emitNode(memberName); @@ -3495,13 +3644,14 @@ module ts { emitLeadingComments(member); emitStart(member); emitStart((member).name); - emitNode(node.name); + emitNode(node.name); // TODO (shkamat,drosen): comment for why emitNode instead of emit. if (!(member.flags & NodeFlags.Static)) { write(".prototype"); } emitMemberAccessForPropertyName((member).name); emitEnd((member).name); write(" = "); + // TODO (drosen): Should we performing emitStart twice on emitStart(member)? emitStart(member); emitFunctionDeclaration(member); emitEnd(member); @@ -3510,7 +3660,7 @@ module ts { emitTrailingComments(member); } else if (member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) { - var accessors = getAllAccessorDeclarations(node, member); + var accessors = getAllAccessorDeclarations(node.members, member); if (member === accessors.firstAccessor) { writeLine(); emitStart(member); @@ -3521,6 +3671,7 @@ module ts { write(".prototype"); } write(", "); + // TODO: Shouldn't emitStart on name occur *here*? emitExpressionForPropertyName((member).name); emitEnd((member).name); write(", {"); diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.js b/tests/baselines/reference/FunctionDeclaration8_es6.js index 5f9f0a2a49e..64f6bff50c0 100644 --- a/tests/baselines/reference/FunctionDeclaration8_es6.js +++ b/tests/baselines/reference/FunctionDeclaration8_es6.js @@ -2,4 +2,5 @@ var v = { [yield]: foo } //// [FunctionDeclaration8_es6.js] -var v = { [yield]: foo }; +var v = (_a = {}, _a[yield] = foo, _a); +var _a; diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.js b/tests/baselines/reference/FunctionDeclaration9_es6.js index 388275ed4fa..bca309d2d62 100644 --- a/tests/baselines/reference/FunctionDeclaration9_es6.js +++ b/tests/baselines/reference/FunctionDeclaration9_es6.js @@ -5,5 +5,6 @@ function * foo() { //// [FunctionDeclaration9_es6.js] function foo() { - var v = { []: foo }; + var v = (_a = {}, _a[] = foo, _a); + var _a; } diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js index 2bfc675acff..5cd36bdce30 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js @@ -2,5 +2,6 @@ var v = { *[foo()]() { } } //// [FunctionPropertyAssignments5_es6.js] -var v = { [foo()]: function () { -} }; +var v = (_a = {}, _a[foo()] = function () { +}, _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.js b/tests/baselines/reference/computedPropertyNames10_ES5.js index cb015e76dff..5d8ff398d6c 100644 --- a/tests/baselines/reference/computedPropertyNames10_ES5.js +++ b/tests/baselines/reference/computedPropertyNames10_ES5.js @@ -20,27 +20,28 @@ var v = { var s; var n; var a; -var v = { - [s]: function () { +var v = (_a = {}, + _a[s] = function () { }, - [n]: function () { + _a[n] = function () { }, - [s + s]: function () { + _a[s + s] = function () { }, - [s + n]: function () { + _a[s + n] = function () { }, - [+s]: function () { + _a[+s] = function () { }, - [""]: function () { + _a[""] = function () { }, - [0]: function () { + _a[0] = function () { }, - [a]: function () { + _a[a] = function () { }, - [true]: function () { + _a[true] = function () { }, - ["hello bye"]: function () { + _a["hello bye"] = function () { }, - ["hello " + a + " bye"]: function () { - } -}; + _a["hello " + a + " bye"] = function () { + }, + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.js b/tests/baselines/reference/computedPropertyNames11_ES5.js index e716515b95c..7005e392748 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES5.js +++ b/tests/baselines/reference/computedPropertyNames11_ES5.js @@ -20,33 +20,78 @@ var v = { var s; var n; var a; -var v = { - get [s]() { - return 0; - }, - set [n](v) { - }, - get [s + s]() { - return 0; - }, - set [s + n](v) { - }, - get [+s]() { - return 0; - }, - set [""](v) { - }, - get [0]() { - return 0; - }, - set [a](v) { - }, - get [true]() { - return 0; - }, - set ["hello bye"](v) { - }, - get ["hello " + a + " bye"]() { - return 0; - } -}; +var v = (_a = {}, + Object.defineProperty(_a, s, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(_a, n, { + set: function (v) { + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(_a, s + s, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(_a, s + n, { + set: function (v) { + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(_a, +s, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(_a, "", { + set: function (v) { + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(_a, 0, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(_a, a, { + set: function (v) { + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(_a, true, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(_a, "hello bye", { + set: function (v) { + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(_a, "hello " + a + " bye", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true, + }), + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames18_ES5.js b/tests/baselines/reference/computedPropertyNames18_ES5.js index 8472e355cd1..a62af506531 100644 --- a/tests/baselines/reference/computedPropertyNames18_ES5.js +++ b/tests/baselines/reference/computedPropertyNames18_ES5.js @@ -7,7 +7,8 @@ function foo() { //// [computedPropertyNames18_ES5.js] function foo() { - var obj = { - [this.bar]: 0 - }; + var obj = (_a = {}, + _a[this.bar] = 0, + _a); + var _a; } diff --git a/tests/baselines/reference/computedPropertyNames19_ES5.js b/tests/baselines/reference/computedPropertyNames19_ES5.js index 50fbd89595d..bda3e01bbed 100644 --- a/tests/baselines/reference/computedPropertyNames19_ES5.js +++ b/tests/baselines/reference/computedPropertyNames19_ES5.js @@ -8,7 +8,8 @@ module M { //// [computedPropertyNames19_ES5.js] var M; (function (M) { - var obj = { - [this.bar]: 0 - }; + var obj = (_a = {}, + _a[this.bar] = 0, + _a); + var _a; })(M || (M = {})); diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.js b/tests/baselines/reference/computedPropertyNames1_ES5.js index 3c58cca5b22..5e630a5b81d 100644 --- a/tests/baselines/reference/computedPropertyNames1_ES5.js +++ b/tests/baselines/reference/computedPropertyNames1_ES5.js @@ -5,10 +5,20 @@ var v = { } //// [computedPropertyNames1_ES5.js] -var v = { - get [0 + 1]() { - return 0; - }, - set [0 + 1](v) { - } //No error -}; +var v = (_a = {}, + Object.defineProperty(_a, 0 + 1, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(_a, 0 + 1, { + set: function (v) { + } //No error + , + enumerable: true, + configurable: true, + }), + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames20_ES5.js b/tests/baselines/reference/computedPropertyNames20_ES5.js index 347bbd71abc..1eec0a7bcdb 100644 --- a/tests/baselines/reference/computedPropertyNames20_ES5.js +++ b/tests/baselines/reference/computedPropertyNames20_ES5.js @@ -4,6 +4,7 @@ var obj = { } //// [computedPropertyNames20_ES5.js] -var obj = { - [this.bar]: 0 -}; +var obj = (_a = {}, + _a[this.bar] = 0, + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.js b/tests/baselines/reference/computedPropertyNames22_ES5.js index a3881b01845..b28e0ea68e2 100644 --- a/tests/baselines/reference/computedPropertyNames22_ES5.js +++ b/tests/baselines/reference/computedPropertyNames22_ES5.js @@ -13,11 +13,12 @@ var C = (function () { function C() { } C.prototype.bar = function () { - var obj = { - [this.bar()]: function () { - } - }; + var obj = (_a = {}, + _a[this.bar()] = function () { + }, + _a); return 0; + var _a; }; return C; })(); diff --git a/tests/baselines/reference/computedPropertyNames23_ES5.js b/tests/baselines/reference/computedPropertyNames23_ES5.js index 6e0e63dcf6a..aa3998db260 100644 --- a/tests/baselines/reference/computedPropertyNames23_ES5.js +++ b/tests/baselines/reference/computedPropertyNames23_ES5.js @@ -15,7 +15,8 @@ var C = (function () { C.prototype.bar = function () { return 0; }; - C.prototype[{ [this.bar()]: 1 }[0]] = function () { + C.prototype[(_a = {}, _a[this.bar()] = 1, _a)[0]] = function () { }; return C; })(); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js index 532751416f2..4bcf877c571 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.js +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -34,11 +34,12 @@ var C = (function (_super) { _super.apply(this, arguments); } C.prototype.foo = function () { - var obj = { - [_super.prototype.bar.call(this)]: function () { - } - }; + var obj = (_a = {}, + _a[_super.prototype.bar.call(this)] = function () { + }, + _a); return 0; + var _a; }; return C; })(Base); diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.js b/tests/baselines/reference/computedPropertyNames26_ES5.js index fd76bf20ed8..705eaaf53e3 100644 --- a/tests/baselines/reference/computedPropertyNames26_ES5.js +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -34,7 +34,8 @@ var C = (function (_super) { } // Gets emitted as super, not _super, which is consistent with // use of super in static properties initializers. - C.prototype[{ [super.bar.call(this)]: 1 }[0]] = function () { + C.prototype[(_a = {}, _a[super.bar.call(this)] = 1, _a)[0]] = function () { }; return C; })(Base); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js index c79357908da..418252784a2 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES5.js +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -26,10 +26,11 @@ var C = (function (_super) { __extends(C, _super); function C() { _super.call(this); - var obj = { - [(_super.call(this), "prop")]: function () { - } - }; + var obj = (_a = {}, + _a[(_super.call(this), "prop")] = function () { + }, + _a); + var _a; } return C; })(Base); diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.js b/tests/baselines/reference/computedPropertyNames29_ES5.js index de0667a874c..93a80128d98 100644 --- a/tests/baselines/reference/computedPropertyNames29_ES5.js +++ b/tests/baselines/reference/computedPropertyNames29_ES5.js @@ -17,10 +17,11 @@ var C = (function () { C.prototype.bar = function () { var _this = this; (function () { - var obj = { - [_this.bar()]: function () { - } // needs capture - }; + var obj = (_a = {}, + _a[_this.bar()] = function () { + }, + _a); + var _a; }); return 0; }; diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js index 995cb2f8bf0..30d314f1f6a 100644 --- a/tests/baselines/reference/computedPropertyNames30_ES5.js +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -32,13 +32,14 @@ var C = (function (_super) { function C() { _super.call(this); (function () { - var obj = { + var obj = (_a = {}, // Ideally, we would capture this. But the reference is // illegal, and not capturing this is consistent with //treatment of other similar violations. - [(_super.call(this), "prop")]: function () { - } - }; + _a[(_super.call(this), "prop")] = function () { + }, + _a); + var _a; }); } return C; diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js index 81d91a3ba31..a079b3fa449 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.js +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -38,10 +38,11 @@ var C = (function (_super) { C.prototype.foo = function () { var _this = this; (function () { - var obj = { - [_super.prototype.bar.call(_this)]: function () { - } // needs capture - }; + var obj = (_a = {}, + _a[_super.prototype.bar.call(_this)] = function () { + }, + _a); + var _a; }); return 0; }; diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.js b/tests/baselines/reference/computedPropertyNames33_ES5.js index 982f6e69c46..24362351196 100644 --- a/tests/baselines/reference/computedPropertyNames33_ES5.js +++ b/tests/baselines/reference/computedPropertyNames33_ES5.js @@ -17,11 +17,12 @@ var C = (function () { function C() { } C.prototype.bar = function () { - var obj = { - [foo()]: function () { - } - }; + var obj = (_a = {}, + _a[foo()] = function () { + }, + _a); return 0; + var _a; }; return C; })(); diff --git a/tests/baselines/reference/computedPropertyNames34_ES5.js b/tests/baselines/reference/computedPropertyNames34_ES5.js index 3c588af07df..83e757222b0 100644 --- a/tests/baselines/reference/computedPropertyNames34_ES5.js +++ b/tests/baselines/reference/computedPropertyNames34_ES5.js @@ -17,11 +17,12 @@ var C = (function () { function C() { } C.bar = function () { - var obj = { - [foo()]: function () { - } - }; + var obj = (_a = {}, + _a[foo()] = function () { + }, + _a); return 0; + var _a; }; return C; })(); diff --git a/tests/baselines/reference/computedPropertyNames46_ES5.js b/tests/baselines/reference/computedPropertyNames46_ES5.js index 6c7a393ccbe..815f5769f3b 100644 --- a/tests/baselines/reference/computedPropertyNames46_ES5.js +++ b/tests/baselines/reference/computedPropertyNames46_ES5.js @@ -4,6 +4,7 @@ var o = { }; //// [computedPropertyNames46_ES5.js] -var o = { - ["" || 0]: 0 -}; +var o = (_a = {}, + _a["" || 0] = 0, + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames47_ES5.js b/tests/baselines/reference/computedPropertyNames47_ES5.js index 10e31bd9599..7d839e16ffb 100644 --- a/tests/baselines/reference/computedPropertyNames47_ES5.js +++ b/tests/baselines/reference/computedPropertyNames47_ES5.js @@ -14,6 +14,7 @@ var E2; (function (E2) { E2[E2["x"] = 0] = "x"; })(E2 || (E2 = {})); -var o = { - [0 /* x */ || 0 /* x */]: 0 -}; +var o = (_a = {}, + _a[0 /* x */ || 0 /* x */] = 0, + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.js b/tests/baselines/reference/computedPropertyNames48_ES5.js index eb1c50857c7..c5ca0d5b241 100644 --- a/tests/baselines/reference/computedPropertyNames48_ES5.js +++ b/tests/baselines/reference/computedPropertyNames48_ES5.js @@ -23,12 +23,13 @@ var E; E[E["x"] = 0] = "x"; })(E || (E = {})); var a; -extractIndexer({ - [a]: "" -}); // Should return string -extractIndexer({ - [0 /* x */]: "" -}); // Should return string -extractIndexer({ - ["" || 0]: "" -}); // Should return any (widened form of undefined) +extractIndexer((_a = {}, + _a[a] = "", + _a)); // Should return string +extractIndexer((_b = {}, + _b[0 /* x */] = "", + _b)); // Should return string +extractIndexer((_c = {}, + _c["" || 0] = "", + _c)); // Should return any (widened form of undefined) +var _a, _b, _c; diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.js b/tests/baselines/reference/computedPropertyNames4_ES5.js index f5a41bd58aa..ac0fa8ec937 100644 --- a/tests/baselines/reference/computedPropertyNames4_ES5.js +++ b/tests/baselines/reference/computedPropertyNames4_ES5.js @@ -20,16 +20,17 @@ var v = { var s; var n; var a; -var v = { - [s]: 0, - [n]: n, - [s + s]: 1, - [s + n]: 2, - [+s]: s, - [""]: 0, - [0]: 0, - [a]: 1, - [true]: 0, - ["hello bye"]: 0, - ["hello " + a + " bye"]: 0 -}; +var v = (_a = {}, + _a[s] = 0, + _a[n] = n, + _a[s + s] = 1, + _a[s + n] = 2, + _a[+s] = s, + _a[""] = 0, + _a[0] = 0, + _a[a] = 1, + _a[true] = 0, + _a["hello bye"] = 0, + _a["hello " + a + " bye"] = 0, + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames5_ES5.js b/tests/baselines/reference/computedPropertyNames5_ES5.js index 5bdeb8a6637..3367faa2c20 100644 --- a/tests/baselines/reference/computedPropertyNames5_ES5.js +++ b/tests/baselines/reference/computedPropertyNames5_ES5.js @@ -11,11 +11,12 @@ var v = { //// [computedPropertyNames5_ES5.js] var b; -var v = { - [b]: 0, - [true]: 1, - [[]]: 0, - [{}]: 0, - [undefined]: undefined, - [null]: null -}; +var v = (_a = {}, + _a[b] = 0, + _a[true] = 1, + _a[[]] = 0, + _a[{}] = 0, + _a[undefined] = undefined, + _a[null] = null, + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames6_ES5.js b/tests/baselines/reference/computedPropertyNames6_ES5.js index 5772dc9ab89..29d035bfcbf 100644 --- a/tests/baselines/reference/computedPropertyNames6_ES5.js +++ b/tests/baselines/reference/computedPropertyNames6_ES5.js @@ -12,8 +12,9 @@ var v = { var p1; var p2; var p3; -var v = { - [p1]: 0, - [p2]: 1, - [p3]: 2 -}; +var v = (_a = {}, + _a[p1] = 0, + _a[p2] = 1, + _a[p3] = 2, + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames7_ES5.js b/tests/baselines/reference/computedPropertyNames7_ES5.js index 32a0bdc70d1..9c23dcab20d 100644 --- a/tests/baselines/reference/computedPropertyNames7_ES5.js +++ b/tests/baselines/reference/computedPropertyNames7_ES5.js @@ -11,6 +11,7 @@ var E; (function (E) { E[E["member"] = 0] = "member"; })(E || (E = {})); -var v = { - [0 /* member */]: 0 -}; +var v = (_a = {}, + _a[0 /* member */] = 0, + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames8_ES5.js b/tests/baselines/reference/computedPropertyNames8_ES5.js index 8381a681534..82d262c7e4e 100644 --- a/tests/baselines/reference/computedPropertyNames8_ES5.js +++ b/tests/baselines/reference/computedPropertyNames8_ES5.js @@ -12,8 +12,9 @@ function f() { function f() { var t; var u; - var v = { - [t]: 0, - [u]: 1 - }; + var v = (_a = {}, + _a[t] = 0, + _a[u] = 1, + _a); + var _a; } diff --git a/tests/baselines/reference/computedPropertyNames9_ES5.js b/tests/baselines/reference/computedPropertyNames9_ES5.js index e1092d0d3ec..1b4fa16de2d 100644 --- a/tests/baselines/reference/computedPropertyNames9_ES5.js +++ b/tests/baselines/reference/computedPropertyNames9_ES5.js @@ -13,8 +13,9 @@ var v = { //// [computedPropertyNames9_ES5.js] function f(x) { } -var v = { - [f("")]: 0, - [f(0)]: 0, - [f(true)]: 0 -}; +var v = (_a = {}, + _a[f("")] = 0, + _a[f(0)] = 0, + _a[f(true)] = 0, + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js index 0435789b210..d8a33951d4a 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js @@ -9,7 +9,8 @@ var o: I = { } //// [computedPropertyNamesContextualType10_ES5.js] -var o = { - [+"foo"]: "", - [+"bar"]: 0 -}; +var o = (_a = {}, + _a[+"foo"] = "", + _a[+"bar"] = 0, + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js index e58a4dfc86b..e79d8c82df8 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js @@ -10,9 +10,10 @@ var o: I = { } //// [computedPropertyNamesContextualType1_ES5.js] -var o = { - ["" + 0]: function (y) { +var o = (_a = {}, + _a["" + 0] = function (y) { return y.length; }, - ["" + 1]: function (y) { return y.length; } -}; + _a["" + 1] = function (y) { return y.length; }, + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js index d7ebdedddbb..30085fe8366 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js @@ -10,9 +10,10 @@ var o: I = { } //// [computedPropertyNamesContextualType2_ES5.js] -var o = { - [+"foo"]: function (y) { +var o = (_a = {}, + _a[+"foo"] = function (y) { return y.length; }, - [+"bar"]: function (y) { return y.length; } -}; + _a[+"bar"] = function (y) { return y.length; }, + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js index 92a18b720fe..02f8702bd6a 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js @@ -9,9 +9,10 @@ var o: I = { } //// [computedPropertyNamesContextualType3_ES5.js] -var o = { - [+"foo"]: function (y) { +var o = (_a = {}, + _a[+"foo"] = function (y) { return y.length; }, - [+"bar"]: function (y) { return y.length; } -}; + _a[+"bar"] = function (y) { return y.length; }, + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js index 8777f196d7c..0c319a526f4 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js @@ -10,7 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType4_ES5.js] -var o = { - ["" + "foo"]: "", - ["" + "bar"]: 0 -}; +var o = (_a = {}, + _a["" + "foo"] = "", + _a["" + "bar"] = 0, + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js index e1197bddd30..51d78be59d4 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js @@ -10,7 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType5_ES5.js] -var o = { - [+"foo"]: "", - [+"bar"]: 0 -}; +var o = (_a = {}, + _a[+"foo"] = "", + _a[+"bar"] = 0, + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js index 65bc1fd667c..f11e5e4a5bb 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js @@ -14,11 +14,13 @@ foo({ }); //// [computedPropertyNamesContextualType6_ES5.js] -foo({ +foo((_a = { p: "", 0: function () { - }, - ["hi" + "bye"]: true, - [0 + 1]: 0, - [+"hi"]: [0] -}); + } +}, + _a["hi" + "bye"] = true, + _a[0 + 1] = 0, + _a[+"hi"] = [0], + _a)); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js index 2b87d4732ff..0b15794e577 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js @@ -14,11 +14,13 @@ foo({ }); //// [computedPropertyNamesContextualType7_ES5.js] -foo({ +foo((_a = { p: "", 0: function () { - }, - ["hi" + "bye"]: true, - [0 + 1]: 0, - [+"hi"]: [0] -}); + } +}, + _a["hi" + "bye"] = true, + _a[0 + 1] = 0, + _a[+"hi"] = [0], + _a)); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js index 1729c08fe5b..24f6218864c 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js @@ -10,7 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType8_ES5.js] -var o = { - ["" + "foo"]: "", - ["" + "bar"]: 0 -}; +var o = (_a = {}, + _a["" + "foo"] = "", + _a["" + "bar"] = 0, + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js index 8f57c58804f..340802da2af 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js @@ -10,7 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType9_ES5.js] -var o = { - [+"foo"]: "", - [+"bar"]: 0 -}; +var o = (_a = {}, + _a[+"foo"] = "", + _a[+"bar"] = 0, + _a); +var _a; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js index 9f05669d823..38161f1573e 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js @@ -7,16 +7,25 @@ var v = { } //// [computedPropertyNamesDeclarationEmit5_ES5.js] -var v = { - ["" + ""]: 0, - ["" + ""]: function () { +var v = (_a = {}, + _a["" + ""] = 0, + _a["" + ""] = function () { }, - get ["" + ""]() { - return 0; - }, - set ["" + ""](x) { - } -}; + Object.defineProperty(_a, "" + "", { + get: function () { + return 0; + }, + enumerable: true, + configurable: true, + }), + Object.defineProperty(_a, "" + "", { + set: function (x) { + }, + enumerable: true, + configurable: true, + }), + _a); +var _a; //// [computedPropertyNamesDeclarationEmit5_ES5.d.ts] diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js index 6d11c62050c..972aaf9b52f 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js @@ -6,9 +6,10 @@ var v = { } //// [computedPropertyNamesSourceMap2_ES5.js] -var v = { - ["hello"]: function () { +var v = (_a = {}, + _a["hello"] = function () { debugger; - } -}; + }, + _a); +var _a; //# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map index 9f985290f09..01cb2673516 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map @@ -1,2 +1,2 @@ //// [computedPropertyNamesSourceMap2_ES5.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IACJ,CAAC,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;CACJ,CAAA"} \ No newline at end of file +{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG,CAAR,EAAA;IACI,AADJ,EAAA,CACK,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;IAHL,EAAA,CAIC,CAAA;IAJD,EAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt index ff49e979ae3..b8e1e073b08 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt @@ -8,36 +8,49 @@ sources: computedPropertyNamesSourceMap2_ES5.ts emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.js sourceFile:computedPropertyNamesSourceMap2_ES5.ts ------------------------------------------------------------------- ->>>var v = { +>>>var v = (_a = {}, 1 > 2 >^^^^ 3 > ^ 4 > ^^^ -5 > ^^^^^^^^^^^^^^^^^^^^^-> +5 > ^ +6 > ^^ +7 > ^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 >var 3 > v 4 > = +5 > +6 > 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) 3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) 4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) +5 >Emitted(1, 10) Source(1, 1) + SourceIndex(0) +6 >Emitted(1, 12) Source(1, 1) + SourceIndex(0) --- ->>> ["hello"]: function () { +>>> _a["hello"] = function () { 1->^^^^ -2 > ^ -3 > ^^^^^^^ -4 > ^ -5 > ^^^^^-> -1->{ +2 > +3 > ^^ +4 > ^ +5 > ^^^^^^^ +6 > ^ +7 > ^^^-> +1->var v = { > -2 > [ -3 > "hello" -4 > ] +2 > +3 > +4 > var v = { + > [ +5 > "hello" +6 > ] 1->Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 6) Source(2, 6) + SourceIndex(0) -3 >Emitted(2, 13) Source(2, 13) + SourceIndex(0) -4 >Emitted(2, 14) Source(2, 14) + SourceIndex(0) +2 >Emitted(2, 5) Source(1, 1) + SourceIndex(0) +3 >Emitted(2, 7) Source(1, 1) + SourceIndex(0) +4 >Emitted(2, 8) Source(2, 6) + SourceIndex(0) +5 >Emitted(2, 15) Source(2, 13) + SourceIndex(0) +6 >Emitted(2, 16) Source(2, 14) + SourceIndex(0) --- >>> debugger; 1->^^^^^^^^ @@ -51,23 +64,41 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts 2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0) name (["hello"]) 3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0) name (["hello"]) --- ->>> } +>>> }, 1 >^^^^ 2 > ^ +3 > ^^^^-> 1 > > 2 > } 1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0) name (["hello"]) 2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0) name (["hello"]) --- ->>>}; -1 >^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > - >} -2 > -1 >Emitted(5, 2) Source(5, 2) + SourceIndex(0) -2 >Emitted(5, 3) Source(5, 2) + SourceIndex(0) +>>> _a); +1->^^^^ +2 > ^^ +3 > ^ +4 > ^ +1-> +2 > +3 > var v = { + > ["hello"]() { + > debugger; + > } + > } +4 > +1->Emitted(5, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(5, 7) Source(1, 1) + SourceIndex(0) +3 >Emitted(5, 8) Source(5, 2) + SourceIndex(0) +4 >Emitted(5, 9) Source(5, 2) + SourceIndex(0) +--- +>>>var _a; +1 >^^^^ +2 > ^^ +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 > +1 >Emitted(6, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(6, 7) Source(1, 1) + SourceIndex(0) --- >>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName2.js b/tests/baselines/reference/parserES5ComputedPropertyName2.js index 861716a3cde..4569c00d7b3 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName2.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName2.js @@ -2,4 +2,5 @@ var v = { [e]: 1 }; //// [parserES5ComputedPropertyName2.js] -var v = { [e]: 1 }; +var v = (_a = {}, _a[e] = 1, _a); +var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.js b/tests/baselines/reference/parserES5ComputedPropertyName3.js index 4e07049b29d..3f93f226ed4 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName3.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName3.js @@ -2,5 +2,6 @@ var v = { [e]() { } }; //// [parserES5ComputedPropertyName3.js] -var v = { [e]: function () { -} }; +var v = (_a = {}, _a[e] = function () { +}, _a); +var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.js b/tests/baselines/reference/parserES5ComputedPropertyName4.js index 50e240dcf20..b54a53993d6 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName4.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.js @@ -2,5 +2,9 @@ var v = { get [e]() { } }; //// [parserES5ComputedPropertyName4.js] -var v = { get [e]() { -} }; +var v = (_a = {}, Object.defineProperty(_a, e, { + get: function () { + }, + enumerable: true, + configurable: true, }), _a); +var _a; diff --git a/tests/baselines/reference/privateIndexer2.js b/tests/baselines/reference/privateIndexer2.js index 13849216ca0..a90e03a5bc2 100644 --- a/tests/baselines/reference/privateIndexer2.js +++ b/tests/baselines/reference/privateIndexer2.js @@ -11,8 +11,9 @@ var y: { //// [privateIndexer2.js] // private indexers not allowed -var x = { - [x]: string, - string: -}; +var x = (_a = {}, + _a[x] = string, + _a.string = , + _a); var y; +var _a; From c8691a189c7b136ceb3fce83c0ac1acc5ea25b4b Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 5 Feb 2015 13:57:27 -0800 Subject: [PATCH 006/162] Add newline before closing paren in multiline object literals. --- src/compiler/emitter.ts | 77 ++++++++++--------- .../reference/computedPropertyNames10_ES5.js | 3 +- .../reference/computedPropertyNames11_ES5.js | 25 +++--- .../reference/computedPropertyNames18_ES5.js | 3 +- .../reference/computedPropertyNames19_ES5.js | 3 +- .../reference/computedPropertyNames1_ES5.js | 7 +- .../reference/computedPropertyNames20_ES5.js | 3 +- .../reference/computedPropertyNames22_ES5.js | 3 +- .../reference/computedPropertyNames25_ES5.js | 3 +- .../reference/computedPropertyNames28_ES5.js | 3 +- .../reference/computedPropertyNames29_ES5.js | 3 +- .../reference/computedPropertyNames30_ES5.js | 3 +- .../reference/computedPropertyNames31_ES5.js | 3 +- .../reference/computedPropertyNames33_ES5.js | 3 +- .../reference/computedPropertyNames34_ES5.js | 3 +- .../reference/computedPropertyNames46_ES5.js | 3 +- .../reference/computedPropertyNames47_ES5.js | 3 +- .../reference/computedPropertyNames48_ES5.js | 9 ++- .../reference/computedPropertyNames4_ES5.js | 3 +- .../reference/computedPropertyNames5_ES5.js | 3 +- .../reference/computedPropertyNames6_ES5.js | 3 +- .../reference/computedPropertyNames7_ES5.js | 3 +- .../reference/computedPropertyNames8_ES5.js | 3 +- .../reference/computedPropertyNames9_ES5.js | 3 +- ...mputedPropertyNamesContextualType10_ES5.js | 3 +- ...omputedPropertyNamesContextualType1_ES5.js | 3 +- ...omputedPropertyNamesContextualType2_ES5.js | 3 +- ...omputedPropertyNamesContextualType3_ES5.js | 3 +- ...omputedPropertyNamesContextualType4_ES5.js | 3 +- ...omputedPropertyNamesContextualType5_ES5.js | 3 +- ...omputedPropertyNamesContextualType6_ES5.js | 3 +- ...omputedPropertyNamesContextualType7_ES5.js | 3 +- ...omputedPropertyNamesContextualType8_ES5.js | 3 +- ...omputedPropertyNamesContextualType9_ES5.js | 3 +- ...mputedPropertyNamesDeclarationEmit5_ES5.js | 7 +- .../computedPropertyNamesSourceMap2_ES5.js | 3 +- ...computedPropertyNamesSourceMap2_ES5.js.map | 2 +- ...dPropertyNamesSourceMap2_ES5.sourcemap.txt | 35 +++++---- .../parserES5ComputedPropertyName4.js | 3 +- tests/baselines/reference/privateIndexer2.js | 3 +- 40 files changed, 152 insertions(+), 109 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index e6f3a08453e..16eea07ef4e 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -195,7 +195,7 @@ module ts { // } // module m { // /* this is line 1 -- Assume current writer indent 8 - // * line --3 = 8 - 4 + 5 + // * line --3 = 8 - 4 + 5 // More right indented comment */ --4 = 8 - 4 + 11 // class c { } // } @@ -359,8 +359,8 @@ module ts { var aliasDeclarationEmitInfo: AliasDeclarationEmitInfo[] = []; - // Contains the reference paths that needs to go in the declaration file. - // Collecting this separately because reference paths need to be first thing in the declaration file + // Contains the reference paths that needs to go in the declaration file. + // Collecting this separately because reference paths need to be first thing in the declaration file // and we could be collecting these paths from multiple files into single one with --out option var referencePathsOutput = ""; @@ -467,7 +467,7 @@ module ts { // Eg. // export function bar(a: foo.Foo) { } // import foo = require("foo"); - // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, + // Writing of function bar would mark alias declaration foo as visible but we haven't yet visited that declaration so do nothing, // we would write alias foo declaration when we visit it since it would now be marked as visible if (aliasEmitInfo) { createAndSetNewTextWriterWithSymbolWriter(); @@ -608,7 +608,7 @@ module ts { } function emitEntityName(entityName: EntityName) { - var visibilityResult = resolver.isEntityNameVisible(entityName, + var visibilityResult = resolver.isEntityNameVisible(entityName, // Aliases can be written asynchronously so use correct enclosing declaration entityName.parent.kind === SyntaxKind.ImportDeclaration ? entityName.parent : enclosingDeclaration); @@ -692,7 +692,7 @@ module ts { function emitModuleElementDeclarationFlags(node: Node) { // If the node is parented in the current source file we need to emit export declare or just export if (node.parent === currentSourceFile) { - // If the node is exported + // If the node is exported if (node.flags & NodeFlags.Export) { write("export "); } @@ -730,7 +730,7 @@ module ts { } function writeImportDeclaration(node: ImportDeclaration) { - // note usage of writer. methods instead of aliases created, just to make sure we are using + // note usage of writer. methods instead of aliases created, just to make sure we are using // correct writer especially to handle asynchronous alias writing emitJsDocComments(node); if (node.flags & NodeFlags.Export) { @@ -1083,7 +1083,7 @@ module ts { } function emitTypeOfVariableDeclarationFromTypeLiteral(node: VariableLikeDeclaration) { - // if this is property of type literal, + // if this is property of type literal, // or is parameter of method/call/construct/index signature of type literal // emit only if type is specified if (node.type) { @@ -1496,7 +1496,7 @@ module ts { referencePathsOutput += "/// " + newLine; } } - + export function getDeclarationDiagnostics(host: EmitHost, resolver: EmitResolver, targetSourceFile: SourceFile): Diagnostic[] { var diagnostics: Diagnostic[] = []; var jsFilePath = getOwnEmitOutputFilePath(targetSourceFile, host, ".js"); @@ -1557,7 +1557,7 @@ module ts { var emitEnd = function (node: Node) { }; /** Emit the text for the given token that comes after startPos - * This by default writes the text provided with the given tokenKind + * This by default writes the text provided with the given tokenKind * but if optional emitFn callback is provided the text is emitted using the callback instead of default text * @param tokenKind the kind of the token to search and emit * @param startPos the position in the source to start searching for the token @@ -1624,13 +1624,13 @@ module ts { // 1. Relative Column 0 based sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.emittedColumn - prevEncodedEmittedColumn); - // 2. Relative sourceIndex + // 2. Relative sourceIndex sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceIndex - lastEncodedSourceMapSpan.sourceIndex); // 3. Relative sourceLine 0 based sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceLine - lastEncodedSourceMapSpan.sourceLine); - // 4. Relative sourceColumn 0 based + // 4. Relative sourceColumn 0 based sourceMapData.sourceMapMappings += base64VLQFormatEncode(lastRecordedSourceMapSpan.sourceColumn - lastEncodedSourceMapSpan.sourceColumn); // 5. Relative namePosition 0 based @@ -1730,7 +1730,7 @@ module ts { function recordNewSourceFileStart(node: SourceFile) { // Add the file to tsFilePaths - // If sourceroot option: Use the relative path corresponding to the common directory path + // If sourceroot option: Use the relative path corresponding to the common directory path // otherwise source locations relative to map file location var sourcesDirectoryPath = compilerOptions.sourceRoot ? host.getCommonSourceDirectory() : sourceMapDir; @@ -1870,7 +1870,7 @@ module ts { sourceMapDecodedMappings: [] }; - // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the + // Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the // relative paths of the sources list in the sourcemap sourceMapData.sourceMapSourceRoot = ts.normalizeSlashes(sourceMapData.sourceMapSourceRoot); if (sourceMapData.sourceMapSourceRoot.length && sourceMapData.sourceMapSourceRoot.charCodeAt(sourceMapData.sourceMapSourceRoot.length - 1) !== CharacterCodes.slash) { @@ -2186,10 +2186,10 @@ module ts { // All binary expressions have lower precedence than '+' apart from '*', '/', and '%' // which have greater precedence and '-' which has equal precedence. // All unary operators have a higher precedence apart from yield. - // Arrow functions and conditionals have a lower precedence, + // Arrow functions and conditionals have a lower precedence, // although we convert the former into regular function expressions in ES5 mode, // and in ES6 mode this function won't get called anyway. - // + // // TODO (drosen): Note that we need to account for the upcoming 'yield' and // spread ('...') unary operators that are anticipated for ES6. switch (expression.kind) { @@ -2438,29 +2438,29 @@ module ts { write("}"); } - + function emitDownlevelObjectLiteralWithComputedProperties(node: ObjectLiteralExpression, firstComputedPropertyIndex: number) { var multiLine = (node.flags & NodeFlags.MultiLine) !== 0; var properties = node.properties; - + write("("); // For computed properties, we need to create a unique handle to the object // literal so we can modify it without risking internal assignments tainting the object. var tempVar = createTempVariable(node); recordTempDeclaration(tempVar); - + // Write out the first non-computed properties // (or all properties if none of them are computed), // then emit the rest through indexing on the temp variable. emit(tempVar) write(" = "); emitObjectLiteralBody(node, firstComputedPropertyIndex); - + if (multiLine) { increaseIndent(); } - + for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) { writeSeparator(); @@ -2505,7 +2505,7 @@ module ts { writeLine(); write("configurable: true"); decreaseIndent(); - writeSeparator(); + writeLine(); write("})"); emitEnd(property); } @@ -2515,7 +2515,7 @@ module ts { emit(tempVar); emitMemberAccessForPropertyName(property.name); emitEnd(property.name); - + write(" = "); if (property.kind === SyntaxKind.PropertyAssignment) { @@ -2531,19 +2531,20 @@ module ts { Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind); } } - + emitEnd(property); } - + writeSeparator(); emit(tempVar); - - write(")"); if (multiLine) { decreaseIndent(); + writeLine(); } - + + write(")"); + function writeSeparator() { if (multiLine) { write(","); @@ -2706,7 +2707,7 @@ module ts { var operand = (node.expression).expression; // Make sure we consider all nested cast expressions, e.g.: - // (-A).x; + // (-A).x; while (operand.kind == SyntaxKind.TypeAssertionExpression) { operand = (operand).expression; } @@ -2714,7 +2715,7 @@ module ts { // We have an expression of the form: (SubExpr) // Emitting this as (SubExpr) is really not desirable. We would like to emit the subexpr as is. // Omitting the parentheses, however, could cause change in the semantics of the generated - // code if the casted expression has a lower precedence than the rest of the expression, e.g.: + // code if the casted expression has a lower precedence than the rest of the expression, e.g.: // (new A).foo should be emitted as (new A).foo and not new A.foo // (typeof A).toString() should be emitted as (typeof A).toString() and not typeof A.toString() // new (A()) should be emitted as new (A()) and not new A() @@ -3507,7 +3508,7 @@ module ts { emitStart(node.body); write("return "); - // Don't emit comments on this body. We'll have already taken care of it above + // Don't emit comments on this body. We'll have already taken care of it above // when we called emitDetachedComments. emitNode(node.body, /*disableComments:*/ true); emitEnd(node.body); @@ -4207,12 +4208,12 @@ module ts { return false; case SyntaxKind.ModuleDeclaration: - // Only emit the leading/trailing comments for a module if we're actually + // Only emit the leading/trailing comments for a module if we're actually // emitting the module as well. return shouldEmitModuleDeclaration(node); case SyntaxKind.EnumDeclaration: - // Only emit the leading/trailing comments for an enum if we're actually + // Only emit the leading/trailing comments for an enum if we're actually // emitting the module as well. return shouldEmitEnumDeclaration(node); } @@ -4436,7 +4437,7 @@ module ts { } emitNewLineBeforeLeadingComments(currentSourceFile, writer, { pos: pos, end: pos }, leadingComments); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space - emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); + emitComments(currentSourceFile, writer, leadingComments, /*trailingSeparator*/ true, newLine, writeComment); } function emitDetachedCommentsAtPosition(node: TextRange) { @@ -4452,7 +4453,7 @@ module ts { if (commentLine >= lastCommentLine + 2) { // There was a blank line between the last comment and this comment. This - // comment is not part of the copyright comments. Return what we have so + // comment is not part of the copyright comments. Return what we have so // far. return detachedComments; } @@ -4491,7 +4492,7 @@ module ts { if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { return currentSourceFile.text.charCodeAt(comment.pos + 2) === CharacterCodes.exclamation; } - // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text + // Verify this is /// comment, but do the regexp match only when we first can find /// in the comment text // so that we don't end up computing comment string and doing match for all // comments else if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.slash && comment.pos + 2 < comment.end && @@ -4527,7 +4528,7 @@ module ts { function writeDeclarationFile(jsFilePath: string, sourceFile: SourceFile) { var emitDeclarationResult = emitDeclarations(host, resolver, diagnostics, jsFilePath, sourceFile); - // TODO(shkamat): Should we not write any declaration file if any of them can produce error, + // TODO(shkamat): Should we not write any declaration file if any of them can produce error, // or should we just not write this file like we are doing now if (!emitDeclarationResult.reportedDeclarationError) { var declarationOutput = emitDeclarationResult.referencePathsOutput; @@ -4587,7 +4588,7 @@ module ts { emitFile(compilerOptions.out); } } - + function emitFile(jsFilePath: string, sourceFile?: SourceFile) { if (!isEmitBlocked) { emitJavaScript(jsFilePath, sourceFile); diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.js b/tests/baselines/reference/computedPropertyNames10_ES5.js index 5d8ff398d6c..808fc46d8d7 100644 --- a/tests/baselines/reference/computedPropertyNames10_ES5.js +++ b/tests/baselines/reference/computedPropertyNames10_ES5.js @@ -43,5 +43,6 @@ var v = (_a = {}, }, _a["hello " + a + " bye"] = function () { }, - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.js b/tests/baselines/reference/computedPropertyNames11_ES5.js index 7005e392748..548b25d31d4 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES5.js +++ b/tests/baselines/reference/computedPropertyNames11_ES5.js @@ -26,72 +26,73 @@ var v = (_a = {}, return 0; }, enumerable: true, - configurable: true, + configurable: true }), Object.defineProperty(_a, n, { set: function (v) { }, enumerable: true, - configurable: true, + configurable: true }), Object.defineProperty(_a, s + s, { get: function () { return 0; }, enumerable: true, - configurable: true, + configurable: true }), Object.defineProperty(_a, s + n, { set: function (v) { }, enumerable: true, - configurable: true, + configurable: true }), Object.defineProperty(_a, +s, { get: function () { return 0; }, enumerable: true, - configurable: true, + configurable: true }), Object.defineProperty(_a, "", { set: function (v) { }, enumerable: true, - configurable: true, + configurable: true }), Object.defineProperty(_a, 0, { get: function () { return 0; }, enumerable: true, - configurable: true, + configurable: true }), Object.defineProperty(_a, a, { set: function (v) { }, enumerable: true, - configurable: true, + configurable: true }), Object.defineProperty(_a, true, { get: function () { return 0; }, enumerable: true, - configurable: true, + configurable: true }), Object.defineProperty(_a, "hello bye", { set: function (v) { }, enumerable: true, - configurable: true, + configurable: true }), Object.defineProperty(_a, "hello " + a + " bye", { get: function () { return 0; }, enumerable: true, - configurable: true, + configurable: true }), - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNames18_ES5.js b/tests/baselines/reference/computedPropertyNames18_ES5.js index a62af506531..b65c7fd4f7d 100644 --- a/tests/baselines/reference/computedPropertyNames18_ES5.js +++ b/tests/baselines/reference/computedPropertyNames18_ES5.js @@ -9,6 +9,7 @@ function foo() { function foo() { var obj = (_a = {}, _a[this.bar] = 0, - _a); + _a + ); var _a; } diff --git a/tests/baselines/reference/computedPropertyNames19_ES5.js b/tests/baselines/reference/computedPropertyNames19_ES5.js index bda3e01bbed..36f3e66c7c2 100644 --- a/tests/baselines/reference/computedPropertyNames19_ES5.js +++ b/tests/baselines/reference/computedPropertyNames19_ES5.js @@ -10,6 +10,7 @@ var M; (function (M) { var obj = (_a = {}, _a[this.bar] = 0, - _a); + _a + ); var _a; })(M || (M = {})); diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.js b/tests/baselines/reference/computedPropertyNames1_ES5.js index 5e630a5b81d..c3e7f8aa8d5 100644 --- a/tests/baselines/reference/computedPropertyNames1_ES5.js +++ b/tests/baselines/reference/computedPropertyNames1_ES5.js @@ -11,14 +11,15 @@ var v = (_a = {}, return 0; }, enumerable: true, - configurable: true, + configurable: true }), Object.defineProperty(_a, 0 + 1, { set: function (v) { } //No error , enumerable: true, - configurable: true, + configurable: true }), - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNames20_ES5.js b/tests/baselines/reference/computedPropertyNames20_ES5.js index 1eec0a7bcdb..65acd7fa08f 100644 --- a/tests/baselines/reference/computedPropertyNames20_ES5.js +++ b/tests/baselines/reference/computedPropertyNames20_ES5.js @@ -6,5 +6,6 @@ var obj = { //// [computedPropertyNames20_ES5.js] var obj = (_a = {}, _a[this.bar] = 0, - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.js b/tests/baselines/reference/computedPropertyNames22_ES5.js index b28e0ea68e2..67edf62dfd7 100644 --- a/tests/baselines/reference/computedPropertyNames22_ES5.js +++ b/tests/baselines/reference/computedPropertyNames22_ES5.js @@ -16,7 +16,8 @@ var C = (function () { var obj = (_a = {}, _a[this.bar()] = function () { }, - _a); + _a + ); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js index 4bcf877c571..f6a5ce2a9ce 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.js +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -37,7 +37,8 @@ var C = (function (_super) { var obj = (_a = {}, _a[_super.prototype.bar.call(this)] = function () { }, - _a); + _a + ); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js index 418252784a2..1ff9ac7e65e 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES5.js +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -29,7 +29,8 @@ var C = (function (_super) { var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, - _a); + _a + ); var _a; } return C; diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.js b/tests/baselines/reference/computedPropertyNames29_ES5.js index 93a80128d98..bcc32205b80 100644 --- a/tests/baselines/reference/computedPropertyNames29_ES5.js +++ b/tests/baselines/reference/computedPropertyNames29_ES5.js @@ -20,7 +20,8 @@ var C = (function () { var obj = (_a = {}, _a[_this.bar()] = function () { }, - _a); + _a + ); var _a; }); return 0; diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js index 30d314f1f6a..7a88d43263a 100644 --- a/tests/baselines/reference/computedPropertyNames30_ES5.js +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -38,7 +38,8 @@ var C = (function (_super) { //treatment of other similar violations. _a[(_super.call(this), "prop")] = function () { }, - _a); + _a + ); var _a; }); } diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js index a079b3fa449..9c0c888b3bf 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.js +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -41,7 +41,8 @@ var C = (function (_super) { var obj = (_a = {}, _a[_super.prototype.bar.call(_this)] = function () { }, - _a); + _a + ); var _a; }); return 0; diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.js b/tests/baselines/reference/computedPropertyNames33_ES5.js index 24362351196..9768383f320 100644 --- a/tests/baselines/reference/computedPropertyNames33_ES5.js +++ b/tests/baselines/reference/computedPropertyNames33_ES5.js @@ -20,7 +20,8 @@ var C = (function () { var obj = (_a = {}, _a[foo()] = function () { }, - _a); + _a + ); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames34_ES5.js b/tests/baselines/reference/computedPropertyNames34_ES5.js index 83e757222b0..be1a06b81d1 100644 --- a/tests/baselines/reference/computedPropertyNames34_ES5.js +++ b/tests/baselines/reference/computedPropertyNames34_ES5.js @@ -20,7 +20,8 @@ var C = (function () { var obj = (_a = {}, _a[foo()] = function () { }, - _a); + _a + ); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames46_ES5.js b/tests/baselines/reference/computedPropertyNames46_ES5.js index 815f5769f3b..307dadcbe91 100644 --- a/tests/baselines/reference/computedPropertyNames46_ES5.js +++ b/tests/baselines/reference/computedPropertyNames46_ES5.js @@ -6,5 +6,6 @@ var o = { //// [computedPropertyNames46_ES5.js] var o = (_a = {}, _a["" || 0] = 0, - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNames47_ES5.js b/tests/baselines/reference/computedPropertyNames47_ES5.js index 7d839e16ffb..6ba31fe3b06 100644 --- a/tests/baselines/reference/computedPropertyNames47_ES5.js +++ b/tests/baselines/reference/computedPropertyNames47_ES5.js @@ -16,5 +16,6 @@ var E2; })(E2 || (E2 = {})); var o = (_a = {}, _a[0 /* x */ || 0 /* x */] = 0, - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.js b/tests/baselines/reference/computedPropertyNames48_ES5.js index c5ca0d5b241..859fb7a179c 100644 --- a/tests/baselines/reference/computedPropertyNames48_ES5.js +++ b/tests/baselines/reference/computedPropertyNames48_ES5.js @@ -25,11 +25,14 @@ var E; var a; extractIndexer((_a = {}, _a[a] = "", - _a)); // Should return string + _a +)); // Should return string extractIndexer((_b = {}, _b[0 /* x */] = "", - _b)); // Should return string + _b +)); // Should return string extractIndexer((_c = {}, _c["" || 0] = "", - _c)); // Should return any (widened form of undefined) + _c +)); // Should return any (widened form of undefined) var _a, _b, _c; diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.js b/tests/baselines/reference/computedPropertyNames4_ES5.js index ac0fa8ec937..f91476c79c1 100644 --- a/tests/baselines/reference/computedPropertyNames4_ES5.js +++ b/tests/baselines/reference/computedPropertyNames4_ES5.js @@ -32,5 +32,6 @@ var v = (_a = {}, _a[true] = 0, _a["hello bye"] = 0, _a["hello " + a + " bye"] = 0, - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNames5_ES5.js b/tests/baselines/reference/computedPropertyNames5_ES5.js index 3367faa2c20..58c5af2efa3 100644 --- a/tests/baselines/reference/computedPropertyNames5_ES5.js +++ b/tests/baselines/reference/computedPropertyNames5_ES5.js @@ -18,5 +18,6 @@ var v = (_a = {}, _a[{}] = 0, _a[undefined] = undefined, _a[null] = null, - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNames6_ES5.js b/tests/baselines/reference/computedPropertyNames6_ES5.js index 29d035bfcbf..7e9c6202940 100644 --- a/tests/baselines/reference/computedPropertyNames6_ES5.js +++ b/tests/baselines/reference/computedPropertyNames6_ES5.js @@ -16,5 +16,6 @@ var v = (_a = {}, _a[p1] = 0, _a[p2] = 1, _a[p3] = 2, - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNames7_ES5.js b/tests/baselines/reference/computedPropertyNames7_ES5.js index 9c23dcab20d..886cd8d85eb 100644 --- a/tests/baselines/reference/computedPropertyNames7_ES5.js +++ b/tests/baselines/reference/computedPropertyNames7_ES5.js @@ -13,5 +13,6 @@ var E; })(E || (E = {})); var v = (_a = {}, _a[0 /* member */] = 0, - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNames8_ES5.js b/tests/baselines/reference/computedPropertyNames8_ES5.js index 82d262c7e4e..6eceee81adb 100644 --- a/tests/baselines/reference/computedPropertyNames8_ES5.js +++ b/tests/baselines/reference/computedPropertyNames8_ES5.js @@ -15,6 +15,7 @@ function f() { var v = (_a = {}, _a[t] = 0, _a[u] = 1, - _a); + _a + ); var _a; } diff --git a/tests/baselines/reference/computedPropertyNames9_ES5.js b/tests/baselines/reference/computedPropertyNames9_ES5.js index 1b4fa16de2d..705948f8613 100644 --- a/tests/baselines/reference/computedPropertyNames9_ES5.js +++ b/tests/baselines/reference/computedPropertyNames9_ES5.js @@ -17,5 +17,6 @@ var v = (_a = {}, _a[f("")] = 0, _a[f(0)] = 0, _a[f(true)] = 0, - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js index d8a33951d4a..1f7a3ae123e 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js @@ -12,5 +12,6 @@ var o: I = { var o = (_a = {}, _a[+"foo"] = "", _a[+"bar"] = 0, - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js index e79d8c82df8..844e498bdf6 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js @@ -15,5 +15,6 @@ var o = (_a = {}, return y.length; }, _a["" + 1] = function (y) { return y.length; }, - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js index 30085fe8366..b047b4ad1ba 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js @@ -15,5 +15,6 @@ var o = (_a = {}, return y.length; }, _a[+"bar"] = function (y) { return y.length; }, - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js index 02f8702bd6a..7083d7d52e7 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js @@ -14,5 +14,6 @@ var o = (_a = {}, return y.length; }, _a[+"bar"] = function (y) { return y.length; }, - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js index 0c319a526f4..b17f91be38b 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js @@ -13,5 +13,6 @@ var o: I = { var o = (_a = {}, _a["" + "foo"] = "", _a["" + "bar"] = 0, - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js index 51d78be59d4..c7a728e5ef8 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js @@ -13,5 +13,6 @@ var o: I = { var o = (_a = {}, _a[+"foo"] = "", _a[+"bar"] = 0, - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js index f11e5e4a5bb..eb2926b832d 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js @@ -22,5 +22,6 @@ foo((_a = { _a["hi" + "bye"] = true, _a[0 + 1] = 0, _a[+"hi"] = [0], - _a)); + _a +)); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js index 0b15794e577..7461de7537d 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js @@ -22,5 +22,6 @@ foo((_a = { _a["hi" + "bye"] = true, _a[0 + 1] = 0, _a[+"hi"] = [0], - _a)); + _a +)); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js index 24f6218864c..419ea906550 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js @@ -13,5 +13,6 @@ var o: I = { var o = (_a = {}, _a["" + "foo"] = "", _a["" + "bar"] = 0, - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js index 340802da2af..d3beb8b8deb 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js @@ -13,5 +13,6 @@ var o: I = { var o = (_a = {}, _a[+"foo"] = "", _a[+"bar"] = 0, - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js index 38161f1573e..82f8e41ff26 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js @@ -16,15 +16,16 @@ var v = (_a = {}, return 0; }, enumerable: true, - configurable: true, + configurable: true }), Object.defineProperty(_a, "" + "", { set: function (x) { }, enumerable: true, - configurable: true, + configurable: true }), - _a); + _a +); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js index 972aaf9b52f..39e393c46cc 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js @@ -10,6 +10,7 @@ var v = (_a = {}, _a["hello"] = function () { debugger; }, - _a); + _a +); var _a; //# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map index 01cb2673516..2d9d4ea3088 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map @@ -1,2 +1,2 @@ //// [computedPropertyNamesSourceMap2_ES5.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG,CAAR,EAAA;IACI,AADJ,EAAA,CACK,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;IAHL,EAAA,CAIC,CAAA;IAJD,EAAA"} \ No newline at end of file +{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG,CAAR,EAAA;IACI,AADJ,EAAA,CACK,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;IAHL,EAAA;CAIC,CAAA;IAJD,EAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt index b8e1e073b08..4c49c91499b 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt @@ -67,38 +67,41 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts >>> }, 1 >^^^^ 2 > ^ -3 > ^^^^-> +3 > ^^-> 1 > > 2 > } 1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0) name (["hello"]) 2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0) name (["hello"]) --- ->>> _a); +>>> _a 1->^^^^ 2 > ^^ -3 > ^ -4 > ^ 1-> 2 > -3 > var v = { - > ["hello"]() { - > debugger; - > } - > } -4 > 1->Emitted(5, 5) Source(1, 1) + SourceIndex(0) 2 >Emitted(5, 7) Source(1, 1) + SourceIndex(0) -3 >Emitted(5, 8) Source(5, 2) + SourceIndex(0) -4 >Emitted(5, 9) Source(5, 2) + SourceIndex(0) +--- +>>>); +1 >^ +2 > ^ +3 > ^^^^^^-> +1 >var v = { + > ["hello"]() { + > debugger; + > } + >} +2 > +1 >Emitted(6, 2) Source(5, 2) + SourceIndex(0) +2 >Emitted(6, 3) Source(5, 2) + SourceIndex(0) --- >>>var _a; -1 >^^^^ +1->^^^^ 2 > ^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > +1-> 2 > -1 >Emitted(6, 5) Source(1, 1) + SourceIndex(0) -2 >Emitted(6, 7) Source(1, 1) + SourceIndex(0) +1->Emitted(7, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(7, 7) Source(1, 1) + SourceIndex(0) --- >>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.js b/tests/baselines/reference/parserES5ComputedPropertyName4.js index b54a53993d6..dfa3473f29e 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName4.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.js @@ -6,5 +6,6 @@ var v = (_a = {}, Object.defineProperty(_a, e, { get: function () { }, enumerable: true, - configurable: true, }), _a); + configurable: true +}), _a); var _a; diff --git a/tests/baselines/reference/privateIndexer2.js b/tests/baselines/reference/privateIndexer2.js index a90e03a5bc2..1268c6e4c25 100644 --- a/tests/baselines/reference/privateIndexer2.js +++ b/tests/baselines/reference/privateIndexer2.js @@ -14,6 +14,7 @@ var y: { var x = (_a = {}, _a[x] = string, _a.string = , - _a); + _a +); var y; var _a; From 11aa4d362b8eedab365b52d4f17353d6fd8aa798 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 6 Feb 2015 19:53:52 -0800 Subject: [PATCH 007/162] Provide specialized functions for emitting the body of a function depending on if that body is an expression or a block. --- src/compiler/emitter.ts | 148 ++++++++++-------- .../FunctionPropertyAssignments4_es6.js | 3 +- .../reference/accessorWithoutBody1.js | 3 +- .../reference/accessorWithoutBody2.js | 3 +- .../commentOnSimpleArrowFunctionBody1.js | 5 +- .../genericsAndHigherOrderFunctions.js | 12 +- tests/baselines/reference/giant.js | 108 +++++-------- tests/baselines/reference/lambdaASIEmit.js | 5 +- .../objectLiteralMemberWithoutBlock1.js | 3 +- ...eferencedInFunctionInsideArrowFunction1.js | 8 +- 10 files changed, 143 insertions(+), 155 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 5acaf560273..9b409a7e237 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3404,77 +3404,14 @@ module ts { emitSignatureParameters(node); } - if (isSingleLineBlock(node.body)) { + if (isSingleLineBlock(node.body) || !node.body) { write(" { }"); } + else if (node.body.kind === SyntaxKind.Block) { + emitBlockFunctionBody(node, node.body); + } else { - write(" {"); - scopeEmitStart(node); - - if (!node.body) { - writeLine(); - write("}"); - } - else { - increaseIndent(); - - emitDetachedComments(node.body.kind === SyntaxKind.Block ? (node.body).statements : node.body); - - var startIndex = 0; - if (node.body.kind === SyntaxKind.Block) { - startIndex = emitDirectivePrologues((node.body).statements, /*startWithNewLine*/ true); - } - var outPos = writer.getTextPos(); - - emitCaptureThisForNodeIfNecessary(node); - emitDefaultValueAssignments(node); - emitRestParameter(node); - if (node.body.kind !== SyntaxKind.Block && outPos === writer.getTextPos()) { - decreaseIndent(); - write(" "); - emitStart(node.body); - write("return "); - - // Don't emit comments on this body. We'll have already taken care of it above - // when we called emitDetachedComments. - emitNode(node.body, /*disableComments:*/ true); - emitEnd(node.body); - write(";"); - emitTempDeclarations(/*newLine*/ false); - write(" "); - emitStart(node.body); - write("}"); - emitEnd(node.body); - } - else { - if (node.body.kind === SyntaxKind.Block) { - emitLinesStartingAt((node.body).statements, startIndex); - } - else { - writeLine(); - emitLeadingComments(node.body); - write("return "); - emit(node.body, /*disableComments:*/ true); - write(";"); - emitTrailingComments(node.body); - } - emitTempDeclarations(/*newLine*/ true); - writeLine(); - if (node.body.kind === SyntaxKind.Block) { - emitLeadingCommentsOfPosition((node.body).statements.end); - decreaseIndent(); - emitToken(SyntaxKind.CloseBraceToken, (node.body).statements.end); - } - else { - decreaseIndent(); - emitStart(node.body); - write("}"); - emitEnd(node.body); - } - } - } - - scopeEmitEnd(); + emitExpressionFunctionBody(node, node.body); } if (node.flags & NodeFlags.Export) { @@ -3486,11 +3423,86 @@ module ts { emitEnd(node); write(";"); } + tempCount = saveTempCount; tempVariables = saveTempVariables; tempParameters = saveTempParameters; } + // Returns true if any preamble code was emitted. + function emitFunctionBodyPreamble(node: FunctionLikeDeclaration): void { + emitCaptureThisForNodeIfNecessary(node); + emitDefaultValueAssignments(node); + emitRestParameter(node); + } + + function emitExpressionFunctionBody(node: FunctionLikeDeclaration, body: Expression) { + write(" {"); + scopeEmitStart(node); + + increaseIndent(); + var outPos = writer.getTextPos(); + emitDetachedComments(node.body); + emitFunctionBodyPreamble(node); + var preambleEmitted = writer.getTextPos() !== outPos; + decreaseIndent(); + + // If we didn't have to emit any preamble code, then attempt to keep the arrow + // function on one line. + if (!preambleEmitted && isOnSameLine(node, body)) { + write(" "); + emitStart(body); + write("return "); + + // Don't emit comments on this body. We'll have already taken care of it above + // when we called emitDetachedComments. + emitNode(body, /*disableComments:*/ true); + emitEnd(body); + write(";"); + emitTempDeclarations(/*newLine*/ false); + write(" "); + } + else { + increaseIndent(); + writeLine(); + emitLeadingComments(node.body); + write("return "); + emit(node.body, /*disableComments:*/ true); + write(";"); + emitTrailingComments(node.body); + + emitTempDeclarations(/*newLine*/ true); + decreaseIndent(); + writeLine(); + } + + emitStart(node.body); + write("}"); + emitEnd(node.body); + + scopeEmitEnd(); + } + + function emitBlockFunctionBody(node: FunctionLikeDeclaration, body: Block) { + write(" {"); + scopeEmitStart(node); + + increaseIndent(); + emitDetachedComments(body.statements); + var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); + + emitFunctionBodyPreamble(node); + emitLinesStartingAt(body.statements, startIndex); + emitTempDeclarations(/*newLine*/ true); + + writeLine(); + emitLeadingCommentsOfPosition(body.statements.end); + decreaseIndent(); + emitToken(SyntaxKind.CloseBraceToken, body.statements.end); + + scopeEmitEnd(); + } + function findInitialSuperCall(ctor: ConstructorDeclaration): ExpressionStatement { if (ctor.body) { var statement = (ctor.body).statements[0]; diff --git a/tests/baselines/reference/FunctionPropertyAssignments4_es6.js b/tests/baselines/reference/FunctionPropertyAssignments4_es6.js index 595f7fc9124..71076523414 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments4_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments4_es6.js @@ -2,5 +2,4 @@ var v = { * } //// [FunctionPropertyAssignments4_es6.js] -var v = { : function () { -} }; +var v = { : function () { } }; diff --git a/tests/baselines/reference/accessorWithoutBody1.js b/tests/baselines/reference/accessorWithoutBody1.js index 37f0ecbcfee..e06e305e161 100644 --- a/tests/baselines/reference/accessorWithoutBody1.js +++ b/tests/baselines/reference/accessorWithoutBody1.js @@ -2,5 +2,4 @@ var v = { get foo() } //// [accessorWithoutBody1.js] -var v = { get foo() { -} }; +var v = { get foo() { } }; diff --git a/tests/baselines/reference/accessorWithoutBody2.js b/tests/baselines/reference/accessorWithoutBody2.js index 9dc34c1e744..3b5a821d580 100644 --- a/tests/baselines/reference/accessorWithoutBody2.js +++ b/tests/baselines/reference/accessorWithoutBody2.js @@ -2,5 +2,4 @@ var v = { set foo(a) } //// [accessorWithoutBody2.js] -var v = { set foo(a) { -} }; +var v = { set foo(a) { } }; diff --git a/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.js b/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.js index dc9bac84fa5..39f967555bf 100644 --- a/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.js +++ b/tests/baselines/reference/commentOnSimpleArrowFunctionBody1.js @@ -11,4 +11,7 @@ Foo(() => //// [commentOnSimpleArrowFunctionBody1.js] function Foo(x) { } -Foo(function () { return 127; }); +Foo(function () { + // do something + return 127; +}); diff --git a/tests/baselines/reference/genericsAndHigherOrderFunctions.js b/tests/baselines/reference/genericsAndHigherOrderFunctions.js index 1086bd78c54..f2e6ef58f22 100644 --- a/tests/baselines/reference/genericsAndHigherOrderFunctions.js +++ b/tests/baselines/reference/genericsAndHigherOrderFunctions.js @@ -19,5 +19,13 @@ var foo: (g: (x: K) => N) => //// [genericsAndHigherOrderFunctions.js] // no errors expected -var combine = function (f) { return function (g) { return function (x) { return f(g(x)); }; }; }; -var foo = function (g) { return function (h) { return function (f) { return h(combine(f)(g)); }; }; }; +var combine = function (f) { + return function (g) { + return function (x) { return f(g(x)); }; + }; +}; +var foo = function (g) { + return function (h) { + return function (f) { return h(combine(f)(g)); }; + }; +}; diff --git a/tests/baselines/reference/giant.js b/tests/baselines/reference/giant.js index 7f2c2453b0f..a5109b6e113 100644 --- a/tests/baselines/reference/giant.js +++ b/tests/baselines/reference/giant.js @@ -706,44 +706,38 @@ define(["require", "exports"], function (require, exports) { C.prototype.rF = function () { }; C.prototype.pgF = function () { }; Object.defineProperty(C.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.psF = function (param) { }; Object.defineProperty(C.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.prototype.rgF = function () { }; Object.defineProperty(C.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.rsF = function (param) { }; Object.defineProperty(C.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tF = function () { }; C.tsF = function (param) { }; Object.defineProperty(C, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tgF = function () { }; Object.defineProperty(C, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -761,44 +755,38 @@ define(["require", "exports"], function (require, exports) { C.prototype.rF = function () { }; C.prototype.pgF = function () { }; Object.defineProperty(C.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.psF = function (param) { }; Object.defineProperty(C.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.prototype.rgF = function () { }; Object.defineProperty(C.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.rsF = function (param) { }; Object.defineProperty(C.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tF = function () { }; C.tsF = function (param) { }; Object.defineProperty(C, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tgF = function () { }; Object.defineProperty(C, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -845,44 +833,38 @@ define(["require", "exports"], function (require, exports) { eC.prototype.rF = function () { }; eC.prototype.pgF = function () { }; Object.defineProperty(eC.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.psF = function (param) { }; Object.defineProperty(eC.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.prototype.rgF = function () { }; Object.defineProperty(eC.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.rsF = function (param) { }; Object.defineProperty(eC.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tF = function () { }; eC.tsF = function (param) { }; Object.defineProperty(eC, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tgF = function () { }; Object.defineProperty(eC, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -932,44 +914,38 @@ define(["require", "exports"], function (require, exports) { eC.prototype.rF = function () { }; eC.prototype.pgF = function () { }; Object.defineProperty(eC.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.psF = function (param) { }; Object.defineProperty(eC.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.prototype.rgF = function () { }; Object.defineProperty(eC.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.rsF = function (param) { }; Object.defineProperty(eC.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tF = function () { }; eC.tsF = function (param) { }; Object.defineProperty(eC, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tgF = function () { }; Object.defineProperty(eC, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -988,44 +964,38 @@ define(["require", "exports"], function (require, exports) { C.prototype.rF = function () { }; C.prototype.pgF = function () { }; Object.defineProperty(C.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.psF = function (param) { }; Object.defineProperty(C.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.prototype.rgF = function () { }; Object.defineProperty(C.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); C.prototype.rsF = function (param) { }; Object.defineProperty(C.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tF = function () { }; C.tsF = function (param) { }; Object.defineProperty(C, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); C.tgF = function () { }; Object.defineProperty(C, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); @@ -1072,44 +1042,38 @@ define(["require", "exports"], function (require, exports) { eC.prototype.rF = function () { }; eC.prototype.pgF = function () { }; Object.defineProperty(eC.prototype, "pgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.psF = function (param) { }; Object.defineProperty(eC.prototype, "psF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.prototype.rgF = function () { }; Object.defineProperty(eC.prototype, "rgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); eC.prototype.rsF = function (param) { }; Object.defineProperty(eC.prototype, "rsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tF = function () { }; eC.tsF = function (param) { }; Object.defineProperty(eC, "tsF", { - set: function (param) { - }, + set: function (param) { }, enumerable: true, configurable: true }); eC.tgF = function () { }; Object.defineProperty(eC, "tgF", { - get: function () { - }, + get: function () { }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/lambdaASIEmit.js b/tests/baselines/reference/lambdaASIEmit.js index 551aa5f93dd..49672b75c7c 100644 --- a/tests/baselines/reference/lambdaASIEmit.js +++ b/tests/baselines/reference/lambdaASIEmit.js @@ -12,4 +12,7 @@ Foo(() => //// [lambdaASIEmit.js] function Foo(x) { } -Foo(function () { return 127; }); +Foo(function () { + // do something + return 127; +}); diff --git a/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js b/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js index 2ad13950b14..d6a8579be04 100644 --- a/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js +++ b/tests/baselines/reference/objectLiteralMemberWithoutBlock1.js @@ -2,5 +2,4 @@ var v = { foo(); } //// [objectLiteralMemberWithoutBlock1.js] -var v = { foo: function () { -} }; +var v = { foo: function () { } }; diff --git a/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js b/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js index d6718a56106..77fdc507887 100644 --- a/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js +++ b/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js @@ -10,7 +10,9 @@ function test() //// [thisReferencedInFunctionInsideArrowFunction1.js] var foo = function (dummy) { }; function test() { - foo(function () { return function () { - return this; - }; }); + foo(function () { + return function () { + return this; + }; + }); } From 0fbbbffde67c50f9f627519a4e7b503cf9e27c97 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 6 Feb 2015 20:03:24 -0800 Subject: [PATCH 008/162] Emit functions on a singline line if they were originally written on a single line. --- src/compiler/emitter.ts | 29 +- tests/baselines/reference/2dArrays.js | 4 +- ...dStaticFunctionUsingClassPrivateStatics.js | 4 +- ...nctionAndExportedFunctionThatShareAName.js | 16 +- ...ionAndNonExportedFunctionThatShareAName.js | 16 +- .../reference/YieldExpression13_es6.js | 4 +- .../reference/YieldExpression17_es6.js | 4 +- .../reference/accessibilityModifiers.js | 28 +- tests/baselines/reference/accessorWithES3.js | 4 +- tests/baselines/reference/accessorWithES5.js | 4 +- .../reference/accessorsNotAllowedInES3.js | 8 +- .../accessors_spec_section-4.5_error-cases.js | 24 +- .../accessors_spec_section-4.5_inference.js | 24 +- .../additionOperatorWithAnyAndEveryType.js | 4 +- ...OperatorWithNullValueAndInvalidOperator.js | 4 +- ...torWithUndefinedValueAndInvalidOperands.js | 4 +- .../reference/aliasUsedAsNameValue.js | 4 +- .../ambientClassOverloadForFunction.js | 4 +- .../reference/ambiguousGenericAssertion1.js | 4 +- .../baselines/reference/ambiguousOverload.js | 8 +- tests/baselines/reference/anonterface.js | 4 +- .../anyInferenceAnonymousFunctions.js | 4 +- .../reference/arrayAssignmentTest1.js | 20 +- .../reference/arrayAssignmentTest2.js | 24 +- .../reference/arrayAssignmentTest4.js | 8 +- .../reference/arrowFunctionContexts.js | 8 +- .../reference/arrowFunctionExpressions.js | 12 +- .../arrowFunctionInConstructorArgument1.js | 4 +- .../reference/arrowFunctionsMissingTokens.js | 24 +- .../reference/assignEveryTypeToAny.js | 8 +- .../assignLambdaToNominalSubtypeOfFunction.js | 4 +- tests/baselines/reference/assignToFn.js | 4 +- .../reference/assignmentCompatBug2.js | 44 +- .../reference/assignmentCompatBug3.js | 8 +- .../reference/assignmentCompatBug5.js | 4 +- .../reference/assignmentCompatForEnums.js | 4 +- .../assignmentCompatWithCallSignatures.js | 16 +- .../assignmentCompatWithCallSignatures2.js | 28 +- ...assignmentCompatWithConstructSignatures.js | 8 +- ...ssignmentCompatWithConstructSignatures2.js | 16 +- .../assignmentCompatWithOverloads.js | 16 +- .../reference/assignmentCompatability24.js | 4 +- .../reference/assignmentLHSIsValue.js | 20 +- .../reference/bestCommonTypeOfTuple.js | 12 +- .../bestCommonTypeReturnStatement.js | 8 +- .../bitwiseNotOperatorWithBooleanType.js | 8 +- .../bitwiseNotOperatorWithNumberType.js | 12 +- .../bitwiseNotOperatorWithStringType.js | 12 +- ...ctionWithIncorrectNumberOfTypeArguments.js | 8 +- ...allGenericFunctionWithZeroTypeArguments.js | 8 +- ...callNonGenericFunctionWithTypeArguments.js | 8 +- tests/baselines/reference/callOverloads1.js | 4 +- tests/baselines/reference/callOverloads2.js | 8 +- ...ureWithoutReturnTypeAnnotationInference.js | 4 +- .../reference/callbacksDontShareTypes.js | 12 +- tests/baselines/reference/castTest.js | 4 +- ...hainedSpecializationToObjectTypeLiteral.js | 4 +- ...sInterfaceThatExtendsClassWithPrivates1.js | 12 +- .../reference/classImplementsClass2.js | 4 +- .../reference/classImplementsClass3.js | 4 +- .../reference/classImplementsClass4.js | 4 +- .../reference/classImplementsClass5.js | 4 +- .../reference/classImplementsClass6.js | 4 +- tests/baselines/reference/classOrder2.js | 4 +- .../reference/classPropertyAsPrivate.js | 8 +- .../reference/classPropertyAsProtected.js | 8 +- .../classPropertyIsPublicByDefault.js | 8 +- .../reference/classSideInheritance1.js | 4 +- ...hOnlyPublicMembersEquivalentToInterface.js | 8 +- ...OnlyPublicMembersEquivalentToInterface2.js | 8 +- .../reference/classWithPrivateProperty.js | 8 +- .../reference/classWithProtectedProperty.js | 8 +- .../reference/classWithPublicProperty.js | 8 +- .../reference/classWithStaticMembers.js | 8 +- .../reference/cloduleWithDuplicateMember1.js | 4 +- .../reference/clodulesDerivedClasses.js | 4 +- ...sionThisExpressionAndLocalVarInFunction.js | 4 +- .../collisionThisExpressionAndParameter.js | 8 +- .../reference/commentOnClassAccessor1.js | 4 +- .../reference/commentOnClassAccessor2.js | 4 +- .../reference/complexClassRelationships.js | 8 +- .../reference/compositeGenericFunction.js | 8 +- .../reference/computedPropertyNames1.js | 4 +- .../reference/computedPropertyNames11.js | 24 +- .../reference/computedPropertyNames16.js | 24 +- .../reference/computedPropertyNames17.js | 12 +- .../reference/computedPropertyNames32.js | 4 +- .../reference/computedPropertyNames33.js | 4 +- .../reference/computedPropertyNames34.js | 4 +- .../reference/computedPropertyNames35.js | 4 +- .../reference/computedPropertyNames36.js | 4 +- .../reference/computedPropertyNames37.js | 4 +- .../reference/computedPropertyNames38.js | 4 +- .../reference/computedPropertyNames39.js | 4 +- .../reference/computedPropertyNames40.js | 8 +- .../reference/computedPropertyNames41.js | 4 +- .../reference/computedPropertyNames43.js | 4 +- .../reference/computedPropertyNames44.js | 4 +- .../reference/computedPropertyNames45.js | 4 +- .../computedPropertyNamesContextualType1.js | 4 +- .../computedPropertyNamesContextualType2.js | 4 +- .../computedPropertyNamesContextualType3.js | 4 +- .../computedPropertyNamesDeclarationEmit1.js | 4 +- .../computedPropertyNamesDeclarationEmit2.js | 4 +- .../computedPropertyNamesDeclarationEmit5.js | 4 +- .../reference/conditionalExpressions2.js | 12 +- ...onditionalOperatorConditionIsNumberType.js | 4 +- ...onditionalOperatorConditoinIsStringType.js | 4 +- .../constraintSatisfactionWithAny.js | 12 +- .../baselines/reference/constructorAsType.js | 4 +- .../reference/constructorOverloads7.js | 4 +- ...constructorWithIncompleteTypeAnnotation.js | 17 +- ...arameterConstrainedToOuterTypeParameter.js | 4 +- tests/baselines/reference/contextualTyping.js | 114 +- .../reference/contextualTyping.js.map | 2 +- .../reference/contextualTyping.sourcemap.txt | 3280 ++++++++--------- .../baselines/reference/contextualTyping13.js | 4 +- .../baselines/reference/contextualTyping14.js | 4 +- .../baselines/reference/contextualTyping15.js | 4 +- .../baselines/reference/contextualTyping22.js | 8 +- .../baselines/reference/contextualTyping23.js | 4 +- .../baselines/reference/contextualTyping24.js | 4 +- .../baselines/reference/contextualTyping32.js | 6 +- .../baselines/reference/contextualTyping33.js | 6 +- .../baselines/reference/contextualTyping38.js | 4 +- .../baselines/reference/contextualTyping39.js | 4 +- .../baselines/reference/contextualTyping40.js | 4 +- .../baselines/reference/contextualTyping41.js | 4 +- ...lTypingOfGenericFunctionTypedArguments1.js | 8 +- ...ontextualTypingOfLambdaReturnExpression.js | 4 +- ...alTypingOfLambdaWithMultipleSignatures2.js | 4 +- ...TypingWithGenericAndNonGenericSignature.js | 8 +- .../contextualTypingWithGenericSignature.js | 4 +- .../reference/contextuallyTypingOrOperator.js | 12 +- .../contextuallyTypingOrOperator2.js | 4 +- .../couldNotSelectGenericOverload.js | 8 +- tests/baselines/reference/debuggerEmit.js | 4 +- .../reference/declFileGenericType.js | 24 +- .../declFileObjectLiteralWithAccessors.js | 8 +- .../declFileObjectLiteralWithOnlyGetter.js | 4 +- .../declFileObjectLiteralWithOnlySetter.js | 4 +- .../reference/declFilePrivateStatic.js | 8 +- ...RestParametersOfFunctionAndFunctionType.js | 4 +- .../reference/declFileTypeofFunction.js | 8 +- tests/baselines/reference/declInput-2.js | 16 +- tests/baselines/reference/declInput.js | 8 +- tests/baselines/reference/declInput3.js | 8 +- tests/baselines/reference/declInput4.js | 8 +- .../declarationEmit_protectedMembers.js | 12 +- ...OperatorWithNumberTypeInvalidOperations.js | 16 +- ...ementOperatorWithUnsupportedBooleanType.js | 16 +- ...rementOperatorWithUnsupportedStringType.js | 16 +- .../defaultBestCommonTypesHaveDecls.js | 8 +- .../deleteOperatorWithBooleanType.js | 8 +- .../reference/deleteOperatorWithNumberType.js | 12 +- .../reference/deleteOperatorWithStringType.js | 12 +- ...derivedClassConstructorWithoutSuperCall.js | 4 +- .../derivedClassIncludesInheritedMembers.js | 8 +- .../derivedClassOverridesProtectedMembers.js | 16 +- .../derivedClassOverridesProtectedMembers2.js | 16 +- .../derivedClassOverridesProtectedMembers3.js | 16 +- .../derivedClassOverridesPublicMembers.js | 16 +- .../derivedClassSuperCallsWithThisArg.js | 4 +- .../reference/derivedClassWithAny.js | 8 +- ...ivateInstanceShadowingProtectedInstance.js | 8 +- ...hPrivateInstanceShadowingPublicInstance.js | 8 +- ...thPrivateStaticShadowingProtectedStatic.js | 8 +- ...sWithPrivateStaticShadowingPublicStatic.js | 8 +- tests/baselines/reference/derivedClasses.js | 16 +- .../reference/derivedGenericClassWithAny.js | 8 +- .../reference/duplicateLocalVariable1.js | 34 +- .../duplicateObjectLiteralProperty.js | 8 +- .../baselines/reference/emitArrowFunction.js | 4 +- .../reference/emitArrowFunctionES6.js | 4 +- .../reference/errorSuperPropertyAccess.js | 4 +- tests/baselines/reference/errorSupression1.js | 4 +- .../reference/errorsInGenericTypeReference.js | 12 +- tests/baselines/reference/es6ClassTest.js | 8 +- tests/baselines/reference/es6ClassTest2.js | 4 +- tests/baselines/reference/es6ClassTest8.js | 24 +- tests/baselines/reference/es6MemberScoping.js | 4 +- .../everyTypeWithAnnotationAndInitializer.js | 8 +- ...TypeWithAnnotationAndInvalidInitializer.js | 16 +- .../reference/everyTypeWithInitializer.js | 8 +- .../reference/exportAssignmentFunction.js | 4 +- .../reference/exportImportMultipleFiles.js | 4 +- .../baselines/reference/exportPrivateType.js | 4 +- .../reference/fatArrowfunctionAsType.js | 4 +- .../baselines/reference/fatarrowfunctions.js | 50 +- .../reference/fatarrowfunctionsErrors.js | 4 +- .../fatarrowfunctionsOptionalArgs.js | 16 +- .../reference/fieldAndGetterWithSameName.js | 4 +- tests/baselines/reference/for-inStatements.js | 4 +- .../reference/for-inStatementsInvalid.js | 4 +- tests/baselines/reference/forStatements.js | 8 +- .../forStatementsMultipleInvalidDecl.js | 8 +- .../forStatementsMultipleValidDecl.js | 4 +- .../baselines/reference/functionAssignment.js | 4 +- .../reference/functionAssignmentError.js | 8 +- tests/baselines/reference/functionCall1.js | 4 +- tests/baselines/reference/functionCall2.js | 4 +- tests/baselines/reference/functionCall3.js | 4 +- tests/baselines/reference/functionCall4.js | 8 +- tests/baselines/reference/functionCall5.js | 4 +- tests/baselines/reference/functionCall7.js | 4 +- .../functionConstraintSatisfaction.js | 16 +- .../functionConstraintSatisfaction2.js | 8 +- .../functionConstraintSatisfaction3.js | 16 +- .../functionExpressionReturningItself.js | 4 +- .../reference/functionOverloadAmbiguity1.js | 8 +- .../baselines/reference/functionOverloads.js | 4 +- .../baselines/reference/functionOverloads1.js | 4 +- .../reference/functionOverloads11.js | 4 +- .../reference/functionOverloads12.js | 10 +- .../reference/functionOverloads13.js | 4 +- .../reference/functionOverloads14.js | 4 +- .../reference/functionOverloads15.js | 4 +- .../reference/functionOverloads16.js | 4 +- .../reference/functionOverloads17.js | 4 +- .../reference/functionOverloads18.js | 4 +- .../reference/functionOverloads19.js | 4 +- .../baselines/reference/functionOverloads2.js | 4 +- .../reference/functionOverloads20.js | 4 +- .../reference/functionOverloads21.js | 4 +- .../reference/functionOverloads22.js | 4 +- .../reference/functionOverloads23.js | 4 +- .../reference/functionOverloads24.js | 4 +- .../reference/functionOverloads25.js | 4 +- .../reference/functionOverloads26.js | 4 +- .../reference/functionOverloads27.js | 4 +- .../reference/functionOverloads28.js | 4 +- .../reference/functionOverloads29.js | 4 +- .../reference/functionOverloads30.js | 4 +- .../reference/functionOverloads31.js | 4 +- .../reference/functionOverloads32.js | 4 +- .../reference/functionOverloads33.js | 4 +- .../reference/functionOverloads34.js | 4 +- .../reference/functionOverloads35.js | 4 +- .../reference/functionOverloads36.js | 4 +- .../reference/functionOverloads37.js | 4 +- .../reference/functionOverloads38.js | 4 +- .../reference/functionOverloads39.js | 4 +- .../baselines/reference/functionOverloads4.js | 4 +- .../reference/functionOverloads40.js | 4 +- .../reference/functionOverloads41.js | 4 +- .../reference/functionOverloads42.js | 4 +- .../baselines/reference/functionOverloads7.js | 4 +- .../baselines/reference/functionOverloads8.js | 4 +- .../baselines/reference/functionOverloads9.js | 4 +- tests/baselines/reference/functionReturn.js | 4 +- .../reference/generatedContextualTyping.js | 886 +---- .../genericAssignmentCompatWithInterfaces1.js | 4 +- .../genericCallWithFunctionTypedArguments.js | 12 +- .../genericCallWithObjectLiteralArguments1.js | 4 +- ...llWithOverloadedFunctionTypedArguments2.js | 5 +- ...cClassPropertyInheritanceSpecialization.js | 4 +- ...icClassWithFunctionTypedMemberArguments.js | 12 +- ...nericClassWithStaticsUsingTypeArguments.js | 4 +- .../reference/genericCombinators2.js | 8 +- .../reference/genericConstraintDeclaration.js | 4 +- .../baselines/reference/genericFunctions0.js | 4 +- .../baselines/reference/genericFunctions1.js | 4 +- ...genericFunctionsWithOptionalParameters3.js | 20 +- .../reference/genericFunduleInModule.js | 4 +- .../reference/genericFunduleInModule2.js | 4 +- .../baselines/reference/genericImplements.js | 12 +- .../genericLambaArgWithoutTypeArguments.js | 4 +- ...ericMergedDeclarationUsingTypeParameter.js | 4 +- .../reference/genericObjectLitReturnType.js | 4 +- .../reference/genericOfACloduleType1.js | 4 +- .../reference/genericOfACloduleType2.js | 4 +- .../genericParameterAssignability1.js | 4 +- .../reference/genericPrototypeProperty.js | 4 +- .../reference/genericReturnTypeFromGetter1.js | 4 +- .../genericReversingTypeParameters.js | 8 +- .../genericReversingTypeParameters2.js | 8 +- .../reference/genericSpecializations1.js | 12 +- .../reference/genericSpecializations2.js | 12 +- .../reference/genericSpecializations3.js | 16 +- .../reference/genericStaticAnyTypeFunction.js | 4 +- .../reference/genericTypeAssertions3.js | 8 +- .../reference/genericTypeAssertions4.js | 12 +- ...genericTypeReferenceWithoutTypeArgument.js | 15 +- ...enericTypeReferenceWithoutTypeArgument2.js | 15 +- .../genericTypeReferencesRequireTypeArgs.js | 4 +- .../genericWithOpenTypeParameters1.js | 20 +- .../genericsWithDuplicateTypeParameters1.js | 12 +- .../genericsWithoutTypeParameters1.js | 8 +- .../reference/getAndSetAsMemberNames.js | 8 +- .../baselines/reference/getsetReturnTypes.js | 4 +- .../reference/getterSetterNonAccessor.js | 4 +- .../baselines/reference/gettersAndSetters.js | 26 +- .../gettersAndSettersAccessibility.js | 4 +- .../reference/gettersAndSettersErrors.js | 12 +- .../reference/gettersAndSettersTypesAgree.js | 16 +- .../baselines/reference/grammarAmbiguities.js | 8 +- .../reference/grammarAmbiguities1.js | 8 +- .../reference/ifDoWhileStatements.js | 20 +- .../illegalSuperCallsInConstructor.js | 8 +- ...AnyDeclareFunctionExprWithoutFormalType.js | 28 +- .../implicitAnyFromCircularInference.js | 12 +- ...mplicitAnyFunctionReturnNullOrUndefined.js | 24 +- .../implicitAnyGenericTypeInference.js | 4 +- .../reference/implicitAnyGenerics.js | 4 +- ...licitAnyNewExprLackConstructorSignature.js | 4 +- .../baselines/reference/importAsBaseClass.js | 4 +- tests/baselines/reference/importDecl.js | 20 +- .../reference/importedModuleAddToGlobal.js | 4 +- .../reference/inOperatorWithFunction.js | 4 +- .../baselines/reference/incompatibleTypes.js | 4 +- ...OperatorWithNumberTypeInvalidOperations.js | 16 +- ...ementOperatorWithUnsupportedBooleanType.js | 16 +- ...rementOperatorWithUnsupportedStringType.js | 16 +- .../indexSignaturesInferentialTyping.js | 8 +- ...inferentialTypingWithFunctionTypeNested.js | 4 +- tests/baselines/reference/inheritance.js | 16 +- ...nheritedFunctionAssignmentCompatibility.js | 4 +- tests/baselines/reference/innerFunc.js | 8 +- tests/baselines/reference/innerModExport1.js | 12 +- tests/baselines/reference/innerModExport2.js | 12 +- tests/baselines/reference/innerOverloads.js | 4 +- .../instanceAndStaticDeclarations1.js | 4 +- ...nstancePropertiesInheritedIntoClassType.js | 8 +- .../reference/instancePropertyInClassType.js | 8 +- tests/baselines/reference/intTypeCheck.js | 16 +- .../interfaceExtendsClassWithPrivate1.js | 12 +- .../interfaceExtendsClassWithPrivate2.js | 20 +- .../reference/interfaceImplementation5.js | 18 +- .../reference/interfaceImplementation7.js | 4 +- .../baselines/reference/interfaceSubtyping.js | 4 +- .../invalidMultipleVariableDeclarations.js | 8 +- .../reference/invalidReturnStatements.js | 8 +- .../baselines/reference/invalidStaticField.js | 4 +- tests/baselines/reference/ipromise4.js | 6 +- tests/baselines/reference/lift.js | 8 +- .../logicalNotOperatorWithBooleanType.js | 8 +- .../logicalNotOperatorWithNumberType.js | 12 +- .../logicalNotOperatorWithStringType.js | 12 +- tests/baselines/reference/maxConstraints.js | 4 +- tests/baselines/reference/missingSelf.js | 4 +- tests/baselines/reference/modFunctionCrash.js | 4 +- .../reference/moduleReopenedTypeOtherBlock.js | 4 +- .../reference/moduleReopenedTypeSameBlock.js | 4 +- .../reference/moduleSymbolMerging.js | 4 +- .../reference/moduleUnassignedVariable.js | 8 +- .../reference/moduleVisibilityTest1.js | 36 +- .../reference/moduleVisibilityTest2.js | 36 +- .../reference/multiModuleClodule1.js | 4 +- .../reference/multipleInheritance.js | 16 +- tests/baselines/reference/mutrec.js | 8 +- .../mutuallyRecursiveGenericBaseTypes2.js | 4 +- .../nameCollisionsInPropertyAssignments.js | 4 +- .../negateOperatorWithBooleanType.js | 8 +- .../reference/negateOperatorWithNumberType.js | 12 +- .../reference/negateOperatorWithStringType.js | 12 +- tests/baselines/reference/nestedSelf.js | 4 +- .../reference/newOperatorErrorCases.js | 4 +- ...sionThisExpressionAndLocalVarInFunction.js | 4 +- ...nThisExpressionInFunctionAndVarInGlobal.js | 4 +- .../reference/noConstraintInReturnType1.js | 4 +- .../reference/noImplicitAnyWithOverloads.js | 4 +- .../nullIsSubtypeOfEverythingButUndefined.js | 8 +- ...cIndexerConstrainsPropertyDeclarations2.js | 8 +- .../reference/objectLiteralErrors.js | 86 +- .../reference/objectLiteralErrorsES3.js | 8 +- .../objectLiteralGettersAndSetters.js | 86 +- ...ectLiteralShorthandPropertiesAssignment.js | 12 +- ...LiteralShorthandPropertiesAssignmentES6.js | 12 +- ...teralShorthandPropertiesAssignmentError.js | 4 +- ...iesAssignmentErrorFromMissingIdentifier.js | 8 +- ...eHidingMembersOfObjectAssignmentCompat2.js | 4 +- .../objectTypesIdentityWithCallSignatures.js | 16 +- .../objectTypesIdentityWithCallSignatures2.js | 16 +- ...yWithCallSignaturesDifferingParamCounts.js | 16 +- ...IdentityWithCallSignaturesWithOverloads.js | 16 +- ...ctTypesIdentityWithConstructSignatures2.js | 4 +- ...ConstructSignaturesDifferingParamCounts.js | 4 +- ...tTypesIdentityWithGenericCallSignatures.js | 16 +- ...TypesIdentityWithGenericCallSignatures2.js | 16 +- ...ricCallSignaturesDifferingByConstraints.js | 16 +- ...icCallSignaturesDifferingByConstraints2.js | 20 +- ...icCallSignaturesDifferingByConstraints3.js | 20 +- ...ericCallSignaturesDifferingByReturnType.js | 16 +- ...ricCallSignaturesDifferingByReturnType2.js | 16 +- ...lSignaturesDifferingTypeParameterCounts.js | 16 +- ...llSignaturesDifferingTypeParameterNames.js | 16 +- ...WithGenericCallSignaturesOptionalParams.js | 16 +- ...ithGenericCallSignaturesOptionalParams2.js | 16 +- ...ithGenericCallSignaturesOptionalParams3.js | 16 +- ...nstructSignaturesDifferingByConstraints.js | 4 +- ...structSignaturesDifferingByConstraints2.js | 4 +- ...structSignaturesDifferingByConstraints3.js | 4 +- ...onstructSignaturesDifferingByReturnType.js | 4 +- ...nstructSignaturesDifferingByReturnType2.js | 4 +- ...tSignaturesDifferingTypeParameterCounts.js | 4 +- ...ctSignaturesDifferingTypeParameterNames.js | 4 +- ...enericConstructSignaturesOptionalParams.js | 4 +- ...nericConstructSignaturesOptionalParams2.js | 4 +- ...nericConstructSignaturesOptionalParams3.js | 4 +- .../optionalAccessorsInInterface1.js | 8 +- .../optionalFunctionArgAssignability.js | 8 +- .../reference/optionalParamArgsTest.js | 36 +- .../reference/overloadAssignmentCompat.js | 4 +- tests/baselines/reference/overloadCallTest.js | 4 +- .../overloadOnConstNoAnyImplementation2.js | 16 +- .../overloadOnConstNoStringImplementation2.js | 16 +- .../baselines/reference/overloadResolution.js | 16 +- .../overloadResolutionOverNonCTLambdas.js | 12 +- .../reference/overloadResolutionTest1.js | 12 +- ...parameterInitializersForwardReferencing.js | 4 +- .../parametersWithNoAnnotationAreAny.js | 8 +- .../parenthesizedContexualTyping2.js | 88 +- tests/baselines/reference/parseTypes.js | 8 +- .../reference/parser15.4.4.14-9-2.js | 4 +- tests/baselines/reference/parserClass1.js | 20 +- ...ErrorRecovery_IncompleteMemberVariable1.js | 4 +- ...ErrorRecovery_IncompleteMemberVariable2.js | 4 +- .../baselines/reference/parserRealSource1.js | 60 +- .../baselines/reference/parserRealSource11.js | 204 +- .../baselines/reference/parserRealSource14.js | 4 +- .../baselines/reference/parserRealSource4.js | 8 +- .../reference/parserReturnStatement4.js | 4 +- tests/baselines/reference/parserharness.js | 36 +- .../reference/plusOperatorWithBooleanType.js | 8 +- .../reference/plusOperatorWithNumberType.js | 12 +- .../reference/plusOperatorWithStringType.js | 12 +- tests/baselines/reference/primitiveMembers.js | 4 +- ...ivateClassPropertyAccessibleWithinClass.js | 36 +- .../reference/privateInstanceVisibility.js | 4 +- .../baselines/reference/privateVisibility.js | 4 +- tests/baselines/reference/privateVisibles.js | 4 +- ...tyAccessOnTypeParameterWithConstraints2.js | 4 +- ...tyAccessOnTypeParameterWithConstraints3.js | 4 +- ...tyAccessOnTypeParameterWithConstraints5.js | 4 +- tests/baselines/reference/propertyOrdering.js | 4 +- ...ectedClassPropertyAccessibleWithinClass.js | 36 +- ...edClassPropertyAccessibleWithinSubclass.js | 32 +- .../reference/qualifiedModuleLocals.js | 4 +- .../reference/quotedAccessorName1.js | 4 +- .../reference/quotedAccessorName2.js | 4 +- tests/baselines/reference/rectype.js | 4 +- .../reference/recursiveClassReferenceTest.js | 20 +- .../recursiveClassReferenceTest.js.map | 2 +- .../recursiveClassReferenceTest.sourcemap.txt | 980 +++-- .../reference/recursiveFunctionTypes.js | 16 +- .../reference/recursiveGetterAccess.js | 4 +- .../recursiveIdenticalOverloadResolution.js | 4 +- .../reference/recursiveInference1.js | 4 +- .../reference/recursiveInferenceBug.js | 4 +- .../reference/recursiveInheritance3.js | 4 +- .../reference/recursiveProperties.js | 8 +- tests/baselines/reference/recursiveReturns.js | 4 +- .../recursiveTypesUsedAsFunctionParameters.js | 4 +- tests/baselines/reference/redefineArray.js | 4 +- ...lassDeclarationWhenInBaseTypeResolution.js | 2744 ++++---------- tests/baselines/reference/returnStatements.js | 48 +- .../reference/returnTypeParameter.js | 4 +- .../returnTypeParameterWithModules.js | 4 +- .../reference/returnTypeTypeArguments.js | 68 +- ...verseInferenceInContextualInstantiation.js | 4 +- tests/baselines/reference/selfInCallback.js | 8 +- .../reference/sourceMap-FileWithComments.js | 4 +- .../sourceMap-FileWithComments.js.map | 2 +- .../sourceMap-FileWithComments.sourcemap.txt | 334 +- ...specializationsShouldNotAffectEachOther.js | 4 +- .../baselines/reference/specializeVarArgs1.js | 4 +- tests/baselines/reference/staticFactory1.js | 8 +- .../reference/staticGetterAndSetter.js | 4 +- .../reference/staticMemberExportAccess.js | 4 +- ...icMethodsReferencingClassTypeParameters.js | 4 +- .../reference/staticPropertyNotInClassType.js | 16 +- tests/baselines/reference/staticVisibility.js | 8 +- ...gIndexerConstrainsPropertyDeclarations2.js | 8 +- .../stringLiteralTypeIsSubtypeOfString.js | 72 +- .../reference/subtypesOfTypeParameter.js | 8 +- ...subtypesOfTypeParameterWithConstraints2.js | 8 +- .../reference/superCallInNonStaticMethod.js | 4 +- tests/baselines/reference/superErrors.js | 8 +- .../reference/superPropertyAccess.js | 12 +- ...side-object-literal-getters-and-setters.js | 4 +- .../taggedTemplateContextualTyping1.js | 29 +- .../taggedTemplateContextualTyping2.js | 18 +- ...gedTemplateStringsTypeArgumentInference.js | 4 +- ...TemplateStringsTypeArgumentInferenceES6.js | 4 +- ...dTemplateStringsWithOverloadResolution3.js | 16 +- ...plateStringsWithOverloadResolution3_ES6.js | 16 +- ...tionExpressionsInSubstitutionExpression.js | 4 +- ...nExpressionsInSubstitutionExpressionES6.js | 4 +- tests/baselines/reference/targetTypeArgs.js | 28 +- .../reference/targetTypeBaseCalls.js | 12 +- tests/baselines/reference/targetTypeCalls.js | 28 +- .../baselines/reference/targetTypeCastTest.js | 8 +- tests/baselines/reference/targetTypeTest1.js | 4 +- tests/baselines/reference/targetTypeTest2.js | 4 +- tests/baselines/reference/targetTypeTest3.js | 4 +- .../baselines/reference/targetTypeVoidFunc.js | 4 +- .../reference/targetTypingOnFunctions.js | 8 +- ...ateStringWithEmbeddedFunctionExpression.js | 4 +- ...StringWithEmbeddedFunctionExpressionES6.js | 4 +- ...tionExpressionsInSubstitutionExpression.js | 4 +- ...nExpressionsInSubstitutionExpressionES6.js | 4 +- tests/baselines/reference/thisBinding2.js | 4 +- ...essionInCallExpressionWithTypeArguments.js | 4 +- .../thisInPropertyBoundDeclarations.js | 16 +- ...eferencedInFunctionInsideArrowFunction1.js | 4 +- .../reference/throwInEnclosingStatements.js | 4 +- tests/baselines/reference/throwStatements.js | 12 +- ...ArgumentsInGenericFunctionTypedArgument.js | 8 +- tests/baselines/reference/topLevelExports.js | 4 +- tests/baselines/reference/topLevelLambda.js | 4 +- tests/baselines/reference/topLevelLambda3.js | 4 +- .../reference/twoAccessorsWithSameName.js | 4 +- .../reference/twoAccessorsWithSameName2.js | 4 +- .../typeArgumentConstraintResolution1.js | 4 +- .../reference/typeArgumentInference.js | 4 +- .../typeArgumentInferenceOrdering.js | 4 +- ...mentInferenceWithConstraintAsCommonRoot.js | 4 +- .../typeArgumentInferenceWithConstraints.js | 4 +- .../typeAssertionToGenericFunctionType.js | 4 +- tests/baselines/reference/typeInfer1.js | 4 +- tests/baselines/reference/typeMatch2.js | 8 +- .../typeParameterAsTypeParameterConstraint.js | 8 +- ...typeParameterAsTypeParameterConstraint2.js | 8 +- ...erAsTypeParameterConstraintTransitively.js | 8 +- ...rAsTypeParameterConstraintTransitively2.js | 8 +- ...rameterCompatibilityAccrossDeclarations.js | 8 +- .../typeParametersInStaticAccessors.js | 4 +- tests/baselines/reference/typeQueryOnClass.js | 4 +- .../typeofOperatorWithBooleanType.js | 8 +- .../reference/typeofOperatorWithNumberType.js | 12 +- .../reference/typeofOperatorWithStringType.js | 12 +- tests/baselines/reference/underscoreTest1.js | 50 +- .../unexpectedStatementBlockTerminator.js | 4 +- tests/baselines/reference/unknownSymbols2.js | 4 +- ...untypedFunctionCallsWithTypeParameters1.js | 4 +- .../validMultipleVariableDeclarations.js | 4 +- .../reference/voidFunctionAssignmentCompat.js | 42 +- .../reference/voidOperatorWithBooleanType.js | 8 +- .../reference/voidOperatorWithNumberType.js | 12 +- .../reference/voidOperatorWithStringType.js | 12 +- tests/baselines/reference/witness.js | 4 +- 541 files changed, 4412 insertions(+), 9120 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 9b409a7e237..f2b40f589f5 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3487,19 +3487,34 @@ module ts { write(" {"); scopeEmitStart(node); + var outPos = writer.getTextPos(); increaseIndent(); emitDetachedComments(body.statements); var startIndex = emitDirectivePrologues(body.statements, /*startWithNewLine*/ true); - emitFunctionBodyPreamble(node); - emitLinesStartingAt(body.statements, startIndex); - emitTempDeclarations(/*newLine*/ true); - - writeLine(); - emitLeadingCommentsOfPosition(body.statements.end); decreaseIndent(); - emitToken(SyntaxKind.CloseBraceToken, body.statements.end); + var preambleEmitted = writer.getTextPos() !== outPos; + if (!preambleEmitted && nodeEndIsOnSameLineAsNodeStart(body, body)) { + for (var i = 0, n = body.statements.length; i < n; i++) { + write(" "); + emit(body.statements[i]); + } + emitTempDeclarations(/*newLine*/ false); + write(" "); + emitLeadingCommentsOfPosition(body.statements.end); + } + else { + increaseIndent(); + emitLinesStartingAt(body.statements, startIndex); + emitTempDeclarations(/*newLine*/ true); + + writeLine(); + emitLeadingCommentsOfPosition(body.statements.end); + decreaseIndent(); + } + + emitToken(SyntaxKind.CloseBraceToken, body.statements.end); scopeEmitEnd(); } diff --git a/tests/baselines/reference/2dArrays.js b/tests/baselines/reference/2dArrays.js index 7840f3d8c54..fe8ab380ba7 100644 --- a/tests/baselines/reference/2dArrays.js +++ b/tests/baselines/reference/2dArrays.js @@ -30,9 +30,7 @@ var Board = (function () { function Board() { } Board.prototype.allShipsSunk = function () { - return this.ships.every(function (val) { - return val.isSunk; - }); + return this.ships.every(function (val) { return val.isSunk; }); }; return Board; })(); diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js index 827557bdbad..5f01b6acff1 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithModulesExportedStaticFunctionUsingClassPrivateStatics.js @@ -19,9 +19,7 @@ module clodule { var clodule = (function () { function clodule() { } - clodule.sfn = function (id) { - return 42; - }; + clodule.sfn = function (id) { return 42; }; return clodule; })(); var clodule; diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js index ae8d594c2f8..a86bc7d2e90 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndExportedFunctionThatShareAName.js @@ -28,16 +28,12 @@ var Point = (function () { this.x = x; this.y = y; } - Point.Origin = function () { - return { x: 0, y: 0 }; - }; // unexpected error here bug 840246 + Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246 return Point; })(); var Point; (function (Point) { - function Origin() { - return null; - } + function Origin() { return null; } Point.Origin = Origin; //expected duplicate identifier error })(Point || (Point = {})); var A; @@ -47,17 +43,13 @@ var A; this.x = x; this.y = y; } - Point.Origin = function () { - return { x: 0, y: 0 }; - }; // unexpected error here bug 840246 + Point.Origin = function () { return { x: 0, y: 0 }; }; // unexpected error here bug 840246 return Point; })(); A.Point = Point; var Point; (function (Point) { - function Origin() { - return ""; - } + function Origin() { return ""; } Point.Origin = Origin; //expected duplicate identifier error })(Point = A.Point || (A.Point = {})); })(A || (A = {})); diff --git a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js index 5bbe60297cc..f462ea9eaa9 100644 --- a/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js +++ b/tests/baselines/reference/ClassAndModuleThatMergeWithStaticFunctionAndNonExportedFunctionThatShareAName.js @@ -28,16 +28,12 @@ var Point = (function () { this.x = x; this.y = y; } - Point.Origin = function () { - return { x: 0, y: 0 }; - }; + Point.Origin = function () { return { x: 0, y: 0 }; }; return Point; })(); var Point; (function (Point) { - function Origin() { - return ""; - } // not an error, since not exported + function Origin() { return ""; } // not an error, since not exported })(Point || (Point = {})); var A; (function (A) { @@ -46,16 +42,12 @@ var A; this.x = x; this.y = y; } - Point.Origin = function () { - return { x: 0, y: 0 }; - }; + Point.Origin = function () { return { x: 0, y: 0 }; }; return Point; })(); A.Point = Point; var Point; (function (Point) { - function Origin() { - return ""; - } // not an error since not exported + function Origin() { return ""; } // not an error since not exported })(Point = A.Point || (A.Point = {})); })(A || (A = {})); diff --git a/tests/baselines/reference/YieldExpression13_es6.js b/tests/baselines/reference/YieldExpression13_es6.js index 328fc80dbdd..093759e6bd9 100644 --- a/tests/baselines/reference/YieldExpression13_es6.js +++ b/tests/baselines/reference/YieldExpression13_es6.js @@ -2,6 +2,4 @@ function* foo() { yield } //// [YieldExpression13_es6.js] -function foo() { - ; -} +function foo() { ; } diff --git a/tests/baselines/reference/YieldExpression17_es6.js b/tests/baselines/reference/YieldExpression17_es6.js index 6fd39844d80..cefe4ca28df 100644 --- a/tests/baselines/reference/YieldExpression17_es6.js +++ b/tests/baselines/reference/YieldExpression17_es6.js @@ -2,6 +2,4 @@ var v = { get foo() { yield foo; } } //// [YieldExpression17_es6.js] -var v = { get foo() { - ; -} }; +var v = { get foo() { ; } }; diff --git a/tests/baselines/reference/accessibilityModifiers.js b/tests/baselines/reference/accessibilityModifiers.js index af1832d9340..ebc801ac136 100644 --- a/tests/baselines/reference/accessibilityModifiers.js +++ b/tests/baselines/reference/accessibilityModifiers.js @@ -52,9 +52,7 @@ var C = (function () { } C.privateMethod = function () { }; Object.defineProperty(C, "privateGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -65,9 +63,7 @@ var C = (function () { }); C.protectedMethod = function () { }; Object.defineProperty(C, "protectedGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -78,9 +74,7 @@ var C = (function () { }); C.publicMethod = function () { }; Object.defineProperty(C, "publicGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -97,9 +91,7 @@ var D = (function () { } D.privateMethod = function () { }; Object.defineProperty(D, "privateGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -110,9 +102,7 @@ var D = (function () { }); D.protectedMethod = function () { }; Object.defineProperty(D, "protectedGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -123,9 +113,7 @@ var D = (function () { }); D.publicMethod = function () { }; Object.defineProperty(D, "publicGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -142,9 +130,7 @@ var E = (function () { } E.prototype.method = function () { }; Object.defineProperty(E.prototype, "getter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/accessorWithES3.js b/tests/baselines/reference/accessorWithES3.js index 8c0d353b310..1eecaa68d64 100644 --- a/tests/baselines/reference/accessorWithES3.js +++ b/tests/baselines/reference/accessorWithES3.js @@ -47,9 +47,7 @@ var D = (function () { return D; })(); var x = { - get a() { - return 1; - } + get a() { return 1; } }; var y = { set b(v) { } diff --git a/tests/baselines/reference/accessorWithES5.js b/tests/baselines/reference/accessorWithES5.js index d51f5e7713b..746703bce52 100644 --- a/tests/baselines/reference/accessorWithES5.js +++ b/tests/baselines/reference/accessorWithES5.js @@ -44,9 +44,7 @@ var D = (function () { return D; })(); var x = { - get a() { - return 1; - } + get a() { return 1; } }; var y = { set b(v) { } diff --git a/tests/baselines/reference/accessorsNotAllowedInES3.js b/tests/baselines/reference/accessorsNotAllowedInES3.js index 5cb5a5dc47a..0843a39191c 100644 --- a/tests/baselines/reference/accessorsNotAllowedInES3.js +++ b/tests/baselines/reference/accessorsNotAllowedInES3.js @@ -11,14 +11,10 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); return C; })(); -var y = { get foo() { - return 3; -} }; +var y = { get foo() { return 3; } }; diff --git a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js index 11590f6d068..5e527aef3e9 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_error-cases.js @@ -18,38 +18,26 @@ var LanguageSpec_section_4_5_error_cases = (function () { function LanguageSpec_section_4_5_error_cases() { } Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedSetter_SetterFirst", { - get: function () { - return ""; - }, + get: function () { return ""; }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedSetter_SetterLast", { - get: function () { - return ""; - }, + get: function () { return ""; }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedGetter_GetterFirst", { - get: function () { - return ""; - }, - set: function (aStr) { - aStr = 0; - }, + get: function () { return ""; }, + set: function (aStr) { aStr = 0; }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_error_cases.prototype, "AnnotatedGetter_GetterLast", { - get: function () { - return ""; - }, - set: function (aStr) { - aStr = 0; - }, + get: function () { return ""; }, + set: function (aStr) { aStr = 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/accessors_spec_section-4.5_inference.js b/tests/baselines/reference/accessors_spec_section-4.5_inference.js index 6ad452f2a5a..9aa7ce2f408 100644 --- a/tests/baselines/reference/accessors_spec_section-4.5_inference.js +++ b/tests/baselines/reference/accessors_spec_section-4.5_inference.js @@ -47,49 +47,37 @@ var LanguageSpec_section_4_5_inference = (function () { function LanguageSpec_section_4_5_inference() { } Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredGetterFromSetterAnnotation", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredGetterFromSetterAnnotation_GetterFirst", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredFromGetter", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredFromGetter_SetterFirst", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredSetterFromGetterAnnotation", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true }); Object.defineProperty(LanguageSpec_section_4_5_inference.prototype, "InferredSetterFromGetterAnnotation_GetterFirst", { - get: function () { - return new B(); - }, + get: function () { return new B(); }, set: function (a) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js index 49d4ea66ba8..26a77e917d9 100644 --- a/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js +++ b/tests/baselines/reference/additionOperatorWithAnyAndEveryType.js @@ -84,6 +84,4 @@ var r16 = a + M; var r17 = a + ''; var r18 = a + 123; var r19 = a + { a: '' }; -var r20 = a + (function (a) { - return a; -}); +var r20 = a + (function (a) { return a; }); diff --git a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js index 20ac1350ef3..79d3c0b9b8d 100644 --- a/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js +++ b/tests/baselines/reference/additionOperatorWithNullValueAndInvalidOperator.js @@ -25,9 +25,7 @@ var r11 = null + (() => { }); //// [additionOperatorWithNullValueAndInvalidOperator.js] // If one operand is the null or undefined value, it is treated as having the type of the other operand. -function foo() { - return undefined; -} +function foo() { return undefined; } var a; var b; var c; diff --git a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js index 2cf0ce22259..98935db2b86 100644 --- a/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js +++ b/tests/baselines/reference/additionOperatorWithUndefinedValueAndInvalidOperands.js @@ -25,9 +25,7 @@ var r11 = undefined + (() => { }); //// [additionOperatorWithUndefinedValueAndInvalidOperands.js] // If one operand is the null or undefined value, it is treated as having the type of the other operand. -function foo() { - return undefined; -} +function foo() { return undefined; } var a; var b; var c; diff --git a/tests/baselines/reference/aliasUsedAsNameValue.js b/tests/baselines/reference/aliasUsedAsNameValue.js index 4b6debf4c98..fb909181529 100644 --- a/tests/baselines/reference/aliasUsedAsNameValue.js +++ b/tests/baselines/reference/aliasUsedAsNameValue.js @@ -21,9 +21,7 @@ export var a = function () { //// [aliasUsedAsNameValue_0.js] exports.id; //// [aliasUsedAsNameValue_1.js] -function b(a) { - return null; -} +function b(a) { return null; } exports.b = b; //// [aliasUsedAsNameValue_2.js] /// diff --git a/tests/baselines/reference/ambientClassOverloadForFunction.js b/tests/baselines/reference/ambientClassOverloadForFunction.js index cf3a59a465d..402eca63381 100644 --- a/tests/baselines/reference/ambientClassOverloadForFunction.js +++ b/tests/baselines/reference/ambientClassOverloadForFunction.js @@ -5,6 +5,4 @@ function foo() { return null; } //// [ambientClassOverloadForFunction.js] ; -function foo() { - return null; -} +function foo() { return null; } diff --git a/tests/baselines/reference/ambiguousGenericAssertion1.js b/tests/baselines/reference/ambiguousGenericAssertion1.js index 40bbbee6dd2..8d40873036c 100644 --- a/tests/baselines/reference/ambiguousGenericAssertion1.js +++ b/tests/baselines/reference/ambiguousGenericAssertion1.js @@ -6,9 +6,7 @@ var r3 = <(x: T) => T>f; // ambiguous, appears to the parser as a << operatio //// [ambiguousGenericAssertion1.js] -function f(x) { - return null; -} +function f(x) { return null; } var r = function (x) { return x; }; var r2 = f; // valid var r3 = << T > (x), T; diff --git a/tests/baselines/reference/ambiguousOverload.js b/tests/baselines/reference/ambiguousOverload.js index fd373c075a2..642f09dca16 100644 --- a/tests/baselines/reference/ambiguousOverload.js +++ b/tests/baselines/reference/ambiguousOverload.js @@ -12,15 +12,11 @@ var x2: string = foof2("s", null); var y2: number = foof2("s", null); //// [ambiguousOverload.js] -function foof(bar) { - return bar; -} +function foof(bar) { return bar; } ; var x = foof("s", null); var y = foof("s", null); -function foof2(bar) { - return bar; -} +function foof2(bar) { return bar; } ; var x2 = foof2("s", null); var y2 = foof2("s", null); diff --git a/tests/baselines/reference/anonterface.js b/tests/baselines/reference/anonterface.js index 59d055b29d7..12bfbc4ec9d 100644 --- a/tests/baselines/reference/anonterface.js +++ b/tests/baselines/reference/anonterface.js @@ -28,6 +28,4 @@ var M; M.C = C; })(M || (M = {})); var c = new M.C(); -c.m(function (n) { - return "hello: " + n; -}, 18); +c.m(function (n) { return "hello: " + n; }, 18); diff --git a/tests/baselines/reference/anyInferenceAnonymousFunctions.js b/tests/baselines/reference/anyInferenceAnonymousFunctions.js index e232ec29593..df921965994 100644 --- a/tests/baselines/reference/anyInferenceAnonymousFunctions.js +++ b/tests/baselines/reference/anyInferenceAnonymousFunctions.js @@ -27,6 +27,4 @@ paired.reduce(function (b1, b2) { }, []); paired.reduce(function (b3, b4) { return b3.concat({}); }, []); paired.map(function (c1) { return c1.count; }); -paired.map(function (c2) { - return c2.count; -}); +paired.map(function (c2) { return c2.count; }); diff --git a/tests/baselines/reference/arrayAssignmentTest1.js b/tests/baselines/reference/arrayAssignmentTest1.js index 2a82d436596..0abfa889bed 100644 --- a/tests/baselines/reference/arrayAssignmentTest1.js +++ b/tests/baselines/reference/arrayAssignmentTest1.js @@ -95,12 +95,8 @@ var __extends = this.__extends || function (d, b) { var C1 = (function () { function C1() { } - C1.prototype.IM1 = function () { - return null; - }; - C1.prototype.C1M1 = function () { - return null; - }; + C1.prototype.IM1 = function () { return null; }; + C1.prototype.C1M1 = function () { return null; }; return C1; })(); var C2 = (function (_super) { @@ -108,17 +104,13 @@ var C2 = (function (_super) { function C2() { _super.apply(this, arguments); } - C2.prototype.C2M1 = function () { - return null; - }; + C2.prototype.C2M1 = function () { return null; }; return C2; })(C1); var C3 = (function () { function C3() { } - C3.prototype.CM3M1 = function () { - return 3; - }; + C3.prototype.CM3M1 = function () { return 3; }; return C3; })(); /* @@ -138,9 +130,7 @@ var i1 = c1; var c2 = new C2(); var c3 = new C3(); var o1 = { one: 1 }; -var f1 = function () { - return new C1(); -}; +var f1 = function () { return new C1(); }; var arr_any = []; var arr_i1 = []; var arr_c1 = []; diff --git a/tests/baselines/reference/arrayAssignmentTest2.js b/tests/baselines/reference/arrayAssignmentTest2.js index a62e0eec9ac..977862866ed 100644 --- a/tests/baselines/reference/arrayAssignmentTest2.js +++ b/tests/baselines/reference/arrayAssignmentTest2.js @@ -69,12 +69,8 @@ var __extends = this.__extends || function (d, b) { var C1 = (function () { function C1() { } - C1.prototype.IM1 = function () { - return null; - }; - C1.prototype.C1M1 = function () { - return null; - }; + C1.prototype.IM1 = function () { return null; }; + C1.prototype.C1M1 = function () { return null; }; return C1; })(); var C2 = (function (_super) { @@ -82,17 +78,13 @@ var C2 = (function (_super) { function C2() { _super.apply(this, arguments); } - C2.prototype.C2M1 = function () { - return null; - }; + C2.prototype.C2M1 = function () { return null; }; return C2; })(C1); var C3 = (function () { function C3() { } - C3.prototype.CM3M1 = function () { - return 3; - }; + C3.prototype.CM3M1 = function () { return 3; }; return C3; })(); /* @@ -112,9 +104,7 @@ var i1 = c1; var c2 = new C2(); var c3 = new C3(); var o1 = { one: 1 }; -var f1 = function () { - return new C1(); -}; +var f1 = function () { return new C1(); }; var arr_any = []; var arr_i1 = []; var arr_c1 = []; @@ -128,9 +118,7 @@ arr_c3 = arr_c2_2; // should be an error - is arr_c3 = arr_c1_2; // should be an error - is arr_c3 = arr_i1_2; // should be an error - is arr_any = f1; // should be an error - is -arr_any = function () { - return null; -}; // should be an error - is +arr_any = function () { return null; }; // should be an error - is arr_any = o1; // should be an error - is arr_any = a1; // should be ok - is arr_any = c1; // should be an error - is diff --git a/tests/baselines/reference/arrayAssignmentTest4.js b/tests/baselines/reference/arrayAssignmentTest4.js index 7ac0ccde77f..c38cdebc06c 100644 --- a/tests/baselines/reference/arrayAssignmentTest4.js +++ b/tests/baselines/reference/arrayAssignmentTest4.js @@ -30,9 +30,7 @@ arr_any = c3; // should be an error - is var C3 = (function () { function C3() { } - C3.prototype.CM3M1 = function () { - return 3; - }; + C3.prototype.CM3M1 = function () { return 3; }; return C3; })(); /* @@ -49,7 +47,5 @@ Type 1 of any[]: var c3 = new C3(); var o1 = { one: 1 }; var arr_any = []; -arr_any = function () { - return null; -}; // should be an error - is +arr_any = function () { return null; }; // should be an error - is arr_any = c3; // should be an error - is diff --git a/tests/baselines/reference/arrowFunctionContexts.js b/tests/baselines/reference/arrowFunctionContexts.js index cdf902a6c37..a10e3955ae0 100644 --- a/tests/baselines/reference/arrowFunctionContexts.js +++ b/tests/baselines/reference/arrowFunctionContexts.js @@ -184,14 +184,10 @@ var M2; // (ParamList) => { ... } is a generic arrow function var generic1 = function (n) { return [n]; }; var generic1; // Incorrect error, Bug 829597 -var generic2 = function (n) { - return [n]; -}; +var generic2 = function (n) { return [n]; }; var generic2; // ((ParamList) => { ... } ) is a type assertion to an arrow function var asserted1 = (function (n) { return [n]; }); var asserted1; -var asserted2 = (function (n) { - return n; -}); +var asserted2 = (function (n) { return n; }); var asserted2; diff --git a/tests/baselines/reference/arrowFunctionExpressions.js b/tests/baselines/reference/arrowFunctionExpressions.js index a828da6cffc..68516b52cb2 100644 --- a/tests/baselines/reference/arrowFunctionExpressions.js +++ b/tests/baselines/reference/arrowFunctionExpressions.js @@ -91,16 +91,10 @@ function tryCatchFn() { //// [arrowFunctionExpressions.js] // ArrowFormalParameters => AssignmentExpression is equivalent to ArrowFormalParameters => { return AssignmentExpression; } var a = function (p) { return p.length; }; -var a = function (p) { - return p.length; -}; +var a = function (p) { return p.length; }; // Identifier => Block is equivalent to(Identifier) => Block -var b = function (j) { - return 0; -}; -var b = function (j) { - return 0; -}; +var b = function (j) { return 0; }; +var b = function (j) { return 0; }; // Identifier => AssignmentExpression is equivalent to(Identifier) => AssignmentExpression var c; var d = function (n) { return c = n; }; diff --git a/tests/baselines/reference/arrowFunctionInConstructorArgument1.js b/tests/baselines/reference/arrowFunctionInConstructorArgument1.js index 3cfc18d2cf7..0f9c3f81b3b 100644 --- a/tests/baselines/reference/arrowFunctionInConstructorArgument1.js +++ b/tests/baselines/reference/arrowFunctionInConstructorArgument1.js @@ -11,6 +11,4 @@ var C = (function () { } return C; })(); -var c = new C(function () { - return asdf; -}); // should error +var c = new C(function () { return asdf; }); // should error diff --git a/tests/baselines/reference/arrowFunctionsMissingTokens.js b/tests/baselines/reference/arrowFunctionsMissingTokens.js index 3ea21232ac4..e0e22578ac6 100644 --- a/tests/baselines/reference/arrowFunctionsMissingTokens.js +++ b/tests/baselines/reference/arrowFunctionsMissingTokens.js @@ -79,24 +79,12 @@ var missingCurliesWithArrow; (function (missingCurliesWithArrow) { var withStatement; (function (withStatement) { - var a = function () { - var k = 10; - }; - var b = function () { - var k = 10; - }; - var c = function (x) { - var k = 10; - }; - var d = function (x, y) { - var k = 10; - }; - var e = function (x, y) { - var k = 10; - }; - var f = function () { - var k = 10; - }; + var a = function () { var k = 10; }; + var b = function () { var k = 10; }; + var c = function (x) { var k = 10; }; + var d = function (x, y) { var k = 10; }; + var e = function (x, y) { var k = 10; }; + var f = function () { var k = 10; }; })(withStatement || (withStatement = {})); var withoutStatement; (function (withoutStatement) { diff --git a/tests/baselines/reference/assignEveryTypeToAny.js b/tests/baselines/reference/assignEveryTypeToAny.js index c88fc2edc17..15aa6bcdd91 100644 --- a/tests/baselines/reference/assignEveryTypeToAny.js +++ b/tests/baselines/reference/assignEveryTypeToAny.js @@ -91,12 +91,8 @@ var h; x = h; var i; x = i; -x = { f: function () { - return 1; -} }; -x = { f: function (x) { - return x; -} }; +x = { f: function () { return 1; } }; +x = { f: function (x) { return x; } }; function j(a) { x = a; } diff --git a/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js b/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js index 513a2080dd4..fe6142cafe0 100644 --- a/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js +++ b/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.js @@ -12,6 +12,4 @@ fn(function (a, b) { return true; }) //// [assignLambdaToNominalSubtypeOfFunction.js] function fn(cb) { } fn(function (a, b) { return true; }); -fn(function (a, b) { - return true; -}); +fn(function (a, b) { return true; }); diff --git a/tests/baselines/reference/assignToFn.js b/tests/baselines/reference/assignToFn.js index 620753e4941..2ff8ceedfa6 100644 --- a/tests/baselines/reference/assignToFn.js +++ b/tests/baselines/reference/assignToFn.js @@ -13,8 +13,6 @@ module M { //// [assignToFn.js] var M; (function (M) { - var x = { f: function (n) { - return true; - } }; + var x = { f: function (n) { return true; } }; x.f = "hello"; })(M || (M = {})); diff --git a/tests/baselines/reference/assignmentCompatBug2.js b/tests/baselines/reference/assignmentCompatBug2.js index 77d1e1b7d16..5545cc7d19c 100644 --- a/tests/baselines/reference/assignmentCompatBug2.js +++ b/tests/baselines/reference/assignmentCompatBug2.js @@ -44,50 +44,28 @@ b2 = { a: 0 }; // error b2 = { b: 0, a: 0 }; var b3; b3 = { - f: function (n) { - return 0; - }, - g: function (s) { - return 0; - }, + f: function (n) { return 0; }, + g: function (s) { return 0; }, m: 0 }; // ok b3 = { - f: function (n) { - return 0; - }, - g: function (s) { - return 0; - } + f: function (n) { return 0; }, + g: function (s) { return 0; } }; // error b3 = { - f: function (n) { - return 0; - }, + f: function (n) { return 0; }, m: 0 }; // error b3 = { - f: function (n) { - return 0; - }, - g: function (s) { - return 0; - }, + f: function (n) { return 0; }, + g: function (s) { return 0; }, m: 0, n: 0, - k: function (a) { - return null; - } + k: function (a) { return null; } }; // ok b3 = { - f: function (n) { - return 0; - }, - g: function (s) { - return 0; - }, + f: function (n) { return 0; }, + g: function (s) { return 0; }, n: 0, - k: function (a) { - return null; - } + k: function (a) { return null; } }; // error diff --git a/tests/baselines/reference/assignmentCompatBug3.js b/tests/baselines/reference/assignmentCompatBug3.js index da21ac17c9d..049e7090335 100644 --- a/tests/baselines/reference/assignmentCompatBug3.js +++ b/tests/baselines/reference/assignmentCompatBug3.js @@ -28,12 +28,8 @@ foo(x + y); //// [assignmentCompatBug3.js] function makePoint(x, y) { return { - get x() { - return x; - }, - get y() { - return y; - }, + get x() { return x; }, + get y() { return y; }, //x: "yo", //y: "boo", dist: function () { diff --git a/tests/baselines/reference/assignmentCompatBug5.js b/tests/baselines/reference/assignmentCompatBug5.js index d4f82584bec..ae444c3dad6 100644 --- a/tests/baselines/reference/assignmentCompatBug5.js +++ b/tests/baselines/reference/assignmentCompatBug5.js @@ -19,6 +19,4 @@ foo2(["s", "t"]); function foo3(x) { } ; foo3(function (s) { }); -foo3(function (n) { - return; -}); +foo3(function (n) { return; }); diff --git a/tests/baselines/reference/assignmentCompatForEnums.js b/tests/baselines/reference/assignmentCompatForEnums.js index 4bca6a514d2..8db85399fa8 100644 --- a/tests/baselines/reference/assignmentCompatForEnums.js +++ b/tests/baselines/reference/assignmentCompatForEnums.js @@ -22,9 +22,7 @@ var TokenType; })(TokenType || (TokenType = {})); ; var list = {}; -function returnType() { - return null; -} +function returnType() { return null; } function foo() { var x = returnType(); var x = list['one']; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures.js b/tests/baselines/reference/assignmentCompatWithCallSignatures.js index 0539463ddb1..12fc6159fac 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures.js @@ -57,26 +57,18 @@ a = s; a = a2; t = function (x) { return 1; }; t = function () { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = function (x) { return 1; }; a = function () { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; var s2; var a3; // these are errors t = s2; t = a3; t = function (x) { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = s2; a = a3; a = function (x) { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithCallSignatures2.js b/tests/baselines/reference/assignmentCompatWithCallSignatures2.js index 6fabe9b6af7..6bfc1b6c0d6 100644 --- a/tests/baselines/reference/assignmentCompatWithCallSignatures2.js +++ b/tests/baselines/reference/assignmentCompatWithCallSignatures2.js @@ -64,38 +64,24 @@ a = s; a = a2; t = { f: function () { return 1; } }; t = { f: function (x) { return 1; } }; -t = { f: function f() { - return 1; -} }; -t = { f: function (x) { - return ''; -} }; +t = { f: function f() { return 1; } }; +t = { f: function (x) { return ''; } }; a = { f: function () { return 1; } }; a = { f: function (x) { return 1; } }; -a = { f: function (x) { - return ''; -} }; +a = { f: function (x) { return ''; } }; // errors t = function () { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = function () { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; var s2; var a3; // these are errors t = s2; t = a3; t = function (x) { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = s2; a = a3; a = function (x) { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures.js index 3dc7511fec0..c00aa121712 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures.js @@ -54,12 +54,8 @@ var a3; t = s2; t = a3; t = function (x) { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = s2; a = a3; a = function (x) { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js index 7f173224bc9..d00762aa1c5 100644 --- a/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js +++ b/tests/baselines/reference/assignmentCompatWithConstructSignatures2.js @@ -56,25 +56,17 @@ a = s; a = a2; // errors t = function () { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = function () { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; var s2; var a3; // these are errors t = s2; t = a3; t = function (x) { return 1; }; -t = function (x) { - return ''; -}; +t = function (x) { return ''; }; a = s2; a = a3; a = function (x) { return 1; }; -a = function (x) { - return ''; -}; +a = function (x) { return ''; }; diff --git a/tests/baselines/reference/assignmentCompatWithOverloads.js b/tests/baselines/reference/assignmentCompatWithOverloads.js index 472ebec2967..ca3dc0e2294 100644 --- a/tests/baselines/reference/assignmentCompatWithOverloads.js +++ b/tests/baselines/reference/assignmentCompatWithOverloads.js @@ -31,18 +31,10 @@ var d: new(x: number) => void; d = C; // Error //// [assignmentCompatWithOverloads.js] -function f1(x) { - return null; -} -function f2(x) { - return null; -} -function f3(x) { - return null; -} -function f4(x) { - return undefined; -} +function f1(x) { return null; } +function f2(x) { return null; } +function f3(x) { return null; } +function f4(x) { return undefined; } var g; g = f1; // OK g = f2; // Error diff --git a/tests/baselines/reference/assignmentCompatability24.js b/tests/baselines/reference/assignmentCompatability24.js index 7eda1e61266..e6961264de8 100644 --- a/tests/baselines/reference/assignmentCompatability24.js +++ b/tests/baselines/reference/assignmentCompatability24.js @@ -19,9 +19,7 @@ var __test1__; })(__test1__ || (__test1__ = {})); var __test2__; (function (__test2__) { - __test2__.obj = function f(a) { - return a; - }; + __test2__.obj = function f(a) { return a; }; ; __test2__.__val__obj = __test2__.obj; })(__test2__ || (__test2__ = {})); diff --git a/tests/baselines/reference/assignmentLHSIsValue.js b/tests/baselines/reference/assignmentLHSIsValue.js index 15bc7b9acfd..4b17f855171 100644 --- a/tests/baselines/reference/assignmentLHSIsValue.js +++ b/tests/baselines/reference/assignmentLHSIsValue.js @@ -84,17 +84,11 @@ var C = (function () { function C() { this = value; } - C.prototype.foo = function () { - this = value; - }; - C.sfoo = function () { - this = value; - }; + C.prototype.foo = function () { this = value; }; + C.sfoo = function () { this = value; }; return C; })(); -function foo() { - this = value; -} +function foo() { this = value; } this = value; // identifiers: module, class, enum, function var M; @@ -129,12 +123,8 @@ var Derived = (function (_super) { _super.call(this); _super.prototype. = value; } - Derived.prototype.foo = function () { - _super.prototype. = value; - }; - Derived.sfoo = function () { - _super. = value; - }; + Derived.prototype.foo = function () { _super.prototype. = value; }; + Derived.sfoo = function () { _super. = value; }; return Derived; })(C); // function expression diff --git a/tests/baselines/reference/bestCommonTypeOfTuple.js b/tests/baselines/reference/bestCommonTypeOfTuple.js index 752523317b5..f78f8990db0 100644 --- a/tests/baselines/reference/bestCommonTypeOfTuple.js +++ b/tests/baselines/reference/bestCommonTypeOfTuple.js @@ -26,15 +26,9 @@ var e3 = t3[2]; // any var e4 = t4[3]; // number //// [bestCommonTypeOfTuple.js] -function f1(x) { - return "foo"; -} -function f2(x) { - return 10; -} -function f3(x) { - return true; -} +function f1(x) { return "foo"; } +function f2(x) { return 10; } +function f3(x) { return true; } var E1; (function (E1) { E1[E1["one"] = 0] = "one"; diff --git a/tests/baselines/reference/bestCommonTypeReturnStatement.js b/tests/baselines/reference/bestCommonTypeReturnStatement.js index 232ffc07c54..f4ab98ed1c6 100644 --- a/tests/baselines/reference/bestCommonTypeReturnStatement.js +++ b/tests/baselines/reference/bestCommonTypeReturnStatement.js @@ -18,9 +18,5 @@ function f() { return b(); return d(); } -function b() { - return null; -} -function d() { - return null; -} +function b() { return null; } +function d() { return null; } diff --git a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js index 9416e7b1a06..fb573a7523f 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithBooleanType.js @@ -41,15 +41,11 @@ var ResultIsNumber8 = ~~BOOLEAN; //// [bitwiseNotOperatorWithBooleanType.js] // ~ operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js index 2f9703ae669..ac439f02903 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithNumberType.js @@ -48,15 +48,11 @@ var ResultIsNumber13 = ~~~(NUMBER + NUMBER); // ~ operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -70,9 +66,7 @@ var ResultIsNumber2 = ~NUMBER1; // number type literal var ResultIsNumber3 = ~1; var ResultIsNumber4 = ~{ x: 1, y: 2 }; -var ResultIsNumber5 = ~{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = ~{ x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsNumber6 = ~objA.a; var ResultIsNumber7 = ~M.n; diff --git a/tests/baselines/reference/bitwiseNotOperatorWithStringType.js b/tests/baselines/reference/bitwiseNotOperatorWithStringType.js index fbd77c6119a..a553712e16b 100644 --- a/tests/baselines/reference/bitwiseNotOperatorWithStringType.js +++ b/tests/baselines/reference/bitwiseNotOperatorWithStringType.js @@ -47,15 +47,11 @@ var ResultIsNumber14 = ~~~(STRING + STRING); // ~ operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -69,9 +65,7 @@ var ResultIsNumber2 = ~STRING1; // string type literal var ResultIsNumber3 = ~""; var ResultIsNumber4 = ~{ x: "", y: "" }; -var ResultIsNumber5 = ~{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber5 = ~{ x: "", y: function (s) { return s; } }; // string type expressions var ResultIsNumber6 = ~objA.a; var ResultIsNumber7 = ~M.n; diff --git a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js index 59bfabd21d6..f1028956e16 100644 --- a/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js +++ b/tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.js @@ -47,14 +47,10 @@ var r7b = i2.f(1, ''); //// [callGenericFunctionWithIncorrectNumberOfTypeArguments.js] // type parameter lists must exactly match type argument lists // all of these invocations are errors -function f(x, y) { - return null; -} +function f(x, y) { return null; } var r1 = f(1, ''); var r1b = f(1, ''); -var f2 = function (x, y) { - return null; -}; +var f2 = function (x, y) { return null; }; var r2 = f2(1, ''); var r2b = f2(1, ''); var f3; diff --git a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js index 04edc93f5d9..26b9d33a55d 100644 --- a/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js +++ b/tests/baselines/reference/callGenericFunctionWithZeroTypeArguments.js @@ -38,13 +38,9 @@ var r7 = i2.f(1); //// [callGenericFunctionWithZeroTypeArguments.js] // valid invocations of generic functions with no explicit type arguments provided -function f(x) { - return null; -} +function f(x) { return null; } var r = f(1); -var f2 = function (x) { - return null; -}; +var f2 = function (x) { return null; }; var r2 = f2(1); var f3; var r3 = f3(1); diff --git a/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js b/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js index 306b4c70362..7b0355533e3 100644 --- a/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js +++ b/tests/baselines/reference/callNonGenericFunctionWithTypeArguments.js @@ -46,13 +46,9 @@ var r8 = a2(); //// [callNonGenericFunctionWithTypeArguments.js] // it is always illegal to provide type arguments to a non-generic function // all invocations here are illegal -function f(x) { - return null; -} +function f(x) { return null; } var r = f(1); -var f2 = function (x) { - return null; -}; +var f2 = function (x) { return null; }; var r2 = f2(1); var f3; var r3 = f3(1); diff --git a/tests/baselines/reference/callOverloads1.js b/tests/baselines/reference/callOverloads1.js index 94397c4ef8e..b1148c12420 100644 --- a/tests/baselines/reference/callOverloads1.js +++ b/tests/baselines/reference/callOverloads1.js @@ -25,9 +25,7 @@ var Foo = (function () { Foo.prototype.bar1 = function () { }; return Foo; })(); -function F1(a) { - return a; -} +function F1(a) { return a; } var f1 = new Foo("hey"); f1.bar1(); Foo(); diff --git a/tests/baselines/reference/callOverloads2.js b/tests/baselines/reference/callOverloads2.js index ed1b9cfcac3..b336911eeb0 100644 --- a/tests/baselines/reference/callOverloads2.js +++ b/tests/baselines/reference/callOverloads2.js @@ -33,12 +33,8 @@ var Foo = (function () { Foo.prototype.bar1 = function () { }; return Foo; })(); -function F1(s) { - return s; -} // error -function F1(a) { - return a; -} // error +function F1(s) { return s; } // error +function F1(a) { return a; } // error var f1 = new Foo("hey"); f1.bar1(); Foo(); diff --git a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js index c048c5c56de..0e78aac2b1b 100644 --- a/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js +++ b/tests/baselines/reference/callSignatureWithoutReturnTypeAnnotationInference.js @@ -202,9 +202,7 @@ function foo12() { return i2; } var r12 = foo12(); -function m1() { - return 1; -} +function m1() { return 1; } var m1; (function (m1) { m1.y = 2; diff --git a/tests/baselines/reference/callbacksDontShareTypes.js b/tests/baselines/reference/callbacksDontShareTypes.js index 649ed1cb6ca..e6483638058 100644 --- a/tests/baselines/reference/callbacksDontShareTypes.js +++ b/tests/baselines/reference/callbacksDontShareTypes.js @@ -21,14 +21,8 @@ var r5b = _.map(c2, rf1); //// [callbacksDontShareTypes.js] var _; var c2; -var rf1 = function (x) { - return x.toFixed(); -}; -var r1a = _.map(c2, function (x) { - return x.toFixed(); -}); +var rf1 = function (x) { return x.toFixed(); }; +var r1a = _.map(c2, function (x) { return x.toFixed(); }); var r1b = _.map(c2, rf1); // this line should not cause the following 2 to have errors -var r5a = _.map(c2, function (x) { - return x.toFixed(); -}); +var r5a = _.map(c2, function (x) { return x.toFixed(); }); var r5b = _.map(c2, rf1); diff --git a/tests/baselines/reference/castTest.js b/tests/baselines/reference/castTest.js index 5afa67026b9..ef9ef084d98 100644 --- a/tests/baselines/reference/castTest.js +++ b/tests/baselines/reference/castTest.js @@ -47,7 +47,5 @@ var p_cast = ({ add: function (dx, dy) { return new Point(this.x + dx, this.y + dy); }, - mult: function (p) { - return p; - } + mult: function (p) { return p; } }); diff --git a/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js b/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js index e6995a04aca..1884967aa9e 100644 --- a/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js +++ b/tests/baselines/reference/chainedSpecializationToObjectTypeLiteral.js @@ -14,6 +14,4 @@ var s3 = s2.each(x => { x.key /* Type is K, should be number */ }); //// [chainedSpecializationToObjectTypeLiteral.js] var s; var s2 = s.groupBy(function (s) { return s.length; }); -var s3 = s2.each(function (x) { - x.key; /* Type is K, should be number */ -}); +var s3 = s2.each(function (x) { x.key; /* Type is K, should be number */ }); diff --git a/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.js b/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.js index ed6e3138b07..907b6bd6fd2 100644 --- a/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.js +++ b/tests/baselines/reference/classExtendsInterfaceThatExtendsClassWithPrivates1.js @@ -19,20 +19,14 @@ var C = (function () { function C() { this.x = 1; } - C.prototype.foo = function (x) { - return x; - }; + C.prototype.foo = function (x) { return x; }; return C; })(); var D2 = (function () { function D2() { this.x = 3; } - D2.prototype.foo = function (x) { - return x; - }; - D2.prototype.other = function (x) { - return x; - }; + D2.prototype.foo = function (x) { return x; }; + D2.prototype.other = function (x) { return x; }; return D2; })(); diff --git a/tests/baselines/reference/classImplementsClass2.js b/tests/baselines/reference/classImplementsClass2.js index 98554944bc9..bc4f6b6748c 100644 --- a/tests/baselines/reference/classImplementsClass2.js +++ b/tests/baselines/reference/classImplementsClass2.js @@ -23,9 +23,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classImplementsClass3.js b/tests/baselines/reference/classImplementsClass3.js index 9dbfc4388e9..450263d00c9 100644 --- a/tests/baselines/reference/classImplementsClass3.js +++ b/tests/baselines/reference/classImplementsClass3.js @@ -24,9 +24,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classImplementsClass4.js b/tests/baselines/reference/classImplementsClass4.js index 0e08e508fb5..ac5c899bbbf 100644 --- a/tests/baselines/reference/classImplementsClass4.js +++ b/tests/baselines/reference/classImplementsClass4.js @@ -27,9 +27,7 @@ var A = (function () { function A() { this.x = 1; } - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classImplementsClass5.js b/tests/baselines/reference/classImplementsClass5.js index 46e826683e7..a0971904cc3 100644 --- a/tests/baselines/reference/classImplementsClass5.js +++ b/tests/baselines/reference/classImplementsClass5.js @@ -28,9 +28,7 @@ var A = (function () { function A() { this.x = 1; } - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classImplementsClass6.js b/tests/baselines/reference/classImplementsClass6.js index 386cd6685ae..931218e2bea 100644 --- a/tests/baselines/reference/classImplementsClass6.js +++ b/tests/baselines/reference/classImplementsClass6.js @@ -34,9 +34,7 @@ var A = (function () { A.bar = function () { return ""; }; - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C = (function () { diff --git a/tests/baselines/reference/classOrder2.js b/tests/baselines/reference/classOrder2.js index 0ba1e016bc8..4bc1c3f790c 100644 --- a/tests/baselines/reference/classOrder2.js +++ b/tests/baselines/reference/classOrder2.js @@ -31,9 +31,7 @@ var A = (function (_super) { function A() { _super.apply(this, arguments); } - A.prototype.foo = function () { - this.bar(); - }; + A.prototype.foo = function () { this.bar(); }; return A; })(B); var B = (function () { diff --git a/tests/baselines/reference/classPropertyAsPrivate.js b/tests/baselines/reference/classPropertyAsPrivate.js index fdb16620fac..51d08b48ec5 100644 --- a/tests/baselines/reference/classPropertyAsPrivate.js +++ b/tests/baselines/reference/classPropertyAsPrivate.js @@ -28,18 +28,14 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true }); C.prototype.foo = function () { }; Object.defineProperty(C, "b", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classPropertyAsProtected.js b/tests/baselines/reference/classPropertyAsProtected.js index d036319fe8f..1cd74089816 100644 --- a/tests/baselines/reference/classPropertyAsProtected.js +++ b/tests/baselines/reference/classPropertyAsProtected.js @@ -28,18 +28,14 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true }); C.prototype.foo = function () { }; Object.defineProperty(C, "b", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classPropertyIsPublicByDefault.js b/tests/baselines/reference/classPropertyIsPublicByDefault.js index fefa48be10a..a0b61a08922 100644 --- a/tests/baselines/reference/classPropertyIsPublicByDefault.js +++ b/tests/baselines/reference/classPropertyIsPublicByDefault.js @@ -27,18 +27,14 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true }); C.prototype.foo = function () { }; Object.defineProperty(C, "b", { - get: function () { - return null; - }, + get: function () { return null; }, set: function (x) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classSideInheritance1.js b/tests/baselines/reference/classSideInheritance1.js index 38b84b77bd3..74df624a78c 100644 --- a/tests/baselines/reference/classSideInheritance1.js +++ b/tests/baselines/reference/classSideInheritance1.js @@ -28,9 +28,7 @@ var A = (function () { A.bar = function () { return ""; }; - A.prototype.foo = function () { - return 1; - }; + A.prototype.foo = function () { return 1; }; return A; })(); var C2 = (function (_super) { diff --git a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.js b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.js index e39391be68d..1c07449c994 100644 --- a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.js +++ b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface.js @@ -30,13 +30,9 @@ i = c; var C = (function () { function C() { } - C.prototype.y = function (a) { - return null; - }; + C.prototype.y = function (a) { return null; }; Object.defineProperty(C.prototype, "z", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.js b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.js index b7aa9d52332..78e5cb05861 100644 --- a/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.js +++ b/tests/baselines/reference/classWithOnlyPublicMembersEquivalentToInterface2.js @@ -32,13 +32,9 @@ i = c; var C = (function () { function C() { } - C.prototype.y = function (a) { - return null; - }; + C.prototype.y = function (a) { return null; }; Object.defineProperty(C.prototype, "z", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/classWithPrivateProperty.js b/tests/baselines/reference/classWithPrivateProperty.js index 224fc432b64..0529fd8d694 100644 --- a/tests/baselines/reference/classWithPrivateProperty.js +++ b/tests/baselines/reference/classWithPrivateProperty.js @@ -30,12 +30,8 @@ var C = (function () { this.b = ''; this.d = function () { return ''; }; } - C.prototype.c = function () { - return ''; - }; - C.f = function () { - return ''; - }; + C.prototype.c = function () { return ''; }; + C.f = function () { return ''; }; C.g = function () { return ''; }; return C; })(); diff --git a/tests/baselines/reference/classWithProtectedProperty.js b/tests/baselines/reference/classWithProtectedProperty.js index c0dde0d3237..4de87229ad0 100644 --- a/tests/baselines/reference/classWithProtectedProperty.js +++ b/tests/baselines/reference/classWithProtectedProperty.js @@ -41,12 +41,8 @@ var C = (function () { this.b = ''; this.d = function () { return ''; }; } - C.prototype.c = function () { - return ''; - }; - C.f = function () { - return ''; - }; + C.prototype.c = function () { return ''; }; + C.f = function () { return ''; }; C.g = function () { return ''; }; return C; })(); diff --git a/tests/baselines/reference/classWithPublicProperty.js b/tests/baselines/reference/classWithPublicProperty.js index 97b3f46ab49..cc1b0aad64f 100644 --- a/tests/baselines/reference/classWithPublicProperty.js +++ b/tests/baselines/reference/classWithPublicProperty.js @@ -28,12 +28,8 @@ var C = (function () { this.b = ''; this.d = function () { return ''; }; } - C.prototype.c = function () { - return ''; - }; - C.f = function () { - return ''; - }; + C.prototype.c = function () { return ''; }; + C.f = function () { return ''; }; C.g = function () { return ''; }; return C; })(); diff --git a/tests/baselines/reference/classWithStaticMembers.js b/tests/baselines/reference/classWithStaticMembers.js index 0d3747dc313..36b8bd0af64 100644 --- a/tests/baselines/reference/classWithStaticMembers.js +++ b/tests/baselines/reference/classWithStaticMembers.js @@ -31,13 +31,9 @@ var C = (function () { this.a = a; this.b = b; } - C.fn = function () { - return this; - }; + C.fn = function () { return this; }; Object.defineProperty(C, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/cloduleWithDuplicateMember1.js b/tests/baselines/reference/cloduleWithDuplicateMember1.js index d64da830598..e3cb8f83fed 100644 --- a/tests/baselines/reference/cloduleWithDuplicateMember1.js +++ b/tests/baselines/reference/cloduleWithDuplicateMember1.js @@ -20,9 +20,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/clodulesDerivedClasses.js b/tests/baselines/reference/clodulesDerivedClasses.js index f249a7d5589..b4b31e59d3e 100644 --- a/tests/baselines/reference/clodulesDerivedClasses.js +++ b/tests/baselines/reference/clodulesDerivedClasses.js @@ -38,9 +38,7 @@ var Shape; (function (Shape) { var Utils; (function (Utils) { - function convert() { - return null; - } + function convert() { return null; } Utils.convert = convert; })(Utils = Shape.Utils || (Shape.Utils = {})); })(Shape || (Shape = {})); diff --git a/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.js b/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.js index 967d01819ec..879dd83d778 100644 --- a/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.js +++ b/tests/baselines/reference/collisionThisExpressionAndLocalVarInFunction.js @@ -12,7 +12,5 @@ var console; function x() { var _this = this; var _this = 5; - (function (x) { - console.log(_this.x); - }); + (function (x) { console.log(_this.x); }); } diff --git a/tests/baselines/reference/collisionThisExpressionAndParameter.js b/tests/baselines/reference/collisionThisExpressionAndParameter.js index 7c11cab769f..3a19cf20d5a 100644 --- a/tests/baselines/reference/collisionThisExpressionAndParameter.js +++ b/tests/baselines/reference/collisionThisExpressionAndParameter.js @@ -144,9 +144,7 @@ var Foo1 = (function () { })(); function f1(_this) { var _this = this; - (function (x) { - console.log(_this.x); - }); + (function (x) { console.log(_this.x); }); } var Foo3 = (function () { function Foo3(_this) { @@ -167,7 +165,5 @@ var Foo3 = (function () { })(); function f3(_this) { var _this = this; - (function (x) { - console.log(_this.x); - }); + (function (x) { console.log(_this.x); }); } diff --git a/tests/baselines/reference/commentOnClassAccessor1.js b/tests/baselines/reference/commentOnClassAccessor1.js index cdd14a829fc..428e500da55 100644 --- a/tests/baselines/reference/commentOnClassAccessor1.js +++ b/tests/baselines/reference/commentOnClassAccessor1.js @@ -14,9 +14,7 @@ var C = (function () { /** * @type {number} */ - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/commentOnClassAccessor2.js b/tests/baselines/reference/commentOnClassAccessor2.js index e75431a7280..22a6b69f6c3 100644 --- a/tests/baselines/reference/commentOnClassAccessor2.js +++ b/tests/baselines/reference/commentOnClassAccessor2.js @@ -19,9 +19,7 @@ var C = (function () { /** * Getter. */ - get: function () { - return 1; - }, + get: function () { return 1; }, /** * Setter. */ diff --git a/tests/baselines/reference/complexClassRelationships.js b/tests/baselines/reference/complexClassRelationships.js index a2a863cf54b..e8dc954e14c 100644 --- a/tests/baselines/reference/complexClassRelationships.js +++ b/tests/baselines/reference/complexClassRelationships.js @@ -68,9 +68,7 @@ var Derived = (function (_super) { })(Base); var BaseCollection = (function () { function BaseCollection(f) { - (function (item) { - return [item.Components]; - }); + (function (item) { return [item.Components]; }); } return BaseCollection; })(); @@ -83,9 +81,7 @@ var Thing = (function () { function Thing() { } Object.defineProperty(Thing.prototype, "Components", { - get: function () { - return null; - }, + get: function () { return null; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/compositeGenericFunction.js b/tests/baselines/reference/compositeGenericFunction.js index 0fe2e7d6f41..106c724ea24 100644 --- a/tests/baselines/reference/compositeGenericFunction.js +++ b/tests/baselines/reference/compositeGenericFunction.js @@ -7,12 +7,8 @@ var z: number = h(f); var z: number = h(f); //// [compositeGenericFunction.js] -function f(value) { - return value; -} +function f(value) { return value; } ; -function h(func) { - return null; -} +function h(func) { return null; } var z = h(f); var z = h(f); diff --git a/tests/baselines/reference/computedPropertyNames1.js b/tests/baselines/reference/computedPropertyNames1.js index 4f0bcb3a8f4..2b58dd4f238 100644 --- a/tests/baselines/reference/computedPropertyNames1.js +++ b/tests/baselines/reference/computedPropertyNames1.js @@ -6,8 +6,6 @@ var v = { //// [computedPropertyNames1.js] var v = { - get [0 + 1]() { - return 0; - }, + get [0 + 1]() { return 0; }, set [0 + 1](v) { } //No error }; diff --git a/tests/baselines/reference/computedPropertyNames11.js b/tests/baselines/reference/computedPropertyNames11.js index 206fce0d76f..a7406b2c79b 100644 --- a/tests/baselines/reference/computedPropertyNames11.js +++ b/tests/baselines/reference/computedPropertyNames11.js @@ -21,27 +21,15 @@ var s; var n; var a; var v = { - get [s]() { - return 0; - }, + get [s]() { return 0; }, set [n](v) { }, - get [s + s]() { - return 0; - }, + get [s + s]() { return 0; }, set [s + n](v) { }, - get [+s]() { - return 0; - }, + get [+s]() { return 0; }, set [""](v) { }, - get [0]() { - return 0; - }, + get [0]() { return 0; }, set [a](v) { }, - get [true]() { - return 0; - }, + get [true]() { return 0; }, set [`hello bye`](v) { }, - get [`hello ${a} bye`]() { - return 0; - } + get [`hello ${a} bye`]() { return 0; } }; diff --git a/tests/baselines/reference/computedPropertyNames16.js b/tests/baselines/reference/computedPropertyNames16.js index 9a55c3f9ed5..41913f82a89 100644 --- a/tests/baselines/reference/computedPropertyNames16.js +++ b/tests/baselines/reference/computedPropertyNames16.js @@ -24,9 +24,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, s, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -36,9 +34,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C, s + s, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -48,9 +44,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, +s, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -60,9 +54,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, 0, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -72,9 +64,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C, true, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -84,9 +74,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, `hello ${a} bye`, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames17.js b/tests/baselines/reference/computedPropertyNames17.js index 026671ed8a6..69ae1e7b56a 100644 --- a/tests/baselines/reference/computedPropertyNames17.js +++ b/tests/baselines/reference/computedPropertyNames17.js @@ -15,9 +15,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, b, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -27,9 +25,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, [], { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -39,9 +35,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C, undefined, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames32.js b/tests/baselines/reference/computedPropertyNames32.js index 9bc723581ef..183e89387a7 100644 --- a/tests/baselines/reference/computedPropertyNames32.js +++ b/tests/baselines/reference/computedPropertyNames32.js @@ -8,9 +8,7 @@ class C { } //// [computedPropertyNames32.js] -function foo() { - return ''; -} +function foo() { return ''; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames33.js b/tests/baselines/reference/computedPropertyNames33.js index 43ceeb2b2fb..c19e41453a3 100644 --- a/tests/baselines/reference/computedPropertyNames33.js +++ b/tests/baselines/reference/computedPropertyNames33.js @@ -10,9 +10,7 @@ class C { } //// [computedPropertyNames33.js] -function foo() { - return ''; -} +function foo() { return ''; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames34.js b/tests/baselines/reference/computedPropertyNames34.js index 12892eefe4f..321a29e22fe 100644 --- a/tests/baselines/reference/computedPropertyNames34.js +++ b/tests/baselines/reference/computedPropertyNames34.js @@ -10,9 +10,7 @@ class C { } //// [computedPropertyNames34.js] -function foo() { - return ''; -} +function foo() { return ''; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames35.js b/tests/baselines/reference/computedPropertyNames35.js index 5a731fd8bda..9b9173a71d8 100644 --- a/tests/baselines/reference/computedPropertyNames35.js +++ b/tests/baselines/reference/computedPropertyNames35.js @@ -6,6 +6,4 @@ interface I { } //// [computedPropertyNames35.js] -function foo() { - return ''; -} +function foo() { return ''; } diff --git a/tests/baselines/reference/computedPropertyNames36.js b/tests/baselines/reference/computedPropertyNames36.js index 5df5c503911..39d25d38367 100644 --- a/tests/baselines/reference/computedPropertyNames36.js +++ b/tests/baselines/reference/computedPropertyNames36.js @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, "get1", { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames37.js b/tests/baselines/reference/computedPropertyNames37.js index 540dfa27e1e..b4987e9e00e 100644 --- a/tests/baselines/reference/computedPropertyNames37.js +++ b/tests/baselines/reference/computedPropertyNames37.js @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, "get1", { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames38.js b/tests/baselines/reference/computedPropertyNames38.js index fbbbe83ddc6..591c459bd11 100644 --- a/tests/baselines/reference/computedPropertyNames38.js +++ b/tests/baselines/reference/computedPropertyNames38.js @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, 1 << 6, { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames39.js b/tests/baselines/reference/computedPropertyNames39.js index 1d367c8d856..6950a8d8c80 100644 --- a/tests/baselines/reference/computedPropertyNames39.js +++ b/tests/baselines/reference/computedPropertyNames39.js @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, 1 << 6, { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames40.js b/tests/baselines/reference/computedPropertyNames40.js index 1c9b5d3bfa8..1e8e683d1c6 100644 --- a/tests/baselines/reference/computedPropertyNames40.js +++ b/tests/baselines/reference/computedPropertyNames40.js @@ -25,11 +25,7 @@ var C = (function () { function C() { } // Computed properties - C.prototype[""] = function () { - return new Foo; - }; - C.prototype[""] = function () { - return new Foo2; - }; + C.prototype[""] = function () { return new Foo; }; + C.prototype[""] = function () { return new Foo2; }; return C; })(); diff --git a/tests/baselines/reference/computedPropertyNames41.js b/tests/baselines/reference/computedPropertyNames41.js index 34fe2d33df7..2fd91625dae 100644 --- a/tests/baselines/reference/computedPropertyNames41.js +++ b/tests/baselines/reference/computedPropertyNames41.js @@ -24,8 +24,6 @@ var C = (function () { function C() { } // Computed properties - C[""] = function () { - return new Foo; - }; + C[""] = function () { return new Foo; }; return C; })(); diff --git a/tests/baselines/reference/computedPropertyNames43.js b/tests/baselines/reference/computedPropertyNames43.js index 0e7c3b5dac1..399399f5534 100644 --- a/tests/baselines/reference/computedPropertyNames43.js +++ b/tests/baselines/reference/computedPropertyNames43.js @@ -41,9 +41,7 @@ var D = (function (_super) { } Object.defineProperty(D.prototype, "get1", { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames44.js b/tests/baselines/reference/computedPropertyNames44.js index 37466dad602..66692205fa9 100644 --- a/tests/baselines/reference/computedPropertyNames44.js +++ b/tests/baselines/reference/computedPropertyNames44.js @@ -32,9 +32,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "get1", { - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames45.js b/tests/baselines/reference/computedPropertyNames45.js index 69e0df349ca..64a99dd56ce 100644 --- a/tests/baselines/reference/computedPropertyNames45.js +++ b/tests/baselines/reference/computedPropertyNames45.js @@ -33,9 +33,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "get1", { - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1.js b/tests/baselines/reference/computedPropertyNamesContextualType1.js index 82429be9c40..095227dc026 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType1.js @@ -11,8 +11,6 @@ var o: I = { //// [computedPropertyNamesContextualType1.js] var o = { - ["" + 0](y) { - return y.length; - }, + ["" + 0](y) { return y.length; }, ["" + 1]: y => { return y.length; } }; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2.js b/tests/baselines/reference/computedPropertyNamesContextualType2.js index 028e797be18..d74a7977f33 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType2.js @@ -11,8 +11,6 @@ var o: I = { //// [computedPropertyNamesContextualType2.js] var o = { - [+"foo"](y) { - return y.length; - }, + [+"foo"](y) { return y.length; }, [+"bar"]: y => { return y.length; } }; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3.js b/tests/baselines/reference/computedPropertyNamesContextualType3.js index 944bb3595d4..c10c82db8c4 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType3.js @@ -10,8 +10,6 @@ var o: I = { //// [computedPropertyNamesContextualType3.js] var o = { - [+"foo"](y) { - return y.length; - }, + [+"foo"](y) { return y.length; }, [+"bar"]: y => { return y.length; } }; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js index bbdb6cd7baf..27c6f3000b3 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1.js @@ -11,9 +11,7 @@ var C = (function () { } C.prototype["" + ""] = function () { }; Object.defineProperty(C.prototype, "" + "", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js index 10313841c4f..f47855da643 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2.js @@ -11,9 +11,7 @@ var C = (function () { } C["" + ""] = function () { }; Object.defineProperty(C, "" + "", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js index d59d84b9e72..759264c9b31 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5.js @@ -10,9 +10,7 @@ var v = { var v = { ["" + ""]: 0, ["" + ""]() { }, - get ["" + ""]() { - return 0; - }, + get ["" + ""]() { return 0; }, set ["" + ""](x) { } }; diff --git a/tests/baselines/reference/conditionalExpressions2.js b/tests/baselines/reference/conditionalExpressions2.js index b8870b564ec..6749a2c0ac0 100644 --- a/tests/baselines/reference/conditionalExpressions2.js +++ b/tests/baselines/reference/conditionalExpressions2.js @@ -18,11 +18,9 @@ var e = false ? "foo" : "bar"; var f = false ? null : undefined; var g = true ? { g: 5 } : null; var h = [{ h: 5 }, null]; -function i() { - if (true) { - return { x: 5 }; - } - else { - return null; - } +function i() { if (true) { + return { x: 5 }; } +else { + return null; +} } diff --git a/tests/baselines/reference/conditionalOperatorConditionIsNumberType.js b/tests/baselines/reference/conditionalOperatorConditionIsNumberType.js index 46a04169e93..f8fbe708e1a 100644 --- a/tests/baselines/reference/conditionalOperatorConditionIsNumberType.js +++ b/tests/baselines/reference/conditionalOperatorConditionIsNumberType.js @@ -91,9 +91,7 @@ condNumber ? exprString1 : exprBoolean1; // Union 1000000000000 ? exprIsObject1 : exprIsObject2; 10000 ? exprString1 : exprBoolean1; // Union //Cond is a number type expression -function foo() { - return 1; -} +function foo() { return 1; } ; var array = [1, 2, 3]; 1 * 0 ? exprAny1 : exprAny2; diff --git a/tests/baselines/reference/conditionalOperatorConditoinIsStringType.js b/tests/baselines/reference/conditionalOperatorConditoinIsStringType.js index 02c398e89e1..dbd68d9f009 100644 --- a/tests/baselines/reference/conditionalOperatorConditoinIsStringType.js +++ b/tests/baselines/reference/conditionalOperatorConditoinIsStringType.js @@ -92,9 +92,7 @@ condString ? exprString1 : exprBoolean1; // union " " ? exprIsObject1 : exprIsObject2; "hello " ? exprString1 : exprBoolean1; // union //Cond is a string type expression -function foo() { - return "string"; -} +function foo() { return "string"; } ; var array = ["1", "2", "3"]; typeof condString ? exprAny1 : exprAny2; diff --git a/tests/baselines/reference/constraintSatisfactionWithAny.js b/tests/baselines/reference/constraintSatisfactionWithAny.js index 924c2ab1700..06d8b17690a 100644 --- a/tests/baselines/reference/constraintSatisfactionWithAny.js +++ b/tests/baselines/reference/constraintSatisfactionWithAny.js @@ -54,16 +54,10 @@ var c8 = new C4(b); //// [constraintSatisfactionWithAny.js] // any is not a valid type argument unless there is no constraint, or the constraint is any -function foo(x) { - return null; -} -function foo2(x) { - return null; -} +function foo(x) { return null; } +function foo2(x) { return null; } //function foo3(x: T): T { return null; } -function foo4(x) { - return null; -} +function foo4(x) { return null; } var a; foo(a); foo2(a); diff --git a/tests/baselines/reference/constructorAsType.js b/tests/baselines/reference/constructorAsType.js index 1f48f214dd4..9f8c14ce743 100644 --- a/tests/baselines/reference/constructorAsType.js +++ b/tests/baselines/reference/constructorAsType.js @@ -6,8 +6,6 @@ var Person2:{new() : {name:string;};}; Person = Person2; //// [constructorAsType.js] -var Person = function () { - return { name: "joe" }; -}; +var Person = function () { return { name: "joe" }; }; var Person2; Person = Person2; diff --git a/tests/baselines/reference/constructorOverloads7.js b/tests/baselines/reference/constructorOverloads7.js index b7e152c66e1..5b7e407e806 100644 --- a/tests/baselines/reference/constructorOverloads7.js +++ b/tests/baselines/reference/constructorOverloads7.js @@ -34,6 +34,4 @@ function Point(x, y) { this.y = y; return this; } -function EF1(a, b) { - return a + b; -} +function EF1(a, b) { return a + b; } diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js index 86338c1d913..e47b050f935 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js @@ -360,9 +360,7 @@ var BasicFeatures = (function () { var char = 'c', \u0066 = '\u0066', hexchar = '\x42' != ; var quoted = '"', quoted2 = "'"; var reg = /\w*/; - var objLit = { "var": number = 42, equals: function (x) { - return x["var"] === 42; - }, instanceof: function () { return 'objLit{42}'; } }; + var objLit = { "var": number = 42, equals: function (x) { return x["var"] === 42; }, instanceof: function () { return 'objLit{42}'; } }; var weekday = 0 /* Monday */; var con = char + f + hexchar + float.toString() + float2.toString() + reg.toString() + objLit + weekday; // @@ -483,15 +481,10 @@ var BasicFeatures = (function () { })(); var CLASS = (function () { function CLASS() { - this.d = function () { - yield; - 0; - }; + this.d = function () { yield; 0; }; } Object.defineProperty(CLASS.prototype, "Property", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -499,9 +492,7 @@ var CLASS = (function () { return 0; }; CLASS.prototype.Foo = function () { - var myEvent = function () { - return 1; - }; + var myEvent = function () { return 1; }; if (myEvent() == 1) return true ? : ; else diff --git a/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js b/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js index bd76a746ac9..726d45bffe5 100644 --- a/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js +++ b/tests/baselines/reference/contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js @@ -8,9 +8,7 @@ var x = h("", f()); // Call should succeed and x should be string. All t //// [contextualSignatureInstantiationWithTypeParameterConstrainedToOuterTypeParameter.js] function f() { - function g(u) { - return null; - } + function g(u) { return null; } return g; } var h; diff --git a/tests/baselines/reference/contextualTyping.js b/tests/baselines/reference/contextualTyping.js index 46e09d7f9e5..75b98b16c33 100644 --- a/tests/baselines/reference/contextualTyping.js +++ b/tests/baselines/reference/contextualTyping.js @@ -249,40 +249,24 @@ var C2T5; }; })(C2T5 || (C2T5 = {})); // CONTEXT: Variable declaration -var c3t1 = (function (s) { - return s; -}); +var c3t1 = (function (s) { return s; }); var c3t2 = ({ n: 1 }); var c3t3 = []; -var c3t4 = function () { - return ({}); -}; -var c3t5 = function (n) { - return ({}); -}; -var c3t6 = function (n, s) { - return ({}); -}; -var c3t7 = function (n) { - return n; -}; -var c3t8 = function (n) { - return n; -}; +var c3t4 = function () { return ({}); }; +var c3t5 = function (n) { return ({}); }; +var c3t6 = function (n, s) { return ({}); }; +var c3t7 = function (n) { return n; }; +var c3t8 = function (n) { return n; }; var c3t9 = [[], []]; var c3t10 = [({}), ({})]; -var c3t11 = [function (n, s) { - return s; -}]; +var c3t11 = [function (n, s) { return s; }]; var c3t12 = { foo: ({}) }; var c3t13 = ({ - f: function (i, s) { - return s; - } + f: function (i, s) { return s; } }); var c3t14 = ({ a: [] @@ -306,47 +290,29 @@ var C5T5; })(C5T5 || (C5T5 = {})); // CONTEXT: Variable assignment var c6t5; -c6t5 = function (n) { - return ({}); -}; +c6t5 = function (n) { return ({}); }; // CONTEXT: Array index assignment var c7t2; c7t2[0] = ({ n: 1 }); var objc8 = ({}); -objc8.t1 = (function (s) { - return s; -}); +objc8.t1 = (function (s) { return s; }); objc8.t2 = ({ n: 1 }); objc8.t3 = []; -objc8.t4 = function () { - return ({}); -}; -objc8.t5 = function (n) { - return ({}); -}; -objc8.t6 = function (n, s) { - return ({}); -}; -objc8.t7 = function (n) { - return n; -}; -objc8.t8 = function (n) { - return n; -}; +objc8.t4 = function () { return ({}); }; +objc8.t5 = function (n) { return ({}); }; +objc8.t6 = function (n, s) { return ({}); }; +objc8.t7 = function (n) { return n; }; +objc8.t8 = function (n) { return n; }; objc8.t9 = [[], []]; objc8.t10 = [({}), ({})]; -objc8.t11 = [function (n, s) { - return s; -}]; +objc8.t11 = [function (n, s) { return s; }]; objc8.t12 = { foo: ({}) }; objc8.t13 = ({ - f: function (i, s) { - return s; - } + f: function (i, s) { return s; } }); objc8.t14 = ({ a: [] @@ -358,11 +324,7 @@ c9t5(function (n) { return ({}); }); // CONTEXT: Return statement -var c10t5 = function () { - return function (n) { - return ({}); - }; -}; +var c10t5 = function () { return function (n) { return ({}); }; }; // CONTEXT: Newing a class var C11t5 = (function () { function C11t5(f) { @@ -370,51 +332,31 @@ var C11t5 = (function () { return C11t5; })(); ; -var i = new C11t5(function (n) { - return ({}); -}); +var i = new C11t5(function (n) { return ({}); }); // CONTEXT: Type annotated expression -var c12t1 = (function (s) { - return s; -}); +var c12t1 = (function (s) { return s; }); var c12t2 = ({ n: 1 }); var c12t3 = []; -var c12t4 = function () { - return ({}); -}; -var c12t5 = function (n) { - return ({}); -}; -var c12t6 = function (n, s) { - return ({}); -}; -var c12t7 = function (n) { - return n; -}; -var c12t8 = function (n) { - return n; -}; +var c12t4 = function () { return ({}); }; +var c12t5 = function (n) { return ({}); }; +var c12t6 = function (n, s) { return ({}); }; +var c12t7 = function (n) { return n; }; +var c12t8 = function (n) { return n; }; var c12t9 = [[], []]; var c12t10 = [({}), ({})]; -var c12t11 = [function (n, s) { - return s; -}]; +var c12t11 = [function (n, s) { return s; }]; var c12t12 = { foo: ({}) }; var c12t13 = ({ - f: function (i, s) { - return s; - } + f: function (i, s) { return s; } }); var c12t14 = ({ a: [] }); -function EF1(a, b) { - return a + b; -} +function EF1(a, b) { return a + b; } var efv = EF1(1, 2); function Point(x, y) { this.x = x; diff --git a/tests/baselines/reference/contextualTyping.js.map b/tests/baselines/reference/contextualTyping.js.map index 98c41439762..ba71b082ada 100644 --- a/tests/baselines/reference/contextualTyping.js.map +++ b/tests/baselines/reference/contextualTyping.js.map @@ -1,2 +1,2 @@ //// [contextualTyping.js.map] -{"version":3,"file":"contextualTyping.js","sourceRoot":"","sources":["contextualTyping.ts"],"names":["C1T5","C1T5.constructor","C2T5","C4T5","C4T5.constructor","C5T5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"AAaA,AADA,sCAAsC;IAChC,IAAI;IAAVA,SAAMA,IAAIA;QACNC,QAAGA,GAAqCA,UAASA,CAACA;YAC9C,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IAADD,WAACA;AAADA,CAACA,AAJD,IAIC;AAGD,AADA,uCAAuC;AACvC,IAAO,IAAI,CAIV;AAJD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAGA,GAAqCA,UAASA,CAACA;QACzD,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EAJM,IAAI,KAAJ,IAAI,QAIV;AAGD,AADA,gCAAgC;IAC5B,IAAI,GAA0B,CAAC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC,CAAC;AAC7D,IAAI,IAAI,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAA;AACF,IAAI,IAAI,GAAa,EAAE,CAAC;AACxB,IAAI,IAAI,GAAe;IAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AACxD,IAAI,IAAI,GAAwB,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAClE,IAAI,IAAI,GAAmC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAChF,IAAI,IAAI,GAGJ,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC;AAE9B,IAAI,IAAI,GAAqC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC;AACvE,IAAI,IAAI,GAAe,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AAC/B,IAAI,KAAK,GAAW,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,IAAI,KAAK,GAAwC,CAAC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC,CAAC;AAChF,IAAI,KAAK,GAAS;IACd,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC;QAAI,MAAM,CAAC,CAAC,CAAC;IAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAGF,AADA,qCAAqC;IAC/B,IAAI;IAENC,SAFEA,IAAIA;QAGFC,IAAIA,CAACA,GAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;YACpB,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IACLD,WAACA;AAADA,CAACA,AAPD,IAOC;AAGD,AADA,sCAAsC;AACtC,IAAO,IAAI,CAKV;AALD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAqCA,CAACA;IACjDA,QAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;QACf,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EALM,IAAI,KAAJ,IAAI,QAKV;AAGD,AADA,+BAA+B;IAC3B,IAAyB,CAAC;AAC9B,IAAI,GAAwB,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAG9D,AADA,kCAAkC;IAC9B,IAAY,CAAC;AACjB,IAAI,CAAC,CAAC,CAAC,GAAS,CAAC,EAAC,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC;AAuBzB,IAAI,KAAK,GAkBS,CAAC,EAAE,CAAC,CAAC;AAEvB,KAAK,CAAC,EAAE,GAAG,CAAC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC,CAAC;AACtC,KAAK,CAAC,EAAE,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;AACd,KAAK,CAAC,EAAE,GAAG;IAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAC5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAC7C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAChD,KAAK,CAAC,EAAE,GAAG,UAAS,CAAS;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC;AAE5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC;AACrC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACnB,KAAK,CAAC,GAAG,GAAG,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC,CAAC;AAC3C,KAAK,CAAC,GAAG,GAAG;IACR,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC;QAAI,MAAM,CAAC,CAAC,CAAC;IAAC,CAAC;CAClC,CAAC,CAAA;AACF,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAEF,AADA,yBAAyB;SAChB,IAAI,CAAC,CAAsB,KAAI;AAAA,CAAC;AACzC,IAAI,CAAC,UAAS,CAAC;IACX,MAAM,CAAO,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC;AAGH,AADA,4BAA4B;IACxB,KAAK,GAA8B;IAAa,MAAM,CAAC,UAAS,CAAC;QAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;IAAC,CAAC,CAAA;AAAC,CAAC,CAAC;AAG/F,AADA,0BAA0B;IACpB,KAAK;IAAGC,SAARA,KAAKA,CAAeA,CAAsBA;IAAIC,CAACA;IAACD,YAACA;AAADA,CAACA,AAAvD,IAAuD;AAAA,CAAC;AACxD,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC,CAAC;AAGrD,AADA,qCAAqC;IACjC,KAAK,GAA2B,CAAC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC,CAAC;AAC/D,IAAI,KAAK,GAAU,CAAC;IAChB,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,IAAI,KAAK,GAAc,EAAE,CAAC;AAC1B,IAAI,KAAK,GAAgB;IAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAC1D,IAAI,KAAK,GAAyB,UAAS,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AACpE,IAAI,KAAK,GAAoC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA;AAAC,CAAC,CAAC;AAClF,IAAI,KAAK,GAGN,UAAS,CAAQ;IAAI,MAAM,CAAC,CAAC,CAAA;AAAC,CAAC,CAAC;AAEnC,IAAI,KAAK,GAAsC,UAAS,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC;AACzE,IAAI,KAAK,GAAgB,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACjC,IAAI,MAAM,GAAY,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9C,IAAI,MAAM,GAAyC,CAAC,UAAS,CAAC,EAAE,CAAC;IAAI,MAAM,CAAC,CAAC,CAAC;AAAC,CAAC,CAAC,CAAC;AAClF,IAAI,MAAM,GAAU;IAChB,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC;QAAI,MAAM,CAAC,CAAC,CAAC;IAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAOF,SAAS,GAAG,CAAC,CAAC,EAAC,CAAC;IAAIE,MAAMA,CAACA,CAACA,GAACA,CAACA,CAACA;AAACA,CAACA;AAEjC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAcnB,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;IACfC,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IACXA,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IAEXA,MAAMA,CAACA,IAAIA,CAACA;AAChBA,CAACA;AAED,KAAK,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/B,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,UAAS,EAAE,EAAE,EAAE;IACjC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,KAAK,CAAC,SAAS,GAAG;IACd,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,GAAG,EAAE,UAAS,EAAE,EAAE,EAAE;QAChB,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAC;AAIF,IAAI,CAAC,GAAM,EAAG,CAAC"} \ No newline at end of file +{"version":3,"file":"contextualTyping.js","sourceRoot":"","sources":["contextualTyping.ts"],"names":["C1T5","C1T5.constructor","C2T5","C4T5","C4T5.constructor","C5T5","C11t5","C11t5.constructor","EF1","Point"],"mappings":"AAaA,AADA,sCAAsC;IAChC,IAAI;IAAVA,SAAMA,IAAIA;QACNC,QAAGA,GAAqCA,UAASA,CAACA;YAC9C,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IAADD,WAACA;AAADA,CAACA,AAJD,IAIC;AAGD,AADA,uCAAuC;AACvC,IAAO,IAAI,CAIV;AAJD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAGA,GAAqCA,UAASA,CAACA;QACzD,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EAJM,IAAI,KAAJ,IAAI,QAIV;AAGD,AADA,gCAAgC;IAC5B,IAAI,GAA0B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAC7D,IAAI,IAAI,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAA;AACF,IAAI,IAAI,GAAa,EAAE,CAAC;AACxB,IAAI,IAAI,GAAe,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AACxD,IAAI,IAAI,GAAwB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAClE,IAAI,IAAI,GAAmC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAChF,IAAI,IAAI,GAGJ,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9B,IAAI,IAAI,GAAqC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvE,IAAI,IAAI,GAAe,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AAC/B,IAAI,KAAK,GAAW,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,IAAI,KAAK,GAAwC,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,IAAI,KAAK,GAAS;IACd,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,KAAK,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAGF,AADA,qCAAqC;IAC/B,IAAI;IAENC,SAFEA,IAAIA;QAGFC,IAAIA,CAACA,GAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;YACpB,MAAM,CAAC,CAAC,CAAC;QACb,CAAC,CAAAA;IACLA,CAACA;IACLD,WAACA;AAADA,CAACA,AAPD,IAOC;AAGD,AADA,sCAAsC;AACtC,IAAO,IAAI,CAKV;AALD,WAAO,IAAI,EAAC,CAAC;IACEE,QAAqCA,CAACA;IACjDA,QAAGA,GAAGA,UAASA,CAACA,EAAEA,CAACA;QACf,MAAM,CAAC,CAAC,CAAC;IACb,CAAC,CAAAA;AACLA,CAACA,EALM,IAAI,KAAJ,IAAI,QAKV;AAGD,AADA,+BAA+B;IAC3B,IAAyB,CAAC;AAC9B,IAAI,GAAwB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAG9D,AADA,kCAAkC;IAC9B,IAAY,CAAC;AACjB,IAAI,CAAC,CAAC,CAAC,GAAS,CAAC,EAAC,CAAC,EAAE,CAAC,EAAC,CAAC,CAAC;AAuBzB,IAAI,KAAK,GAkBS,CAAC,EAAE,CAAC,CAAC;AAEvB,KAAK,CAAC,EAAE,GAAG,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AACtC,KAAK,CAAC,EAAE,GAAS,CAAC;IACd,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;AACd,KAAK,CAAC,EAAE,GAAG,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC7C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAChD,KAAK,CAAC,EAAE,GAAG,UAAS,CAAS,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAE5C,KAAK,CAAC,EAAE,GAAG,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrC,KAAK,CAAC,EAAE,GAAG,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACnB,KAAK,CAAC,GAAG,GAAG,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AACpC,KAAK,CAAC,GAAG,GAAG,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3C,KAAK,CAAC,GAAG,GAAG;IACR,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,KAAK,CAAC,GAAG,GAAS,CAAC;IACf,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAEF,AADA,yBAAyB;SAChB,IAAI,CAAC,CAAsB,KAAI;AAAA,CAAC;AACzC,IAAI,CAAC,UAAS,CAAC;IACX,MAAM,CAAO,CAAC,EAAE,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC;AAGH,AADA,4BAA4B;IACxB,KAAK,GAA8B,cAAa,MAAM,CAAC,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAG/F,AADA,0BAA0B;IACpB,KAAK;IAAGC,SAARA,KAAKA,CAAeA,CAAsBA;IAAIC,CAACA;IAACD,YAACA;AAADA,CAACA,AAAvD,IAAuD;AAAA,CAAC;AACxD,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAGrD,AADA,qCAAqC;IACjC,KAAK,GAA2B,CAAC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;AAC/D,IAAI,KAAK,GAAU,CAAC;IAChB,CAAC,EAAE,CAAC;CACP,CAAC,CAAC;AACH,IAAI,KAAK,GAAc,EAAE,CAAC;AAC1B,IAAI,KAAK,GAAgB,cAAa,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAC1D,IAAI,KAAK,GAAyB,UAAS,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AACpE,IAAI,KAAK,GAAoC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAO,CAAC,EAAE,CAAC,CAAA,CAAC,CAAC,CAAC;AAClF,IAAI,KAAK,GAGN,UAAS,CAAQ,IAAI,MAAM,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC;AAEnC,IAAI,KAAK,GAAsC,UAAS,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzE,IAAI,KAAK,GAAgB,CAAC,EAAE,EAAC,EAAE,CAAC,CAAC;AACjC,IAAI,MAAM,GAAY,CAAO,CAAC,EAAE,CAAC,EAAO,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9C,IAAI,MAAM,GAAyC,CAAC,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClF,IAAI,MAAM,GAAU;IAChB,GAAG,EAAQ,CAAC,EAAE,CAAC;CAClB,CAAA;AACD,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,UAAS,CAAC,EAAE,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC,CAAA;AACF,IAAI,MAAM,GAAU,CAAC;IACjB,CAAC,EAAE,EAAE;CACR,CAAC,CAAA;AAOF,SAAS,GAAG,CAAC,CAAC,EAAC,CAAC,IAAIE,MAAMA,CAACA,CAACA,GAACA,CAACA,CAACA,CAACA,CAACA;AAEjC,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,EAAC,CAAC,CAAC,CAAC;AAcnB,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;IACfC,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IACXA,IAAIA,CAACA,CAACA,GAAGA,CAACA,CAACA;IAEXA,MAAMA,CAACA,IAAIA,CAACA;AAChBA,CAACA;AAED,KAAK,CAAC,MAAM,GAAG,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/B,KAAK,CAAC,SAAS,CAAC,GAAG,GAAG,UAAS,EAAE,EAAE,EAAE;IACjC,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF,KAAK,CAAC,SAAS,GAAG;IACd,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,GAAG,EAAE,UAAS,EAAE,EAAE,EAAE;QAChB,MAAM,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/C,CAAC;CACJ,CAAC;AAIF,IAAI,CAAC,GAAM,EAAG,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping.sourcemap.txt b/tests/baselines/reference/contextualTyping.sourcemap.txt index 6f9c9d2c1ec..5843e0f3f24 100644 --- a/tests/baselines/reference/contextualTyping.sourcemap.txt +++ b/tests/baselines/reference/contextualTyping.sourcemap.txt @@ -273,6 +273,7 @@ sourceFile:contextualTyping.ts 1-> 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^-> 1-> > >// CONTEXT: Variable declaration @@ -283,76 +284,71 @@ sourceFile:contextualTyping.ts 2 >Emitted(17, 1) Source(27, 1) + SourceIndex(0) 3 >Emitted(17, 33) Source(27, 33) + SourceIndex(0) --- ->>>var c3t1 = (function (s) { -1 >^^^^ +>>>var c3t1 = (function (s) { return s; }); +1->^^^^ 2 > ^^^^ 3 > ^^^ 4 > ^ 5 > ^^^^^^^^^^ 6 > ^ -1 > +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +1-> >var 2 > c3t1 3 > : (s: string) => string = 4 > ( 5 > function( 6 > s -1 >Emitted(18, 5) Source(28, 5) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> s +11> +12> +13> } +14> ) +15> ; +1->Emitted(18, 5) Source(28, 5) + SourceIndex(0) 2 >Emitted(18, 9) Source(28, 9) + SourceIndex(0) 3 >Emitted(18, 12) Source(28, 35) + SourceIndex(0) 4 >Emitted(18, 13) Source(28, 36) + SourceIndex(0) 5 >Emitted(18, 23) Source(28, 45) + SourceIndex(0) 6 >Emitted(18, 24) Source(28, 46) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > -1 >Emitted(19, 5) Source(28, 50) + SourceIndex(0) -2 >Emitted(19, 11) Source(28, 56) + SourceIndex(0) -3 >Emitted(19, 12) Source(28, 57) + SourceIndex(0) -4 >Emitted(19, 13) Source(28, 58) + SourceIndex(0) -5 >Emitted(19, 14) Source(28, 58) + SourceIndex(0) ---- ->>>}); -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^-> -1 > -2 >} -3 > ) -4 > ; -1 >Emitted(20, 1) Source(28, 59) + SourceIndex(0) -2 >Emitted(20, 2) Source(28, 60) + SourceIndex(0) -3 >Emitted(20, 3) Source(28, 61) + SourceIndex(0) -4 >Emitted(20, 4) Source(28, 62) + SourceIndex(0) +7 >Emitted(18, 28) Source(28, 50) + SourceIndex(0) +8 >Emitted(18, 34) Source(28, 56) + SourceIndex(0) +9 >Emitted(18, 35) Source(28, 57) + SourceIndex(0) +10>Emitted(18, 36) Source(28, 58) + SourceIndex(0) +11>Emitted(18, 37) Source(28, 58) + SourceIndex(0) +12>Emitted(18, 38) Source(28, 59) + SourceIndex(0) +13>Emitted(18, 39) Source(28, 60) + SourceIndex(0) +14>Emitted(18, 40) Source(28, 61) + SourceIndex(0) +15>Emitted(18, 41) Source(28, 62) + SourceIndex(0) --- >>>var c3t2 = ({ -1-> +1 > 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^ -1-> +1 > > 2 >var 3 > c3t2 4 > = 5 > ( -1->Emitted(21, 1) Source(29, 1) + SourceIndex(0) -2 >Emitted(21, 5) Source(29, 5) + SourceIndex(0) -3 >Emitted(21, 9) Source(29, 9) + SourceIndex(0) -4 >Emitted(21, 12) Source(29, 18) + SourceIndex(0) -5 >Emitted(21, 13) Source(29, 19) + SourceIndex(0) +1 >Emitted(19, 1) Source(29, 1) + SourceIndex(0) +2 >Emitted(19, 5) Source(29, 5) + SourceIndex(0) +3 >Emitted(19, 9) Source(29, 9) + SourceIndex(0) +4 >Emitted(19, 12) Source(29, 18) + SourceIndex(0) +5 >Emitted(19, 13) Source(29, 19) + SourceIndex(0) --- >>> n: 1 1 >^^^^ @@ -364,10 +360,10 @@ sourceFile:contextualTyping.ts 2 > n 3 > : 4 > 1 -1 >Emitted(22, 5) Source(30, 5) + SourceIndex(0) -2 >Emitted(22, 6) Source(30, 6) + SourceIndex(0) -3 >Emitted(22, 8) Source(30, 8) + SourceIndex(0) -4 >Emitted(22, 9) Source(30, 9) + SourceIndex(0) +1 >Emitted(20, 5) Source(30, 5) + SourceIndex(0) +2 >Emitted(20, 6) Source(30, 6) + SourceIndex(0) +3 >Emitted(20, 8) Source(30, 8) + SourceIndex(0) +4 >Emitted(20, 9) Source(30, 9) + SourceIndex(0) --- >>>}); 1 >^ @@ -378,9 +374,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(23, 2) Source(31, 2) + SourceIndex(0) -2 >Emitted(23, 3) Source(31, 3) + SourceIndex(0) -3 >Emitted(23, 4) Source(31, 3) + SourceIndex(0) +1 >Emitted(21, 2) Source(31, 2) + SourceIndex(0) +2 >Emitted(21, 3) Source(31, 3) + SourceIndex(0) +3 >Emitted(21, 4) Source(31, 3) + SourceIndex(0) --- >>>var c3t3 = []; 1-> @@ -389,7 +385,7 @@ sourceFile:contextualTyping.ts 4 > ^^^ 5 > ^^ 6 > ^ -7 > ^^^^^^^^^^^-> +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -397,71 +393,77 @@ sourceFile:contextualTyping.ts 4 > : number[] = 5 > [] 6 > ; -1->Emitted(24, 1) Source(32, 1) + SourceIndex(0) -2 >Emitted(24, 5) Source(32, 5) + SourceIndex(0) -3 >Emitted(24, 9) Source(32, 9) + SourceIndex(0) -4 >Emitted(24, 12) Source(32, 22) + SourceIndex(0) -5 >Emitted(24, 14) Source(32, 24) + SourceIndex(0) -6 >Emitted(24, 15) Source(32, 25) + SourceIndex(0) +1->Emitted(22, 1) Source(32, 1) + SourceIndex(0) +2 >Emitted(22, 5) Source(32, 5) + SourceIndex(0) +3 >Emitted(22, 9) Source(32, 9) + SourceIndex(0) +4 >Emitted(22, 12) Source(32, 22) + SourceIndex(0) +5 >Emitted(22, 14) Source(32, 24) + SourceIndex(0) +6 >Emitted(22, 15) Source(32, 25) + SourceIndex(0) --- ->>>var c3t4 = function () { +>>>var c3t4 = function () { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ -5 > ^^^^^^-> +5 > ^^^^^^^^^^^^^^ +6 > ^^^^^^ +7 > ^ +8 > ^ +9 > ^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^^-> 1-> > 2 >var 3 > c3t4 4 > : () => IFoo = -1->Emitted(25, 1) Source(33, 1) + SourceIndex(0) -2 >Emitted(25, 5) Source(33, 5) + SourceIndex(0) -3 >Emitted(25, 9) Source(33, 9) + SourceIndex(0) -4 >Emitted(25, 12) Source(33, 24) + SourceIndex(0) +5 > function() { +6 > return +7 > +8 > ( +9 > {} +10> ) +11> +12> +13> } +14> ; +1->Emitted(23, 1) Source(33, 1) + SourceIndex(0) +2 >Emitted(23, 5) Source(33, 5) + SourceIndex(0) +3 >Emitted(23, 9) Source(33, 9) + SourceIndex(0) +4 >Emitted(23, 12) Source(33, 24) + SourceIndex(0) +5 >Emitted(23, 26) Source(33, 37) + SourceIndex(0) +6 >Emitted(23, 32) Source(33, 43) + SourceIndex(0) +7 >Emitted(23, 33) Source(33, 50) + SourceIndex(0) +8 >Emitted(23, 34) Source(33, 51) + SourceIndex(0) +9 >Emitted(23, 36) Source(33, 53) + SourceIndex(0) +10>Emitted(23, 37) Source(33, 54) + SourceIndex(0) +11>Emitted(23, 38) Source(33, 54) + SourceIndex(0) +12>Emitted(23, 39) Source(33, 55) + SourceIndex(0) +13>Emitted(23, 40) Source(33, 56) + SourceIndex(0) +14>Emitted(23, 41) Source(33, 57) + SourceIndex(0) --- ->>> return ({}); -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1->function() { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1->Emitted(26, 5) Source(33, 37) + SourceIndex(0) -2 >Emitted(26, 11) Source(33, 43) + SourceIndex(0) -3 >Emitted(26, 12) Source(33, 50) + SourceIndex(0) -4 >Emitted(26, 13) Source(33, 51) + SourceIndex(0) -5 >Emitted(26, 15) Source(33, 53) + SourceIndex(0) -6 >Emitted(26, 16) Source(33, 54) + SourceIndex(0) -7 >Emitted(26, 17) Source(33, 54) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(27, 1) Source(33, 55) + SourceIndex(0) -2 >Emitted(27, 2) Source(33, 56) + SourceIndex(0) -3 >Emitted(27, 3) Source(33, 57) + SourceIndex(0) ---- ->>>var c3t5 = function (n) { +>>>var c3t5 = function (n) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^^^^-> 1-> > 2 >var @@ -469,49 +471,34 @@ sourceFile:contextualTyping.ts 4 > : (n: number) => IFoo = 5 > function( 6 > n -1->Emitted(28, 1) Source(34, 1) + SourceIndex(0) -2 >Emitted(28, 5) Source(34, 5) + SourceIndex(0) -3 >Emitted(28, 9) Source(34, 9) + SourceIndex(0) -4 >Emitted(28, 12) Source(34, 33) + SourceIndex(0) -5 >Emitted(28, 22) Source(34, 42) + SourceIndex(0) -6 >Emitted(28, 23) Source(34, 43) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> ( +11> {} +12> ) +13> +14> +15> } +16> ; +1->Emitted(24, 1) Source(34, 1) + SourceIndex(0) +2 >Emitted(24, 5) Source(34, 5) + SourceIndex(0) +3 >Emitted(24, 9) Source(34, 9) + SourceIndex(0) +4 >Emitted(24, 12) Source(34, 33) + SourceIndex(0) +5 >Emitted(24, 22) Source(34, 42) + SourceIndex(0) +6 >Emitted(24, 23) Source(34, 43) + SourceIndex(0) +7 >Emitted(24, 27) Source(34, 47) + SourceIndex(0) +8 >Emitted(24, 33) Source(34, 53) + SourceIndex(0) +9 >Emitted(24, 34) Source(34, 60) + SourceIndex(0) +10>Emitted(24, 35) Source(34, 61) + SourceIndex(0) +11>Emitted(24, 37) Source(34, 63) + SourceIndex(0) +12>Emitted(24, 38) Source(34, 64) + SourceIndex(0) +13>Emitted(24, 39) Source(34, 64) + SourceIndex(0) +14>Emitted(24, 40) Source(34, 65) + SourceIndex(0) +15>Emitted(24, 41) Source(34, 66) + SourceIndex(0) +16>Emitted(24, 42) Source(34, 67) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(29, 5) Source(34, 47) + SourceIndex(0) -2 >Emitted(29, 11) Source(34, 53) + SourceIndex(0) -3 >Emitted(29, 12) Source(34, 60) + SourceIndex(0) -4 >Emitted(29, 13) Source(34, 61) + SourceIndex(0) -5 >Emitted(29, 15) Source(34, 63) + SourceIndex(0) -6 >Emitted(29, 16) Source(34, 64) + SourceIndex(0) -7 >Emitted(29, 17) Source(34, 64) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(30, 1) Source(34, 65) + SourceIndex(0) -2 >Emitted(30, 2) Source(34, 66) + SourceIndex(0) -3 >Emitted(30, 3) Source(34, 67) + SourceIndex(0) ---- ->>>var c3t6 = function (n, s) { +>>>var c3t6 = function (n, s) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^ @@ -520,6 +507,16 @@ sourceFile:contextualTyping.ts 6 > ^ 7 > ^^ 8 > ^ +9 > ^^^^ +10> ^^^^^^ +11> ^ +12> ^ +13> ^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ 1-> > 2 >var @@ -529,58 +526,52 @@ sourceFile:contextualTyping.ts 6 > n 7 > , 8 > s -1->Emitted(31, 1) Source(35, 1) + SourceIndex(0) -2 >Emitted(31, 5) Source(35, 5) + SourceIndex(0) -3 >Emitted(31, 9) Source(35, 9) + SourceIndex(0) -4 >Emitted(31, 12) Source(35, 44) + SourceIndex(0) -5 >Emitted(31, 22) Source(35, 53) + SourceIndex(0) -6 >Emitted(31, 23) Source(35, 54) + SourceIndex(0) -7 >Emitted(31, 25) Source(35, 56) + SourceIndex(0) -8 >Emitted(31, 26) Source(35, 57) + SourceIndex(0) +9 > ) { +10> return +11> +12> ( +13> {} +14> ) +15> +16> +17> } +18> ; +1->Emitted(25, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(25, 5) Source(35, 5) + SourceIndex(0) +3 >Emitted(25, 9) Source(35, 9) + SourceIndex(0) +4 >Emitted(25, 12) Source(35, 44) + SourceIndex(0) +5 >Emitted(25, 22) Source(35, 53) + SourceIndex(0) +6 >Emitted(25, 23) Source(35, 54) + SourceIndex(0) +7 >Emitted(25, 25) Source(35, 56) + SourceIndex(0) +8 >Emitted(25, 26) Source(35, 57) + SourceIndex(0) +9 >Emitted(25, 30) Source(35, 61) + SourceIndex(0) +10>Emitted(25, 36) Source(35, 67) + SourceIndex(0) +11>Emitted(25, 37) Source(35, 74) + SourceIndex(0) +12>Emitted(25, 38) Source(35, 75) + SourceIndex(0) +13>Emitted(25, 40) Source(35, 77) + SourceIndex(0) +14>Emitted(25, 41) Source(35, 78) + SourceIndex(0) +15>Emitted(25, 42) Source(35, 78) + SourceIndex(0) +16>Emitted(25, 43) Source(35, 79) + SourceIndex(0) +17>Emitted(25, 44) Source(35, 80) + SourceIndex(0) +18>Emitted(25, 45) Source(35, 81) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(32, 5) Source(35, 61) + SourceIndex(0) -2 >Emitted(32, 11) Source(35, 67) + SourceIndex(0) -3 >Emitted(32, 12) Source(35, 74) + SourceIndex(0) -4 >Emitted(32, 13) Source(35, 75) + SourceIndex(0) -5 >Emitted(32, 15) Source(35, 77) + SourceIndex(0) -6 >Emitted(32, 16) Source(35, 78) + SourceIndex(0) -7 >Emitted(32, 17) Source(35, 78) + SourceIndex(0) ---- ->>>}; +>>>var c3t7 = function (n) { return n; }; 1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(33, 1) Source(35, 79) + SourceIndex(0) -2 >Emitted(33, 2) Source(35, 80) + SourceIndex(0) -3 >Emitted(33, 3) Source(35, 81) + SourceIndex(0) ---- ->>>var c3t7 = function (n) { -1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ -1-> +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^-> +1 > > 2 >var 3 > c3t7 @@ -590,49 +581,44 @@ sourceFile:contextualTyping.ts > } = 5 > function( 6 > n -1->Emitted(34, 1) Source(36, 1) + SourceIndex(0) -2 >Emitted(34, 5) Source(36, 5) + SourceIndex(0) -3 >Emitted(34, 9) Source(36, 9) + SourceIndex(0) -4 >Emitted(34, 12) Source(39, 5) + SourceIndex(0) -5 >Emitted(34, 22) Source(39, 14) + SourceIndex(0) -6 >Emitted(34, 23) Source(39, 15) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> n +11> ; +12> +13> } +14> ; +1 >Emitted(26, 1) Source(36, 1) + SourceIndex(0) +2 >Emitted(26, 5) Source(36, 5) + SourceIndex(0) +3 >Emitted(26, 9) Source(36, 9) + SourceIndex(0) +4 >Emitted(26, 12) Source(39, 5) + SourceIndex(0) +5 >Emitted(26, 22) Source(39, 14) + SourceIndex(0) +6 >Emitted(26, 23) Source(39, 15) + SourceIndex(0) +7 >Emitted(26, 27) Source(39, 19) + SourceIndex(0) +8 >Emitted(26, 33) Source(39, 25) + SourceIndex(0) +9 >Emitted(26, 34) Source(39, 26) + SourceIndex(0) +10>Emitted(26, 35) Source(39, 27) + SourceIndex(0) +11>Emitted(26, 36) Source(39, 28) + SourceIndex(0) +12>Emitted(26, 37) Source(39, 29) + SourceIndex(0) +13>Emitted(26, 38) Source(39, 30) + SourceIndex(0) +14>Emitted(26, 39) Source(39, 31) + SourceIndex(0) --- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > ; -1 >Emitted(35, 5) Source(39, 19) + SourceIndex(0) -2 >Emitted(35, 11) Source(39, 25) + SourceIndex(0) -3 >Emitted(35, 12) Source(39, 26) + SourceIndex(0) -4 >Emitted(35, 13) Source(39, 27) + SourceIndex(0) -5 >Emitted(35, 14) Source(39, 28) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(36, 1) Source(39, 29) + SourceIndex(0) -2 >Emitted(36, 2) Source(39, 30) + SourceIndex(0) -3 >Emitted(36, 3) Source(39, 31) + SourceIndex(0) ---- ->>>var c3t8 = function (n) { +>>>var c3t8 = function (n) { return n; }; 1-> 2 >^^^^ 3 > ^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1-> > > @@ -641,44 +627,31 @@ sourceFile:contextualTyping.ts 4 > : (n: number, s: string) => number = 5 > function( 6 > n -1->Emitted(37, 1) Source(41, 1) + SourceIndex(0) -2 >Emitted(37, 5) Source(41, 5) + SourceIndex(0) -3 >Emitted(37, 9) Source(41, 9) + SourceIndex(0) -4 >Emitted(37, 12) Source(41, 46) + SourceIndex(0) -5 >Emitted(37, 22) Source(41, 55) + SourceIndex(0) -6 >Emitted(37, 23) Source(41, 56) + SourceIndex(0) ---- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > ; -1 >Emitted(38, 5) Source(41, 60) + SourceIndex(0) -2 >Emitted(38, 11) Source(41, 66) + SourceIndex(0) -3 >Emitted(38, 12) Source(41, 67) + SourceIndex(0) -4 >Emitted(38, 13) Source(41, 68) + SourceIndex(0) -5 >Emitted(38, 14) Source(41, 69) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(39, 1) Source(41, 70) + SourceIndex(0) -2 >Emitted(39, 2) Source(41, 71) + SourceIndex(0) -3 >Emitted(39, 3) Source(41, 72) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> n +11> ; +12> +13> } +14> ; +1->Emitted(27, 1) Source(41, 1) + SourceIndex(0) +2 >Emitted(27, 5) Source(41, 5) + SourceIndex(0) +3 >Emitted(27, 9) Source(41, 9) + SourceIndex(0) +4 >Emitted(27, 12) Source(41, 46) + SourceIndex(0) +5 >Emitted(27, 22) Source(41, 55) + SourceIndex(0) +6 >Emitted(27, 23) Source(41, 56) + SourceIndex(0) +7 >Emitted(27, 27) Source(41, 60) + SourceIndex(0) +8 >Emitted(27, 33) Source(41, 66) + SourceIndex(0) +9 >Emitted(27, 34) Source(41, 67) + SourceIndex(0) +10>Emitted(27, 35) Source(41, 68) + SourceIndex(0) +11>Emitted(27, 36) Source(41, 69) + SourceIndex(0) +12>Emitted(27, 37) Source(41, 70) + SourceIndex(0) +13>Emitted(27, 38) Source(41, 71) + SourceIndex(0) +14>Emitted(27, 39) Source(41, 72) + SourceIndex(0) --- >>>var c3t9 = [[], []]; -1-> +1 > 2 >^^^^ 3 > ^^^^ 4 > ^^^ @@ -689,7 +662,7 @@ sourceFile:contextualTyping.ts 9 > ^ 10> ^ 11> ^^^^^^-> -1-> +1 > > 2 >var 3 > c3t9 @@ -700,16 +673,16 @@ sourceFile:contextualTyping.ts 8 > [] 9 > ] 10> ; -1->Emitted(40, 1) Source(42, 1) + SourceIndex(0) -2 >Emitted(40, 5) Source(42, 5) + SourceIndex(0) -3 >Emitted(40, 9) Source(42, 9) + SourceIndex(0) -4 >Emitted(40, 12) Source(42, 24) + SourceIndex(0) -5 >Emitted(40, 13) Source(42, 25) + SourceIndex(0) -6 >Emitted(40, 15) Source(42, 27) + SourceIndex(0) -7 >Emitted(40, 17) Source(42, 28) + SourceIndex(0) -8 >Emitted(40, 19) Source(42, 30) + SourceIndex(0) -9 >Emitted(40, 20) Source(42, 31) + SourceIndex(0) -10>Emitted(40, 21) Source(42, 32) + SourceIndex(0) +1 >Emitted(28, 1) Source(42, 1) + SourceIndex(0) +2 >Emitted(28, 5) Source(42, 5) + SourceIndex(0) +3 >Emitted(28, 9) Source(42, 9) + SourceIndex(0) +4 >Emitted(28, 12) Source(42, 24) + SourceIndex(0) +5 >Emitted(28, 13) Source(42, 25) + SourceIndex(0) +6 >Emitted(28, 15) Source(42, 27) + SourceIndex(0) +7 >Emitted(28, 17) Source(42, 28) + SourceIndex(0) +8 >Emitted(28, 19) Source(42, 30) + SourceIndex(0) +9 >Emitted(28, 20) Source(42, 31) + SourceIndex(0) +10>Emitted(28, 21) Source(42, 32) + SourceIndex(0) --- >>>var c3t10 = [({}), ({})]; 1-> @@ -726,7 +699,7 @@ sourceFile:contextualTyping.ts 12> ^ 13> ^ 14> ^ -15> ^^^^^^-> +15> ^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -742,22 +715,22 @@ sourceFile:contextualTyping.ts 12> ) 13> ] 14> ; -1->Emitted(41, 1) Source(43, 1) + SourceIndex(0) -2 >Emitted(41, 5) Source(43, 5) + SourceIndex(0) -3 >Emitted(41, 10) Source(43, 10) + SourceIndex(0) -4 >Emitted(41, 13) Source(43, 21) + SourceIndex(0) -5 >Emitted(41, 14) Source(43, 28) + SourceIndex(0) -6 >Emitted(41, 15) Source(43, 29) + SourceIndex(0) -7 >Emitted(41, 17) Source(43, 31) + SourceIndex(0) -8 >Emitted(41, 18) Source(43, 32) + SourceIndex(0) -9 >Emitted(41, 20) Source(43, 39) + SourceIndex(0) -10>Emitted(41, 21) Source(43, 40) + SourceIndex(0) -11>Emitted(41, 23) Source(43, 42) + SourceIndex(0) -12>Emitted(41, 24) Source(43, 43) + SourceIndex(0) -13>Emitted(41, 25) Source(43, 44) + SourceIndex(0) -14>Emitted(41, 26) Source(43, 45) + SourceIndex(0) +1->Emitted(29, 1) Source(43, 1) + SourceIndex(0) +2 >Emitted(29, 5) Source(43, 5) + SourceIndex(0) +3 >Emitted(29, 10) Source(43, 10) + SourceIndex(0) +4 >Emitted(29, 13) Source(43, 21) + SourceIndex(0) +5 >Emitted(29, 14) Source(43, 28) + SourceIndex(0) +6 >Emitted(29, 15) Source(43, 29) + SourceIndex(0) +7 >Emitted(29, 17) Source(43, 31) + SourceIndex(0) +8 >Emitted(29, 18) Source(43, 32) + SourceIndex(0) +9 >Emitted(29, 20) Source(43, 39) + SourceIndex(0) +10>Emitted(29, 21) Source(43, 40) + SourceIndex(0) +11>Emitted(29, 23) Source(43, 42) + SourceIndex(0) +12>Emitted(29, 24) Source(43, 43) + SourceIndex(0) +13>Emitted(29, 25) Source(43, 44) + SourceIndex(0) +14>Emitted(29, 26) Source(43, 45) + SourceIndex(0) --- ->>>var c3t11 = [function (n, s) { +>>>var c3t11 = [function (n, s) { return s; }]; 1-> 2 >^^^^ 3 > ^^^^^ @@ -767,6 +740,15 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^ 9 > ^ +10> ^^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ 1-> > 2 >var @@ -777,63 +759,49 @@ sourceFile:contextualTyping.ts 7 > n 8 > , 9 > s -1->Emitted(42, 1) Source(44, 1) + SourceIndex(0) -2 >Emitted(42, 5) Source(44, 5) + SourceIndex(0) -3 >Emitted(42, 10) Source(44, 10) + SourceIndex(0) -4 >Emitted(42, 13) Source(44, 50) + SourceIndex(0) -5 >Emitted(42, 14) Source(44, 51) + SourceIndex(0) -6 >Emitted(42, 24) Source(44, 60) + SourceIndex(0) -7 >Emitted(42, 25) Source(44, 61) + SourceIndex(0) -8 >Emitted(42, 27) Source(44, 63) + SourceIndex(0) -9 >Emitted(42, 28) Source(44, 64) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(43, 5) Source(44, 68) + SourceIndex(0) -2 >Emitted(43, 11) Source(44, 74) + SourceIndex(0) -3 >Emitted(43, 12) Source(44, 75) + SourceIndex(0) -4 >Emitted(43, 13) Source(44, 76) + SourceIndex(0) -5 >Emitted(43, 14) Source(44, 77) + SourceIndex(0) ---- ->>>}]; -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^-> -1 > -2 >} -3 > ] -4 > ; -1 >Emitted(44, 1) Source(44, 78) + SourceIndex(0) -2 >Emitted(44, 2) Source(44, 79) + SourceIndex(0) -3 >Emitted(44, 3) Source(44, 80) + SourceIndex(0) -4 >Emitted(44, 4) Source(44, 81) + SourceIndex(0) +10> ) { +11> return +12> +13> s +14> ; +15> +16> } +17> ] +18> ; +1->Emitted(30, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(30, 5) Source(44, 5) + SourceIndex(0) +3 >Emitted(30, 10) Source(44, 10) + SourceIndex(0) +4 >Emitted(30, 13) Source(44, 50) + SourceIndex(0) +5 >Emitted(30, 14) Source(44, 51) + SourceIndex(0) +6 >Emitted(30, 24) Source(44, 60) + SourceIndex(0) +7 >Emitted(30, 25) Source(44, 61) + SourceIndex(0) +8 >Emitted(30, 27) Source(44, 63) + SourceIndex(0) +9 >Emitted(30, 28) Source(44, 64) + SourceIndex(0) +10>Emitted(30, 32) Source(44, 68) + SourceIndex(0) +11>Emitted(30, 38) Source(44, 74) + SourceIndex(0) +12>Emitted(30, 39) Source(44, 75) + SourceIndex(0) +13>Emitted(30, 40) Source(44, 76) + SourceIndex(0) +14>Emitted(30, 41) Source(44, 77) + SourceIndex(0) +15>Emitted(30, 42) Source(44, 78) + SourceIndex(0) +16>Emitted(30, 43) Source(44, 79) + SourceIndex(0) +17>Emitted(30, 44) Source(44, 80) + SourceIndex(0) +18>Emitted(30, 45) Source(44, 81) + SourceIndex(0) --- >>>var c3t12 = { -1-> +1 > 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^^-> -1-> +1 > > 2 >var 3 > c3t12 4 > : IBar = -1->Emitted(45, 1) Source(45, 1) + SourceIndex(0) -2 >Emitted(45, 5) Source(45, 5) + SourceIndex(0) -3 >Emitted(45, 10) Source(45, 10) + SourceIndex(0) -4 >Emitted(45, 13) Source(45, 19) + SourceIndex(0) +1 >Emitted(31, 1) Source(45, 1) + SourceIndex(0) +2 >Emitted(31, 5) Source(45, 5) + SourceIndex(0) +3 >Emitted(31, 10) Source(45, 10) + SourceIndex(0) +4 >Emitted(31, 13) Source(45, 19) + SourceIndex(0) --- >>> foo: ({}) 1->^^^^ @@ -849,12 +817,12 @@ sourceFile:contextualTyping.ts 4 > ( 5 > {} 6 > ) -1->Emitted(46, 5) Source(46, 5) + SourceIndex(0) -2 >Emitted(46, 8) Source(46, 8) + SourceIndex(0) -3 >Emitted(46, 10) Source(46, 16) + SourceIndex(0) -4 >Emitted(46, 11) Source(46, 17) + SourceIndex(0) -5 >Emitted(46, 13) Source(46, 19) + SourceIndex(0) -6 >Emitted(46, 14) Source(46, 20) + SourceIndex(0) +1->Emitted(32, 5) Source(46, 5) + SourceIndex(0) +2 >Emitted(32, 8) Source(46, 8) + SourceIndex(0) +3 >Emitted(32, 10) Source(46, 16) + SourceIndex(0) +4 >Emitted(32, 11) Source(46, 17) + SourceIndex(0) +5 >Emitted(32, 13) Source(46, 19) + SourceIndex(0) +6 >Emitted(32, 14) Source(46, 20) + SourceIndex(0) --- >>>}; 1 >^ @@ -863,8 +831,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > -1 >Emitted(47, 2) Source(47, 2) + SourceIndex(0) -2 >Emitted(47, 3) Source(47, 2) + SourceIndex(0) +1 >Emitted(33, 2) Source(47, 2) + SourceIndex(0) +2 >Emitted(33, 3) Source(47, 2) + SourceIndex(0) --- >>>var c3t13 = ({ 1-> @@ -872,20 +840,20 @@ sourceFile:contextualTyping.ts 3 > ^^^^^ 4 > ^^^ 5 > ^ -6 > ^^^^^^^^^^^^-> +6 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var 3 > c3t13 4 > = 5 > ( -1->Emitted(48, 1) Source(48, 1) + SourceIndex(0) -2 >Emitted(48, 5) Source(48, 5) + SourceIndex(0) -3 >Emitted(48, 10) Source(48, 10) + SourceIndex(0) -4 >Emitted(48, 13) Source(48, 19) + SourceIndex(0) -5 >Emitted(48, 14) Source(48, 20) + SourceIndex(0) +1->Emitted(34, 1) Source(48, 1) + SourceIndex(0) +2 >Emitted(34, 5) Source(48, 5) + SourceIndex(0) +3 >Emitted(34, 10) Source(48, 10) + SourceIndex(0) +4 >Emitted(34, 13) Source(48, 19) + SourceIndex(0) +5 >Emitted(34, 14) Source(48, 20) + SourceIndex(0) --- ->>> f: function (i, s) { +>>> f: function (i, s) { return s; } 1->^^^^ 2 > ^ 3 > ^^ @@ -893,6 +861,13 @@ sourceFile:contextualTyping.ts 5 > ^ 6 > ^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1->{ > 2 > f @@ -901,38 +876,27 @@ sourceFile:contextualTyping.ts 5 > i 6 > , 7 > s -1->Emitted(49, 5) Source(49, 5) + SourceIndex(0) -2 >Emitted(49, 6) Source(49, 6) + SourceIndex(0) -3 >Emitted(49, 8) Source(49, 8) + SourceIndex(0) -4 >Emitted(49, 18) Source(49, 17) + SourceIndex(0) -5 >Emitted(49, 19) Source(49, 18) + SourceIndex(0) -6 >Emitted(49, 21) Source(49, 20) + SourceIndex(0) -7 >Emitted(49, 22) Source(49, 21) + SourceIndex(0) ---- ->>> return s; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(50, 9) Source(49, 25) + SourceIndex(0) -2 >Emitted(50, 15) Source(49, 31) + SourceIndex(0) -3 >Emitted(50, 16) Source(49, 32) + SourceIndex(0) -4 >Emitted(50, 17) Source(49, 33) + SourceIndex(0) -5 >Emitted(50, 18) Source(49, 34) + SourceIndex(0) ---- ->>> } -1 >^^^^ -2 > ^ -1 > -2 > } -1 >Emitted(51, 5) Source(49, 35) + SourceIndex(0) -2 >Emitted(51, 6) Source(49, 36) + SourceIndex(0) +8 > ) { +9 > return +10> +11> s +12> ; +13> +14> } +1->Emitted(35, 5) Source(49, 5) + SourceIndex(0) +2 >Emitted(35, 6) Source(49, 6) + SourceIndex(0) +3 >Emitted(35, 8) Source(49, 8) + SourceIndex(0) +4 >Emitted(35, 18) Source(49, 17) + SourceIndex(0) +5 >Emitted(35, 19) Source(49, 18) + SourceIndex(0) +6 >Emitted(35, 21) Source(49, 20) + SourceIndex(0) +7 >Emitted(35, 22) Source(49, 21) + SourceIndex(0) +8 >Emitted(35, 26) Source(49, 25) + SourceIndex(0) +9 >Emitted(35, 32) Source(49, 31) + SourceIndex(0) +10>Emitted(35, 33) Source(49, 32) + SourceIndex(0) +11>Emitted(35, 34) Source(49, 33) + SourceIndex(0) +12>Emitted(35, 35) Source(49, 34) + SourceIndex(0) +13>Emitted(35, 36) Source(49, 35) + SourceIndex(0) +14>Emitted(35, 37) Source(49, 36) + SourceIndex(0) --- >>>}); 1 >^ @@ -943,9 +907,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(52, 2) Source(50, 2) + SourceIndex(0) -2 >Emitted(52, 3) Source(50, 3) + SourceIndex(0) -3 >Emitted(52, 4) Source(50, 3) + SourceIndex(0) +1 >Emitted(36, 2) Source(50, 2) + SourceIndex(0) +2 >Emitted(36, 3) Source(50, 3) + SourceIndex(0) +3 >Emitted(36, 4) Source(50, 3) + SourceIndex(0) --- >>>var c3t14 = ({ 1-> @@ -959,11 +923,11 @@ sourceFile:contextualTyping.ts 3 > c3t14 4 > = 5 > ( -1->Emitted(53, 1) Source(51, 1) + SourceIndex(0) -2 >Emitted(53, 5) Source(51, 5) + SourceIndex(0) -3 >Emitted(53, 10) Source(51, 10) + SourceIndex(0) -4 >Emitted(53, 13) Source(51, 19) + SourceIndex(0) -5 >Emitted(53, 14) Source(51, 20) + SourceIndex(0) +1->Emitted(37, 1) Source(51, 1) + SourceIndex(0) +2 >Emitted(37, 5) Source(51, 5) + SourceIndex(0) +3 >Emitted(37, 10) Source(51, 10) + SourceIndex(0) +4 >Emitted(37, 13) Source(51, 19) + SourceIndex(0) +5 >Emitted(37, 14) Source(51, 20) + SourceIndex(0) --- >>> a: [] 1 >^^^^ @@ -975,10 +939,10 @@ sourceFile:contextualTyping.ts 2 > a 3 > : 4 > [] -1 >Emitted(54, 5) Source(52, 5) + SourceIndex(0) -2 >Emitted(54, 6) Source(52, 6) + SourceIndex(0) -3 >Emitted(54, 8) Source(52, 8) + SourceIndex(0) -4 >Emitted(54, 10) Source(52, 10) + SourceIndex(0) +1 >Emitted(38, 5) Source(52, 5) + SourceIndex(0) +2 >Emitted(38, 6) Source(52, 6) + SourceIndex(0) +3 >Emitted(38, 8) Source(52, 8) + SourceIndex(0) +4 >Emitted(38, 10) Source(52, 10) + SourceIndex(0) --- >>>}); 1 >^ @@ -989,9 +953,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(55, 2) Source(53, 2) + SourceIndex(0) -2 >Emitted(55, 3) Source(53, 3) + SourceIndex(0) -3 >Emitted(55, 4) Source(53, 3) + SourceIndex(0) +1 >Emitted(39, 2) Source(53, 2) + SourceIndex(0) +2 >Emitted(39, 3) Source(53, 3) + SourceIndex(0) +3 >Emitted(39, 4) Source(53, 3) + SourceIndex(0) --- >>>// CONTEXT: Class property assignment 1-> @@ -1003,9 +967,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Class property assignment -1->Emitted(56, 1) Source(56, 1) + SourceIndex(0) -2 >Emitted(56, 1) Source(55, 1) + SourceIndex(0) -3 >Emitted(56, 38) Source(55, 38) + SourceIndex(0) +1->Emitted(40, 1) Source(56, 1) + SourceIndex(0) +2 >Emitted(40, 1) Source(55, 1) + SourceIndex(0) +3 >Emitted(40, 38) Source(55, 38) + SourceIndex(0) --- >>>var C4T5 = (function () { 1 >^^^^ @@ -1014,8 +978,8 @@ sourceFile:contextualTyping.ts 1 > >class 2 > C4T5 -1 >Emitted(57, 5) Source(56, 7) + SourceIndex(0) -2 >Emitted(57, 9) Source(56, 11) + SourceIndex(0) +1 >Emitted(41, 5) Source(56, 7) + SourceIndex(0) +2 >Emitted(41, 9) Source(56, 11) + SourceIndex(0) --- >>> function C4T5() { 1->^^^^ @@ -1027,9 +991,9 @@ sourceFile:contextualTyping.ts > 2 > 3 > C4T5 -1->Emitted(58, 5) Source(58, 5) + SourceIndex(0) name (C4T5) -2 >Emitted(58, 14) Source(56, 7) + SourceIndex(0) name (C4T5) -3 >Emitted(58, 18) Source(56, 11) + SourceIndex(0) name (C4T5) +1->Emitted(42, 5) Source(58, 5) + SourceIndex(0) name (C4T5) +2 >Emitted(42, 14) Source(56, 7) + SourceIndex(0) name (C4T5) +3 >Emitted(42, 18) Source(56, 11) + SourceIndex(0) name (C4T5) --- >>> this.foo = function (i, s) { 1->^^^^^^^^ @@ -1053,15 +1017,15 @@ sourceFile:contextualTyping.ts 7 > i 8 > , 9 > s -1->Emitted(59, 9) Source(59, 9) + SourceIndex(0) name (C4T5.constructor) -2 >Emitted(59, 13) Source(59, 13) + SourceIndex(0) name (C4T5.constructor) -3 >Emitted(59, 14) Source(59, 14) + SourceIndex(0) name (C4T5.constructor) -4 >Emitted(59, 17) Source(59, 17) + SourceIndex(0) name (C4T5.constructor) -5 >Emitted(59, 20) Source(59, 20) + SourceIndex(0) name (C4T5.constructor) -6 >Emitted(59, 30) Source(59, 29) + SourceIndex(0) name (C4T5.constructor) -7 >Emitted(59, 31) Source(59, 30) + SourceIndex(0) name (C4T5.constructor) -8 >Emitted(59, 33) Source(59, 32) + SourceIndex(0) name (C4T5.constructor) -9 >Emitted(59, 34) Source(59, 33) + SourceIndex(0) name (C4T5.constructor) +1->Emitted(43, 9) Source(59, 9) + SourceIndex(0) name (C4T5.constructor) +2 >Emitted(43, 13) Source(59, 13) + SourceIndex(0) name (C4T5.constructor) +3 >Emitted(43, 14) Source(59, 14) + SourceIndex(0) name (C4T5.constructor) +4 >Emitted(43, 17) Source(59, 17) + SourceIndex(0) name (C4T5.constructor) +5 >Emitted(43, 20) Source(59, 20) + SourceIndex(0) name (C4T5.constructor) +6 >Emitted(43, 30) Source(59, 29) + SourceIndex(0) name (C4T5.constructor) +7 >Emitted(43, 31) Source(59, 30) + SourceIndex(0) name (C4T5.constructor) +8 >Emitted(43, 33) Source(59, 32) + SourceIndex(0) name (C4T5.constructor) +9 >Emitted(43, 34) Source(59, 33) + SourceIndex(0) name (C4T5.constructor) --- >>> return s; 1 >^^^^^^^^^^^^ @@ -1075,11 +1039,11 @@ sourceFile:contextualTyping.ts 3 > 4 > s 5 > ; -1 >Emitted(60, 13) Source(60, 13) + SourceIndex(0) -2 >Emitted(60, 19) Source(60, 19) + SourceIndex(0) -3 >Emitted(60, 20) Source(60, 20) + SourceIndex(0) -4 >Emitted(60, 21) Source(60, 21) + SourceIndex(0) -5 >Emitted(60, 22) Source(60, 22) + SourceIndex(0) +1 >Emitted(44, 13) Source(60, 13) + SourceIndex(0) +2 >Emitted(44, 19) Source(60, 19) + SourceIndex(0) +3 >Emitted(44, 20) Source(60, 20) + SourceIndex(0) +4 >Emitted(44, 21) Source(60, 21) + SourceIndex(0) +5 >Emitted(44, 22) Source(60, 22) + SourceIndex(0) --- >>> }; 1 >^^^^^^^^ @@ -1089,9 +1053,9 @@ sourceFile:contextualTyping.ts > 2 > } 3 > -1 >Emitted(61, 9) Source(61, 9) + SourceIndex(0) -2 >Emitted(61, 10) Source(61, 10) + SourceIndex(0) -3 >Emitted(61, 11) Source(61, 10) + SourceIndex(0) name (C4T5.constructor) +1 >Emitted(45, 9) Source(61, 9) + SourceIndex(0) +2 >Emitted(45, 10) Source(61, 10) + SourceIndex(0) +3 >Emitted(45, 11) Source(61, 10) + SourceIndex(0) name (C4T5.constructor) --- >>> } 1 >^^^^ @@ -1100,8 +1064,8 @@ sourceFile:contextualTyping.ts 1 > > 2 > } -1 >Emitted(62, 5) Source(62, 5) + SourceIndex(0) name (C4T5.constructor) -2 >Emitted(62, 6) Source(62, 6) + SourceIndex(0) name (C4T5.constructor) +1 >Emitted(46, 5) Source(62, 5) + SourceIndex(0) name (C4T5.constructor) +2 >Emitted(46, 6) Source(62, 6) + SourceIndex(0) name (C4T5.constructor) --- >>> return C4T5; 1->^^^^ @@ -1109,8 +1073,8 @@ sourceFile:contextualTyping.ts 1-> > 2 > } -1->Emitted(63, 5) Source(63, 1) + SourceIndex(0) name (C4T5) -2 >Emitted(63, 16) Source(63, 2) + SourceIndex(0) name (C4T5) +1->Emitted(47, 5) Source(63, 1) + SourceIndex(0) name (C4T5) +2 >Emitted(47, 16) Source(63, 2) + SourceIndex(0) name (C4T5) --- >>>})(); 1 > @@ -1129,10 +1093,10 @@ sourceFile:contextualTyping.ts > } > } > } -1 >Emitted(64, 1) Source(63, 1) + SourceIndex(0) name (C4T5) -2 >Emitted(64, 2) Source(63, 2) + SourceIndex(0) name (C4T5) -3 >Emitted(64, 2) Source(56, 1) + SourceIndex(0) -4 >Emitted(64, 6) Source(63, 2) + SourceIndex(0) +1 >Emitted(48, 1) Source(63, 1) + SourceIndex(0) name (C4T5) +2 >Emitted(48, 2) Source(63, 2) + SourceIndex(0) name (C4T5) +3 >Emitted(48, 2) Source(56, 1) + SourceIndex(0) +4 >Emitted(48, 6) Source(63, 2) + SourceIndex(0) --- >>>// CONTEXT: Module property assignment 1-> @@ -1144,9 +1108,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Module property assignment -1->Emitted(65, 1) Source(66, 1) + SourceIndex(0) -2 >Emitted(65, 1) Source(65, 1) + SourceIndex(0) -3 >Emitted(65, 39) Source(65, 39) + SourceIndex(0) +1->Emitted(49, 1) Source(66, 1) + SourceIndex(0) +2 >Emitted(49, 1) Source(65, 1) + SourceIndex(0) +3 >Emitted(49, 39) Source(65, 39) + SourceIndex(0) --- >>>var C5T5; 1 > @@ -1164,10 +1128,10 @@ sourceFile:contextualTyping.ts > return s; > } > } -1 >Emitted(66, 1) Source(66, 1) + SourceIndex(0) -2 >Emitted(66, 5) Source(66, 8) + SourceIndex(0) -3 >Emitted(66, 9) Source(66, 12) + SourceIndex(0) -4 >Emitted(66, 10) Source(71, 2) + SourceIndex(0) +1 >Emitted(50, 1) Source(66, 1) + SourceIndex(0) +2 >Emitted(50, 5) Source(66, 8) + SourceIndex(0) +3 >Emitted(50, 9) Source(66, 12) + SourceIndex(0) +4 >Emitted(50, 10) Source(71, 2) + SourceIndex(0) --- >>>(function (C5T5) { 1-> @@ -1180,11 +1144,11 @@ sourceFile:contextualTyping.ts 3 > C5T5 4 > 5 > { -1->Emitted(67, 1) Source(66, 1) + SourceIndex(0) -2 >Emitted(67, 12) Source(66, 8) + SourceIndex(0) -3 >Emitted(67, 16) Source(66, 12) + SourceIndex(0) -4 >Emitted(67, 18) Source(66, 13) + SourceIndex(0) -5 >Emitted(67, 19) Source(66, 14) + SourceIndex(0) +1->Emitted(51, 1) Source(66, 1) + SourceIndex(0) +2 >Emitted(51, 12) Source(66, 8) + SourceIndex(0) +3 >Emitted(51, 16) Source(66, 12) + SourceIndex(0) +4 >Emitted(51, 18) Source(66, 13) + SourceIndex(0) +5 >Emitted(51, 19) Source(66, 14) + SourceIndex(0) --- >>> C5T5.foo; 1 >^^^^ @@ -1195,9 +1159,9 @@ sourceFile:contextualTyping.ts > export var 2 > foo: (i: number, s: string) => string 3 > ; -1 >Emitted(68, 5) Source(67, 16) + SourceIndex(0) name (C5T5) -2 >Emitted(68, 13) Source(67, 53) + SourceIndex(0) name (C5T5) -3 >Emitted(68, 14) Source(67, 54) + SourceIndex(0) name (C5T5) +1 >Emitted(52, 5) Source(67, 16) + SourceIndex(0) name (C5T5) +2 >Emitted(52, 13) Source(67, 53) + SourceIndex(0) name (C5T5) +3 >Emitted(52, 14) Source(67, 54) + SourceIndex(0) name (C5T5) --- >>> C5T5.foo = function (i, s) { 1->^^^^ @@ -1215,13 +1179,13 @@ sourceFile:contextualTyping.ts 5 > i 6 > , 7 > s -1->Emitted(69, 5) Source(68, 5) + SourceIndex(0) name (C5T5) -2 >Emitted(69, 13) Source(68, 8) + SourceIndex(0) name (C5T5) -3 >Emitted(69, 16) Source(68, 11) + SourceIndex(0) name (C5T5) -4 >Emitted(69, 26) Source(68, 20) + SourceIndex(0) name (C5T5) -5 >Emitted(69, 27) Source(68, 21) + SourceIndex(0) name (C5T5) -6 >Emitted(69, 29) Source(68, 23) + SourceIndex(0) name (C5T5) -7 >Emitted(69, 30) Source(68, 24) + SourceIndex(0) name (C5T5) +1->Emitted(53, 5) Source(68, 5) + SourceIndex(0) name (C5T5) +2 >Emitted(53, 13) Source(68, 8) + SourceIndex(0) name (C5T5) +3 >Emitted(53, 16) Source(68, 11) + SourceIndex(0) name (C5T5) +4 >Emitted(53, 26) Source(68, 20) + SourceIndex(0) name (C5T5) +5 >Emitted(53, 27) Source(68, 21) + SourceIndex(0) name (C5T5) +6 >Emitted(53, 29) Source(68, 23) + SourceIndex(0) name (C5T5) +7 >Emitted(53, 30) Source(68, 24) + SourceIndex(0) name (C5T5) --- >>> return s; 1 >^^^^^^^^ @@ -1235,11 +1199,11 @@ sourceFile:contextualTyping.ts 3 > 4 > s 5 > ; -1 >Emitted(70, 9) Source(69, 9) + SourceIndex(0) -2 >Emitted(70, 15) Source(69, 15) + SourceIndex(0) -3 >Emitted(70, 16) Source(69, 16) + SourceIndex(0) -4 >Emitted(70, 17) Source(69, 17) + SourceIndex(0) -5 >Emitted(70, 18) Source(69, 18) + SourceIndex(0) +1 >Emitted(54, 9) Source(69, 9) + SourceIndex(0) +2 >Emitted(54, 15) Source(69, 15) + SourceIndex(0) +3 >Emitted(54, 16) Source(69, 16) + SourceIndex(0) +4 >Emitted(54, 17) Source(69, 17) + SourceIndex(0) +5 >Emitted(54, 18) Source(69, 18) + SourceIndex(0) --- >>> }; 1 >^^^^ @@ -1250,9 +1214,9 @@ sourceFile:contextualTyping.ts > 2 > } 3 > -1 >Emitted(71, 5) Source(70, 5) + SourceIndex(0) -2 >Emitted(71, 6) Source(70, 6) + SourceIndex(0) -3 >Emitted(71, 7) Source(70, 6) + SourceIndex(0) name (C5T5) +1 >Emitted(55, 5) Source(70, 5) + SourceIndex(0) +2 >Emitted(55, 6) Source(70, 6) + SourceIndex(0) +3 >Emitted(55, 7) Source(70, 6) + SourceIndex(0) name (C5T5) --- >>>})(C5T5 || (C5T5 = {})); 1-> @@ -1276,13 +1240,13 @@ sourceFile:contextualTyping.ts > return s; > } > } -1->Emitted(72, 1) Source(71, 1) + SourceIndex(0) name (C5T5) -2 >Emitted(72, 2) Source(71, 2) + SourceIndex(0) name (C5T5) -3 >Emitted(72, 4) Source(66, 8) + SourceIndex(0) -4 >Emitted(72, 8) Source(66, 12) + SourceIndex(0) -5 >Emitted(72, 13) Source(66, 8) + SourceIndex(0) -6 >Emitted(72, 17) Source(66, 12) + SourceIndex(0) -7 >Emitted(72, 25) Source(71, 2) + SourceIndex(0) +1->Emitted(56, 1) Source(71, 1) + SourceIndex(0) name (C5T5) +2 >Emitted(56, 2) Source(71, 2) + SourceIndex(0) name (C5T5) +3 >Emitted(56, 4) Source(66, 8) + SourceIndex(0) +4 >Emitted(56, 8) Source(66, 12) + SourceIndex(0) +5 >Emitted(56, 13) Source(66, 8) + SourceIndex(0) +6 >Emitted(56, 17) Source(66, 12) + SourceIndex(0) +7 >Emitted(56, 25) Source(71, 2) + SourceIndex(0) --- >>>// CONTEXT: Variable assignment 1-> @@ -1294,89 +1258,84 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Variable assignment -1->Emitted(73, 1) Source(74, 1) + SourceIndex(0) -2 >Emitted(73, 1) Source(73, 1) + SourceIndex(0) -3 >Emitted(73, 32) Source(73, 32) + SourceIndex(0) +1->Emitted(57, 1) Source(74, 1) + SourceIndex(0) +2 >Emitted(57, 1) Source(73, 1) + SourceIndex(0) +3 >Emitted(57, 32) Source(73, 32) + SourceIndex(0) --- >>>var c6t5; 1 >^^^^ 2 > ^^^^ 3 > ^ -4 > ^^^^^^^^^^^^^-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >var 2 > c6t5: (n: number) => IFoo 3 > ; -1 >Emitted(74, 5) Source(74, 5) + SourceIndex(0) -2 >Emitted(74, 9) Source(74, 30) + SourceIndex(0) -3 >Emitted(74, 10) Source(74, 31) + SourceIndex(0) +1 >Emitted(58, 5) Source(74, 5) + SourceIndex(0) +2 >Emitted(58, 9) Source(74, 30) + SourceIndex(0) +3 >Emitted(58, 10) Source(74, 31) + SourceIndex(0) --- ->>>c6t5 = function (n) { +>>>c6t5 = function (n) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^ 4 > ^^^^^^^^^^ 5 > ^ +6 > ^^^^ +7 > ^^^^^^ +8 > ^ +9 > ^ +10> ^^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ 1-> > 2 >c6t5 3 > = <(n: number) => IFoo> 4 > function( 5 > n -1->Emitted(75, 1) Source(75, 1) + SourceIndex(0) -2 >Emitted(75, 5) Source(75, 5) + SourceIndex(0) -3 >Emitted(75, 8) Source(75, 29) + SourceIndex(0) -4 >Emitted(75, 18) Source(75, 38) + SourceIndex(0) -5 >Emitted(75, 19) Source(75, 39) + SourceIndex(0) ---- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(76, 5) Source(75, 43) + SourceIndex(0) -2 >Emitted(76, 11) Source(75, 49) + SourceIndex(0) -3 >Emitted(76, 12) Source(75, 56) + SourceIndex(0) -4 >Emitted(76, 13) Source(75, 57) + SourceIndex(0) -5 >Emitted(76, 15) Source(75, 59) + SourceIndex(0) -6 >Emitted(76, 16) Source(75, 60) + SourceIndex(0) -7 >Emitted(76, 17) Source(75, 60) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(77, 1) Source(75, 61) + SourceIndex(0) -2 >Emitted(77, 2) Source(75, 62) + SourceIndex(0) -3 >Emitted(77, 3) Source(75, 63) + SourceIndex(0) +6 > ) { +7 > return +8 > +9 > ( +10> {} +11> ) +12> +13> +14> } +15> ; +1->Emitted(59, 1) Source(75, 1) + SourceIndex(0) +2 >Emitted(59, 5) Source(75, 5) + SourceIndex(0) +3 >Emitted(59, 8) Source(75, 29) + SourceIndex(0) +4 >Emitted(59, 18) Source(75, 38) + SourceIndex(0) +5 >Emitted(59, 19) Source(75, 39) + SourceIndex(0) +6 >Emitted(59, 23) Source(75, 43) + SourceIndex(0) +7 >Emitted(59, 29) Source(75, 49) + SourceIndex(0) +8 >Emitted(59, 30) Source(75, 56) + SourceIndex(0) +9 >Emitted(59, 31) Source(75, 57) + SourceIndex(0) +10>Emitted(59, 33) Source(75, 59) + SourceIndex(0) +11>Emitted(59, 34) Source(75, 60) + SourceIndex(0) +12>Emitted(59, 35) Source(75, 60) + SourceIndex(0) +13>Emitted(59, 36) Source(75, 61) + SourceIndex(0) +14>Emitted(59, 37) Source(75, 62) + SourceIndex(0) +15>Emitted(59, 38) Source(75, 63) + SourceIndex(0) --- >>>// CONTEXT: Array index assignment -1-> +1 > 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1-> +1 > > >// CONTEXT: Array index assignment > 2 > 3 >// CONTEXT: Array index assignment -1->Emitted(78, 1) Source(78, 1) + SourceIndex(0) -2 >Emitted(78, 1) Source(77, 1) + SourceIndex(0) -3 >Emitted(78, 35) Source(77, 35) + SourceIndex(0) +1 >Emitted(60, 1) Source(78, 1) + SourceIndex(0) +2 >Emitted(60, 1) Source(77, 1) + SourceIndex(0) +3 >Emitted(60, 35) Source(77, 35) + SourceIndex(0) --- >>>var c7t2; 1 >^^^^ @@ -1387,9 +1346,9 @@ sourceFile:contextualTyping.ts >var 2 > c7t2: IFoo[] 3 > ; -1 >Emitted(79, 5) Source(78, 5) + SourceIndex(0) -2 >Emitted(79, 9) Source(78, 17) + SourceIndex(0) -3 >Emitted(79, 10) Source(78, 18) + SourceIndex(0) +1 >Emitted(61, 5) Source(78, 5) + SourceIndex(0) +2 >Emitted(61, 9) Source(78, 17) + SourceIndex(0) +3 >Emitted(61, 10) Source(78, 18) + SourceIndex(0) --- >>>c7t2[0] = ({ n: 1 }); 1-> @@ -1421,20 +1380,20 @@ sourceFile:contextualTyping.ts 12> } 13> ) 14> ; -1->Emitted(80, 1) Source(79, 1) + SourceIndex(0) -2 >Emitted(80, 5) Source(79, 5) + SourceIndex(0) -3 >Emitted(80, 6) Source(79, 6) + SourceIndex(0) -4 >Emitted(80, 7) Source(79, 7) + SourceIndex(0) -5 >Emitted(80, 8) Source(79, 8) + SourceIndex(0) -6 >Emitted(80, 11) Source(79, 17) + SourceIndex(0) -7 >Emitted(80, 12) Source(79, 18) + SourceIndex(0) -8 >Emitted(80, 14) Source(79, 19) + SourceIndex(0) -9 >Emitted(80, 15) Source(79, 20) + SourceIndex(0) -10>Emitted(80, 17) Source(79, 22) + SourceIndex(0) -11>Emitted(80, 18) Source(79, 23) + SourceIndex(0) -12>Emitted(80, 20) Source(79, 24) + SourceIndex(0) -13>Emitted(80, 21) Source(79, 25) + SourceIndex(0) -14>Emitted(80, 22) Source(79, 26) + SourceIndex(0) +1->Emitted(62, 1) Source(79, 1) + SourceIndex(0) +2 >Emitted(62, 5) Source(79, 5) + SourceIndex(0) +3 >Emitted(62, 6) Source(79, 6) + SourceIndex(0) +4 >Emitted(62, 7) Source(79, 7) + SourceIndex(0) +5 >Emitted(62, 8) Source(79, 8) + SourceIndex(0) +6 >Emitted(62, 11) Source(79, 17) + SourceIndex(0) +7 >Emitted(62, 12) Source(79, 18) + SourceIndex(0) +8 >Emitted(62, 14) Source(79, 19) + SourceIndex(0) +9 >Emitted(62, 15) Source(79, 20) + SourceIndex(0) +10>Emitted(62, 17) Source(79, 22) + SourceIndex(0) +11>Emitted(62, 18) Source(79, 23) + SourceIndex(0) +12>Emitted(62, 20) Source(79, 24) + SourceIndex(0) +13>Emitted(62, 21) Source(79, 25) + SourceIndex(0) +14>Emitted(62, 22) Source(79, 26) + SourceIndex(0) --- >>>var objc8 = ({}); 1 > @@ -1445,7 +1404,7 @@ sourceFile:contextualTyping.ts 6 > ^^ 7 > ^ 8 > ^ -9 > ^^^^^^^^^^-> +9 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > >// CONTEXT: Object property assignment @@ -1495,16 +1454,16 @@ sourceFile:contextualTyping.ts 6 > {} 7 > ) 8 > ; -1 >Emitted(81, 1) Source(102, 1) + SourceIndex(0) -2 >Emitted(81, 5) Source(102, 5) + SourceIndex(0) -3 >Emitted(81, 10) Source(102, 10) + SourceIndex(0) -4 >Emitted(81, 13) Source(120, 19) + SourceIndex(0) -5 >Emitted(81, 14) Source(120, 20) + SourceIndex(0) -6 >Emitted(81, 16) Source(120, 22) + SourceIndex(0) -7 >Emitted(81, 17) Source(120, 23) + SourceIndex(0) -8 >Emitted(81, 18) Source(120, 24) + SourceIndex(0) +1 >Emitted(63, 1) Source(102, 1) + SourceIndex(0) +2 >Emitted(63, 5) Source(102, 5) + SourceIndex(0) +3 >Emitted(63, 10) Source(102, 10) + SourceIndex(0) +4 >Emitted(63, 13) Source(120, 19) + SourceIndex(0) +5 >Emitted(63, 14) Source(120, 20) + SourceIndex(0) +6 >Emitted(63, 16) Source(120, 22) + SourceIndex(0) +7 >Emitted(63, 17) Source(120, 23) + SourceIndex(0) +8 >Emitted(63, 18) Source(120, 24) + SourceIndex(0) --- ->>>objc8.t1 = (function (s) { +>>>objc8.t1 = (function (s) { return s; }); 1-> 2 >^^^^^ 3 > ^ @@ -1513,6 +1472,15 @@ sourceFile:contextualTyping.ts 6 > ^ 7 > ^^^^^^^^^^ 8 > ^ +9 > ^^^^ +10> ^^^^^^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ 1-> > > @@ -1523,67 +1491,53 @@ sourceFile:contextualTyping.ts 6 > ( 7 > function( 8 > s -1->Emitted(82, 1) Source(122, 1) + SourceIndex(0) -2 >Emitted(82, 6) Source(122, 6) + SourceIndex(0) -3 >Emitted(82, 7) Source(122, 7) + SourceIndex(0) -4 >Emitted(82, 9) Source(122, 9) + SourceIndex(0) -5 >Emitted(82, 12) Source(122, 12) + SourceIndex(0) -6 >Emitted(82, 13) Source(122, 13) + SourceIndex(0) -7 >Emitted(82, 23) Source(122, 22) + SourceIndex(0) -8 >Emitted(82, 24) Source(122, 23) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > -1 >Emitted(83, 5) Source(122, 27) + SourceIndex(0) -2 >Emitted(83, 11) Source(122, 33) + SourceIndex(0) -3 >Emitted(83, 12) Source(122, 34) + SourceIndex(0) -4 >Emitted(83, 13) Source(122, 35) + SourceIndex(0) -5 >Emitted(83, 14) Source(122, 35) + SourceIndex(0) ---- ->>>}); -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^-> -1 > -2 >} -3 > ) -4 > ; -1 >Emitted(84, 1) Source(122, 36) + SourceIndex(0) -2 >Emitted(84, 2) Source(122, 37) + SourceIndex(0) -3 >Emitted(84, 3) Source(122, 38) + SourceIndex(0) -4 >Emitted(84, 4) Source(122, 39) + SourceIndex(0) +9 > ) { +10> return +11> +12> s +13> +14> +15> } +16> ) +17> ; +1->Emitted(64, 1) Source(122, 1) + SourceIndex(0) +2 >Emitted(64, 6) Source(122, 6) + SourceIndex(0) +3 >Emitted(64, 7) Source(122, 7) + SourceIndex(0) +4 >Emitted(64, 9) Source(122, 9) + SourceIndex(0) +5 >Emitted(64, 12) Source(122, 12) + SourceIndex(0) +6 >Emitted(64, 13) Source(122, 13) + SourceIndex(0) +7 >Emitted(64, 23) Source(122, 22) + SourceIndex(0) +8 >Emitted(64, 24) Source(122, 23) + SourceIndex(0) +9 >Emitted(64, 28) Source(122, 27) + SourceIndex(0) +10>Emitted(64, 34) Source(122, 33) + SourceIndex(0) +11>Emitted(64, 35) Source(122, 34) + SourceIndex(0) +12>Emitted(64, 36) Source(122, 35) + SourceIndex(0) +13>Emitted(64, 37) Source(122, 35) + SourceIndex(0) +14>Emitted(64, 38) Source(122, 36) + SourceIndex(0) +15>Emitted(64, 39) Source(122, 37) + SourceIndex(0) +16>Emitted(64, 40) Source(122, 38) + SourceIndex(0) +17>Emitted(64, 41) Source(122, 39) + SourceIndex(0) --- >>>objc8.t2 = ({ -1-> +1 > 2 >^^^^^ 3 > ^ 4 > ^^ 5 > ^^^ 6 > ^ -1-> +1 > > 2 >objc8 3 > . 4 > t2 5 > = 6 > ( -1->Emitted(85, 1) Source(123, 1) + SourceIndex(0) -2 >Emitted(85, 6) Source(123, 6) + SourceIndex(0) -3 >Emitted(85, 7) Source(123, 7) + SourceIndex(0) -4 >Emitted(85, 9) Source(123, 9) + SourceIndex(0) -5 >Emitted(85, 12) Source(123, 18) + SourceIndex(0) -6 >Emitted(85, 13) Source(123, 19) + SourceIndex(0) +1 >Emitted(65, 1) Source(123, 1) + SourceIndex(0) +2 >Emitted(65, 6) Source(123, 6) + SourceIndex(0) +3 >Emitted(65, 7) Source(123, 7) + SourceIndex(0) +4 >Emitted(65, 9) Source(123, 9) + SourceIndex(0) +5 >Emitted(65, 12) Source(123, 18) + SourceIndex(0) +6 >Emitted(65, 13) Source(123, 19) + SourceIndex(0) --- >>> n: 1 1 >^^^^ @@ -1595,10 +1549,10 @@ sourceFile:contextualTyping.ts 2 > n 3 > : 4 > 1 -1 >Emitted(86, 5) Source(124, 5) + SourceIndex(0) -2 >Emitted(86, 6) Source(124, 6) + SourceIndex(0) -3 >Emitted(86, 8) Source(124, 8) + SourceIndex(0) -4 >Emitted(86, 9) Source(124, 9) + SourceIndex(0) +1 >Emitted(66, 5) Source(124, 5) + SourceIndex(0) +2 >Emitted(66, 6) Source(124, 6) + SourceIndex(0) +3 >Emitted(66, 8) Source(124, 8) + SourceIndex(0) +4 >Emitted(66, 9) Source(124, 9) + SourceIndex(0) --- >>>}); 1 >^ @@ -1609,9 +1563,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > ; -1 >Emitted(87, 2) Source(125, 2) + SourceIndex(0) -2 >Emitted(87, 3) Source(125, 3) + SourceIndex(0) -3 >Emitted(87, 4) Source(125, 4) + SourceIndex(0) +1 >Emitted(67, 2) Source(125, 2) + SourceIndex(0) +2 >Emitted(67, 3) Source(125, 3) + SourceIndex(0) +3 >Emitted(67, 4) Source(125, 4) + SourceIndex(0) --- >>>objc8.t3 = []; 1-> @@ -1621,7 +1575,7 @@ sourceFile:contextualTyping.ts 5 > ^^^ 6 > ^^ 7 > ^ -8 > ^^^^^^^^^^^-> +8 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -1630,69 +1584,64 @@ sourceFile:contextualTyping.ts 5 > = 6 > [] 7 > ; -1->Emitted(88, 1) Source(126, 1) + SourceIndex(0) -2 >Emitted(88, 6) Source(126, 6) + SourceIndex(0) -3 >Emitted(88, 7) Source(126, 7) + SourceIndex(0) -4 >Emitted(88, 9) Source(126, 9) + SourceIndex(0) -5 >Emitted(88, 12) Source(126, 12) + SourceIndex(0) -6 >Emitted(88, 14) Source(126, 14) + SourceIndex(0) -7 >Emitted(88, 15) Source(126, 15) + SourceIndex(0) +1->Emitted(68, 1) Source(126, 1) + SourceIndex(0) +2 >Emitted(68, 6) Source(126, 6) + SourceIndex(0) +3 >Emitted(68, 7) Source(126, 7) + SourceIndex(0) +4 >Emitted(68, 9) Source(126, 9) + SourceIndex(0) +5 >Emitted(68, 12) Source(126, 12) + SourceIndex(0) +6 >Emitted(68, 14) Source(126, 14) + SourceIndex(0) +7 >Emitted(68, 15) Source(126, 15) + SourceIndex(0) --- ->>>objc8.t4 = function () { +>>>objc8.t4 = function () { return ({}); }; 1-> 2 >^^^^^ 3 > ^ 4 > ^^ 5 > ^^^ -6 > ^^^^^^-> +6 > ^^^^^^^^^^^^^^ +7 > ^^^^^^ +8 > ^ +9 > ^ +10> ^^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^^-> 1-> > 2 >objc8 3 > . 4 > t4 5 > = -1->Emitted(89, 1) Source(127, 1) + SourceIndex(0) -2 >Emitted(89, 6) Source(127, 6) + SourceIndex(0) -3 >Emitted(89, 7) Source(127, 7) + SourceIndex(0) -4 >Emitted(89, 9) Source(127, 9) + SourceIndex(0) -5 >Emitted(89, 12) Source(127, 12) + SourceIndex(0) +6 > function() { +7 > return +8 > +9 > ( +10> {} +11> ) +12> +13> +14> } +15> ; +1->Emitted(69, 1) Source(127, 1) + SourceIndex(0) +2 >Emitted(69, 6) Source(127, 6) + SourceIndex(0) +3 >Emitted(69, 7) Source(127, 7) + SourceIndex(0) +4 >Emitted(69, 9) Source(127, 9) + SourceIndex(0) +5 >Emitted(69, 12) Source(127, 12) + SourceIndex(0) +6 >Emitted(69, 26) Source(127, 25) + SourceIndex(0) +7 >Emitted(69, 32) Source(127, 31) + SourceIndex(0) +8 >Emitted(69, 33) Source(127, 38) + SourceIndex(0) +9 >Emitted(69, 34) Source(127, 39) + SourceIndex(0) +10>Emitted(69, 36) Source(127, 41) + SourceIndex(0) +11>Emitted(69, 37) Source(127, 42) + SourceIndex(0) +12>Emitted(69, 38) Source(127, 42) + SourceIndex(0) +13>Emitted(69, 39) Source(127, 43) + SourceIndex(0) +14>Emitted(69, 40) Source(127, 44) + SourceIndex(0) +15>Emitted(69, 41) Source(127, 45) + SourceIndex(0) --- ->>> return ({}); -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1->function() { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1->Emitted(90, 5) Source(127, 25) + SourceIndex(0) -2 >Emitted(90, 11) Source(127, 31) + SourceIndex(0) -3 >Emitted(90, 12) Source(127, 38) + SourceIndex(0) -4 >Emitted(90, 13) Source(127, 39) + SourceIndex(0) -5 >Emitted(90, 15) Source(127, 41) + SourceIndex(0) -6 >Emitted(90, 16) Source(127, 42) + SourceIndex(0) -7 >Emitted(90, 17) Source(127, 42) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(91, 1) Source(127, 43) + SourceIndex(0) -2 >Emitted(91, 2) Source(127, 44) + SourceIndex(0) -3 >Emitted(91, 3) Source(127, 45) + SourceIndex(0) ---- ->>>objc8.t5 = function (n) { +>>>objc8.t5 = function (n) { return ({}); }; 1-> 2 >^^^^^ 3 > ^ @@ -1700,6 +1649,17 @@ sourceFile:contextualTyping.ts 5 > ^^^ 6 > ^^^^^^^^^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^^^^-> 1-> > 2 >objc8 @@ -1708,50 +1668,35 @@ sourceFile:contextualTyping.ts 5 > = 6 > function( 7 > n -1->Emitted(92, 1) Source(128, 1) + SourceIndex(0) -2 >Emitted(92, 6) Source(128, 6) + SourceIndex(0) -3 >Emitted(92, 7) Source(128, 7) + SourceIndex(0) -4 >Emitted(92, 9) Source(128, 9) + SourceIndex(0) -5 >Emitted(92, 12) Source(128, 12) + SourceIndex(0) -6 >Emitted(92, 22) Source(128, 21) + SourceIndex(0) -7 >Emitted(92, 23) Source(128, 22) + SourceIndex(0) +8 > ) { +9 > return +10> +11> ( +12> {} +13> ) +14> +15> +16> } +17> ; +1->Emitted(70, 1) Source(128, 1) + SourceIndex(0) +2 >Emitted(70, 6) Source(128, 6) + SourceIndex(0) +3 >Emitted(70, 7) Source(128, 7) + SourceIndex(0) +4 >Emitted(70, 9) Source(128, 9) + SourceIndex(0) +5 >Emitted(70, 12) Source(128, 12) + SourceIndex(0) +6 >Emitted(70, 22) Source(128, 21) + SourceIndex(0) +7 >Emitted(70, 23) Source(128, 22) + SourceIndex(0) +8 >Emitted(70, 27) Source(128, 26) + SourceIndex(0) +9 >Emitted(70, 33) Source(128, 32) + SourceIndex(0) +10>Emitted(70, 34) Source(128, 39) + SourceIndex(0) +11>Emitted(70, 35) Source(128, 40) + SourceIndex(0) +12>Emitted(70, 37) Source(128, 42) + SourceIndex(0) +13>Emitted(70, 38) Source(128, 43) + SourceIndex(0) +14>Emitted(70, 39) Source(128, 43) + SourceIndex(0) +15>Emitted(70, 40) Source(128, 44) + SourceIndex(0) +16>Emitted(70, 41) Source(128, 45) + SourceIndex(0) +17>Emitted(70, 42) Source(128, 46) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(93, 5) Source(128, 26) + SourceIndex(0) -2 >Emitted(93, 11) Source(128, 32) + SourceIndex(0) -3 >Emitted(93, 12) Source(128, 39) + SourceIndex(0) -4 >Emitted(93, 13) Source(128, 40) + SourceIndex(0) -5 >Emitted(93, 15) Source(128, 42) + SourceIndex(0) -6 >Emitted(93, 16) Source(128, 43) + SourceIndex(0) -7 >Emitted(93, 17) Source(128, 43) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(94, 1) Source(128, 44) + SourceIndex(0) -2 >Emitted(94, 2) Source(128, 45) + SourceIndex(0) -3 >Emitted(94, 3) Source(128, 46) + SourceIndex(0) ---- ->>>objc8.t6 = function (n, s) { +>>>objc8.t6 = function (n, s) { return ({}); }; 1-> 2 >^^^^^ 3 > ^ @@ -1761,6 +1706,16 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^ 9 > ^ +10> ^^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^ 1-> > 2 >objc8 @@ -1771,60 +1726,54 @@ sourceFile:contextualTyping.ts 7 > n 8 > , 9 > s -1->Emitted(95, 1) Source(129, 1) + SourceIndex(0) -2 >Emitted(95, 6) Source(129, 6) + SourceIndex(0) -3 >Emitted(95, 7) Source(129, 7) + SourceIndex(0) -4 >Emitted(95, 9) Source(129, 9) + SourceIndex(0) -5 >Emitted(95, 12) Source(129, 12) + SourceIndex(0) -6 >Emitted(95, 22) Source(129, 21) + SourceIndex(0) -7 >Emitted(95, 23) Source(129, 22) + SourceIndex(0) -8 >Emitted(95, 25) Source(129, 24) + SourceIndex(0) -9 >Emitted(95, 26) Source(129, 25) + SourceIndex(0) +10> ) { +11> return +12> +13> ( +14> {} +15> ) +16> +17> +18> } +19> ; +1->Emitted(71, 1) Source(129, 1) + SourceIndex(0) +2 >Emitted(71, 6) Source(129, 6) + SourceIndex(0) +3 >Emitted(71, 7) Source(129, 7) + SourceIndex(0) +4 >Emitted(71, 9) Source(129, 9) + SourceIndex(0) +5 >Emitted(71, 12) Source(129, 12) + SourceIndex(0) +6 >Emitted(71, 22) Source(129, 21) + SourceIndex(0) +7 >Emitted(71, 23) Source(129, 22) + SourceIndex(0) +8 >Emitted(71, 25) Source(129, 24) + SourceIndex(0) +9 >Emitted(71, 26) Source(129, 25) + SourceIndex(0) +10>Emitted(71, 30) Source(129, 29) + SourceIndex(0) +11>Emitted(71, 36) Source(129, 35) + SourceIndex(0) +12>Emitted(71, 37) Source(129, 42) + SourceIndex(0) +13>Emitted(71, 38) Source(129, 43) + SourceIndex(0) +14>Emitted(71, 40) Source(129, 45) + SourceIndex(0) +15>Emitted(71, 41) Source(129, 46) + SourceIndex(0) +16>Emitted(71, 42) Source(129, 46) + SourceIndex(0) +17>Emitted(71, 43) Source(129, 47) + SourceIndex(0) +18>Emitted(71, 44) Source(129, 48) + SourceIndex(0) +19>Emitted(71, 45) Source(129, 49) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(96, 5) Source(129, 29) + SourceIndex(0) -2 >Emitted(96, 11) Source(129, 35) + SourceIndex(0) -3 >Emitted(96, 12) Source(129, 42) + SourceIndex(0) -4 >Emitted(96, 13) Source(129, 43) + SourceIndex(0) -5 >Emitted(96, 15) Source(129, 45) + SourceIndex(0) -6 >Emitted(96, 16) Source(129, 46) + SourceIndex(0) -7 >Emitted(96, 17) Source(129, 46) + SourceIndex(0) ---- ->>>}; +>>>objc8.t7 = function (n) { return n; }; 1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(97, 1) Source(129, 47) + SourceIndex(0) -2 >Emitted(97, 2) Source(129, 48) + SourceIndex(0) -3 >Emitted(97, 3) Source(129, 49) + SourceIndex(0) ---- ->>>objc8.t7 = function (n) { -1-> 2 >^^^^^ 3 > ^ 4 > ^^ 5 > ^^^ 6 > ^^^^^^^^^^ 7 > ^ -1-> +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^-> +1 > > 2 >objc8 3 > . @@ -1832,44 +1781,31 @@ sourceFile:contextualTyping.ts 5 > = 6 > function( 7 > n: number -1->Emitted(98, 1) Source(130, 1) + SourceIndex(0) -2 >Emitted(98, 6) Source(130, 6) + SourceIndex(0) -3 >Emitted(98, 7) Source(130, 7) + SourceIndex(0) -4 >Emitted(98, 9) Source(130, 9) + SourceIndex(0) -5 >Emitted(98, 12) Source(130, 12) + SourceIndex(0) -6 >Emitted(98, 22) Source(130, 21) + SourceIndex(0) -7 >Emitted(98, 23) Source(130, 30) + SourceIndex(0) +8 > ) { +9 > return +10> +11> n +12> +13> +14> } +15> ; +1 >Emitted(72, 1) Source(130, 1) + SourceIndex(0) +2 >Emitted(72, 6) Source(130, 6) + SourceIndex(0) +3 >Emitted(72, 7) Source(130, 7) + SourceIndex(0) +4 >Emitted(72, 9) Source(130, 9) + SourceIndex(0) +5 >Emitted(72, 12) Source(130, 12) + SourceIndex(0) +6 >Emitted(72, 22) Source(130, 21) + SourceIndex(0) +7 >Emitted(72, 23) Source(130, 30) + SourceIndex(0) +8 >Emitted(72, 27) Source(130, 34) + SourceIndex(0) +9 >Emitted(72, 33) Source(130, 40) + SourceIndex(0) +10>Emitted(72, 34) Source(130, 41) + SourceIndex(0) +11>Emitted(72, 35) Source(130, 42) + SourceIndex(0) +12>Emitted(72, 36) Source(130, 42) + SourceIndex(0) +13>Emitted(72, 37) Source(130, 43) + SourceIndex(0) +14>Emitted(72, 38) Source(130, 44) + SourceIndex(0) +15>Emitted(72, 39) Source(130, 45) + SourceIndex(0) --- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > -1 >Emitted(99, 5) Source(130, 34) + SourceIndex(0) -2 >Emitted(99, 11) Source(130, 40) + SourceIndex(0) -3 >Emitted(99, 12) Source(130, 41) + SourceIndex(0) -4 >Emitted(99, 13) Source(130, 42) + SourceIndex(0) -5 >Emitted(99, 14) Source(130, 42) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(100, 1) Source(130, 43) + SourceIndex(0) -2 >Emitted(100, 2) Source(130, 44) + SourceIndex(0) -3 >Emitted(100, 3) Source(130, 45) + SourceIndex(0) ---- ->>>objc8.t8 = function (n) { +>>>objc8.t8 = function (n) { return n; }; 1-> 2 >^^^^^ 3 > ^ @@ -1877,6 +1813,14 @@ sourceFile:contextualTyping.ts 5 > ^^^ 6 > ^^^^^^^^^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ 1-> > > @@ -1886,45 +1830,32 @@ sourceFile:contextualTyping.ts 5 > = 6 > function( 7 > n -1->Emitted(101, 1) Source(132, 1) + SourceIndex(0) -2 >Emitted(101, 6) Source(132, 6) + SourceIndex(0) -3 >Emitted(101, 7) Source(132, 7) + SourceIndex(0) -4 >Emitted(101, 9) Source(132, 9) + SourceIndex(0) -5 >Emitted(101, 12) Source(132, 12) + SourceIndex(0) -6 >Emitted(101, 22) Source(132, 21) + SourceIndex(0) -7 >Emitted(101, 23) Source(132, 22) + SourceIndex(0) ---- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > ; -1 >Emitted(102, 5) Source(132, 26) + SourceIndex(0) -2 >Emitted(102, 11) Source(132, 32) + SourceIndex(0) -3 >Emitted(102, 12) Source(132, 33) + SourceIndex(0) -4 >Emitted(102, 13) Source(132, 34) + SourceIndex(0) -5 >Emitted(102, 14) Source(132, 35) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(103, 1) Source(132, 36) + SourceIndex(0) -2 >Emitted(103, 2) Source(132, 37) + SourceIndex(0) -3 >Emitted(103, 3) Source(132, 38) + SourceIndex(0) +8 > ) { +9 > return +10> +11> n +12> ; +13> +14> } +15> ; +1->Emitted(73, 1) Source(132, 1) + SourceIndex(0) +2 >Emitted(73, 6) Source(132, 6) + SourceIndex(0) +3 >Emitted(73, 7) Source(132, 7) + SourceIndex(0) +4 >Emitted(73, 9) Source(132, 9) + SourceIndex(0) +5 >Emitted(73, 12) Source(132, 12) + SourceIndex(0) +6 >Emitted(73, 22) Source(132, 21) + SourceIndex(0) +7 >Emitted(73, 23) Source(132, 22) + SourceIndex(0) +8 >Emitted(73, 27) Source(132, 26) + SourceIndex(0) +9 >Emitted(73, 33) Source(132, 32) + SourceIndex(0) +10>Emitted(73, 34) Source(132, 33) + SourceIndex(0) +11>Emitted(73, 35) Source(132, 34) + SourceIndex(0) +12>Emitted(73, 36) Source(132, 35) + SourceIndex(0) +13>Emitted(73, 37) Source(132, 36) + SourceIndex(0) +14>Emitted(73, 38) Source(132, 37) + SourceIndex(0) +15>Emitted(73, 39) Source(132, 38) + SourceIndex(0) --- >>>objc8.t9 = [[], []]; -1-> +1 > 2 >^^^^^ 3 > ^ 4 > ^^ @@ -1936,7 +1867,7 @@ sourceFile:contextualTyping.ts 10> ^ 11> ^ 12> ^^^^^^-> -1-> +1 > > 2 >objc8 3 > . @@ -1948,17 +1879,17 @@ sourceFile:contextualTyping.ts 9 > [] 10> ] 11> ; -1->Emitted(104, 1) Source(133, 1) + SourceIndex(0) -2 >Emitted(104, 6) Source(133, 6) + SourceIndex(0) -3 >Emitted(104, 7) Source(133, 7) + SourceIndex(0) -4 >Emitted(104, 9) Source(133, 9) + SourceIndex(0) -5 >Emitted(104, 12) Source(133, 12) + SourceIndex(0) -6 >Emitted(104, 13) Source(133, 13) + SourceIndex(0) -7 >Emitted(104, 15) Source(133, 15) + SourceIndex(0) -8 >Emitted(104, 17) Source(133, 16) + SourceIndex(0) -9 >Emitted(104, 19) Source(133, 18) + SourceIndex(0) -10>Emitted(104, 20) Source(133, 19) + SourceIndex(0) -11>Emitted(104, 21) Source(133, 20) + SourceIndex(0) +1 >Emitted(74, 1) Source(133, 1) + SourceIndex(0) +2 >Emitted(74, 6) Source(133, 6) + SourceIndex(0) +3 >Emitted(74, 7) Source(133, 7) + SourceIndex(0) +4 >Emitted(74, 9) Source(133, 9) + SourceIndex(0) +5 >Emitted(74, 12) Source(133, 12) + SourceIndex(0) +6 >Emitted(74, 13) Source(133, 13) + SourceIndex(0) +7 >Emitted(74, 15) Source(133, 15) + SourceIndex(0) +8 >Emitted(74, 17) Source(133, 16) + SourceIndex(0) +9 >Emitted(74, 19) Source(133, 18) + SourceIndex(0) +10>Emitted(74, 20) Source(133, 19) + SourceIndex(0) +11>Emitted(74, 21) Source(133, 20) + SourceIndex(0) --- >>>objc8.t10 = [({}), ({})]; 1-> @@ -1976,7 +1907,7 @@ sourceFile:contextualTyping.ts 13> ^ 14> ^ 15> ^ -16> ^^^^^^-> +16> ^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -1993,23 +1924,23 @@ sourceFile:contextualTyping.ts 13> ) 14> ] 15> ; -1->Emitted(105, 1) Source(134, 1) + SourceIndex(0) -2 >Emitted(105, 6) Source(134, 6) + SourceIndex(0) -3 >Emitted(105, 7) Source(134, 7) + SourceIndex(0) -4 >Emitted(105, 10) Source(134, 10) + SourceIndex(0) -5 >Emitted(105, 13) Source(134, 13) + SourceIndex(0) -6 >Emitted(105, 14) Source(134, 20) + SourceIndex(0) -7 >Emitted(105, 15) Source(134, 21) + SourceIndex(0) -8 >Emitted(105, 17) Source(134, 23) + SourceIndex(0) -9 >Emitted(105, 18) Source(134, 24) + SourceIndex(0) -10>Emitted(105, 20) Source(134, 31) + SourceIndex(0) -11>Emitted(105, 21) Source(134, 32) + SourceIndex(0) -12>Emitted(105, 23) Source(134, 34) + SourceIndex(0) -13>Emitted(105, 24) Source(134, 35) + SourceIndex(0) -14>Emitted(105, 25) Source(134, 36) + SourceIndex(0) -15>Emitted(105, 26) Source(134, 37) + SourceIndex(0) +1->Emitted(75, 1) Source(134, 1) + SourceIndex(0) +2 >Emitted(75, 6) Source(134, 6) + SourceIndex(0) +3 >Emitted(75, 7) Source(134, 7) + SourceIndex(0) +4 >Emitted(75, 10) Source(134, 10) + SourceIndex(0) +5 >Emitted(75, 13) Source(134, 13) + SourceIndex(0) +6 >Emitted(75, 14) Source(134, 20) + SourceIndex(0) +7 >Emitted(75, 15) Source(134, 21) + SourceIndex(0) +8 >Emitted(75, 17) Source(134, 23) + SourceIndex(0) +9 >Emitted(75, 18) Source(134, 24) + SourceIndex(0) +10>Emitted(75, 20) Source(134, 31) + SourceIndex(0) +11>Emitted(75, 21) Source(134, 32) + SourceIndex(0) +12>Emitted(75, 23) Source(134, 34) + SourceIndex(0) +13>Emitted(75, 24) Source(134, 35) + SourceIndex(0) +14>Emitted(75, 25) Source(134, 36) + SourceIndex(0) +15>Emitted(75, 26) Source(134, 37) + SourceIndex(0) --- ->>>objc8.t11 = [function (n, s) { +>>>objc8.t11 = [function (n, s) { return s; }]; 1-> 2 >^^^^^ 3 > ^ @@ -2020,6 +1951,15 @@ sourceFile:contextualTyping.ts 8 > ^ 9 > ^^ 10> ^ +11> ^^^^ +12> ^^^^^^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^ 1-> > 2 >objc8 @@ -2031,67 +1971,53 @@ sourceFile:contextualTyping.ts 8 > n 9 > , 10> s -1->Emitted(106, 1) Source(135, 1) + SourceIndex(0) -2 >Emitted(106, 6) Source(135, 6) + SourceIndex(0) -3 >Emitted(106, 7) Source(135, 7) + SourceIndex(0) -4 >Emitted(106, 10) Source(135, 10) + SourceIndex(0) -5 >Emitted(106, 13) Source(135, 13) + SourceIndex(0) -6 >Emitted(106, 14) Source(135, 14) + SourceIndex(0) -7 >Emitted(106, 24) Source(135, 23) + SourceIndex(0) -8 >Emitted(106, 25) Source(135, 24) + SourceIndex(0) -9 >Emitted(106, 27) Source(135, 26) + SourceIndex(0) -10>Emitted(106, 28) Source(135, 27) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(107, 5) Source(135, 31) + SourceIndex(0) -2 >Emitted(107, 11) Source(135, 37) + SourceIndex(0) -3 >Emitted(107, 12) Source(135, 38) + SourceIndex(0) -4 >Emitted(107, 13) Source(135, 39) + SourceIndex(0) -5 >Emitted(107, 14) Source(135, 40) + SourceIndex(0) ---- ->>>}]; -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^-> -1 > -2 >} -3 > ] -4 > ; -1 >Emitted(108, 1) Source(135, 41) + SourceIndex(0) -2 >Emitted(108, 2) Source(135, 42) + SourceIndex(0) -3 >Emitted(108, 3) Source(135, 43) + SourceIndex(0) -4 >Emitted(108, 4) Source(135, 44) + SourceIndex(0) +11> ) { +12> return +13> +14> s +15> ; +16> +17> } +18> ] +19> ; +1->Emitted(76, 1) Source(135, 1) + SourceIndex(0) +2 >Emitted(76, 6) Source(135, 6) + SourceIndex(0) +3 >Emitted(76, 7) Source(135, 7) + SourceIndex(0) +4 >Emitted(76, 10) Source(135, 10) + SourceIndex(0) +5 >Emitted(76, 13) Source(135, 13) + SourceIndex(0) +6 >Emitted(76, 14) Source(135, 14) + SourceIndex(0) +7 >Emitted(76, 24) Source(135, 23) + SourceIndex(0) +8 >Emitted(76, 25) Source(135, 24) + SourceIndex(0) +9 >Emitted(76, 27) Source(135, 26) + SourceIndex(0) +10>Emitted(76, 28) Source(135, 27) + SourceIndex(0) +11>Emitted(76, 32) Source(135, 31) + SourceIndex(0) +12>Emitted(76, 38) Source(135, 37) + SourceIndex(0) +13>Emitted(76, 39) Source(135, 38) + SourceIndex(0) +14>Emitted(76, 40) Source(135, 39) + SourceIndex(0) +15>Emitted(76, 41) Source(135, 40) + SourceIndex(0) +16>Emitted(76, 42) Source(135, 41) + SourceIndex(0) +17>Emitted(76, 43) Source(135, 42) + SourceIndex(0) +18>Emitted(76, 44) Source(135, 43) + SourceIndex(0) +19>Emitted(76, 45) Source(135, 44) + SourceIndex(0) --- >>>objc8.t12 = { -1-> +1 > 2 >^^^^^ 3 > ^ 4 > ^^^ 5 > ^^^ 6 > ^^-> -1-> +1 > > 2 >objc8 3 > . 4 > t12 5 > = -1->Emitted(109, 1) Source(136, 1) + SourceIndex(0) -2 >Emitted(109, 6) Source(136, 6) + SourceIndex(0) -3 >Emitted(109, 7) Source(136, 7) + SourceIndex(0) -4 >Emitted(109, 10) Source(136, 10) + SourceIndex(0) -5 >Emitted(109, 13) Source(136, 13) + SourceIndex(0) +1 >Emitted(77, 1) Source(136, 1) + SourceIndex(0) +2 >Emitted(77, 6) Source(136, 6) + SourceIndex(0) +3 >Emitted(77, 7) Source(136, 7) + SourceIndex(0) +4 >Emitted(77, 10) Source(136, 10) + SourceIndex(0) +5 >Emitted(77, 13) Source(136, 13) + SourceIndex(0) --- >>> foo: ({}) 1->^^^^ @@ -2107,12 +2033,12 @@ sourceFile:contextualTyping.ts 4 > ( 5 > {} 6 > ) -1->Emitted(110, 5) Source(137, 5) + SourceIndex(0) -2 >Emitted(110, 8) Source(137, 8) + SourceIndex(0) -3 >Emitted(110, 10) Source(137, 16) + SourceIndex(0) -4 >Emitted(110, 11) Source(137, 17) + SourceIndex(0) -5 >Emitted(110, 13) Source(137, 19) + SourceIndex(0) -6 >Emitted(110, 14) Source(137, 20) + SourceIndex(0) +1->Emitted(78, 5) Source(137, 5) + SourceIndex(0) +2 >Emitted(78, 8) Source(137, 8) + SourceIndex(0) +3 >Emitted(78, 10) Source(137, 16) + SourceIndex(0) +4 >Emitted(78, 11) Source(137, 17) + SourceIndex(0) +5 >Emitted(78, 13) Source(137, 19) + SourceIndex(0) +6 >Emitted(78, 14) Source(137, 20) + SourceIndex(0) --- >>>}; 1 >^ @@ -2121,8 +2047,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > -1 >Emitted(111, 2) Source(138, 2) + SourceIndex(0) -2 >Emitted(111, 3) Source(138, 2) + SourceIndex(0) +1 >Emitted(79, 2) Source(138, 2) + SourceIndex(0) +2 >Emitted(79, 3) Source(138, 2) + SourceIndex(0) --- >>>objc8.t13 = ({ 1-> @@ -2131,7 +2057,7 @@ sourceFile:contextualTyping.ts 4 > ^^^ 5 > ^^^ 6 > ^ -7 > ^^^^^^^^^^^^-> +7 > ^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >objc8 @@ -2139,14 +2065,14 @@ sourceFile:contextualTyping.ts 4 > t13 5 > = 6 > ( -1->Emitted(112, 1) Source(139, 1) + SourceIndex(0) -2 >Emitted(112, 6) Source(139, 6) + SourceIndex(0) -3 >Emitted(112, 7) Source(139, 7) + SourceIndex(0) -4 >Emitted(112, 10) Source(139, 10) + SourceIndex(0) -5 >Emitted(112, 13) Source(139, 19) + SourceIndex(0) -6 >Emitted(112, 14) Source(139, 20) + SourceIndex(0) +1->Emitted(80, 1) Source(139, 1) + SourceIndex(0) +2 >Emitted(80, 6) Source(139, 6) + SourceIndex(0) +3 >Emitted(80, 7) Source(139, 7) + SourceIndex(0) +4 >Emitted(80, 10) Source(139, 10) + SourceIndex(0) +5 >Emitted(80, 13) Source(139, 19) + SourceIndex(0) +6 >Emitted(80, 14) Source(139, 20) + SourceIndex(0) --- ->>> f: function (i, s) { +>>> f: function (i, s) { return s; } 1->^^^^ 2 > ^ 3 > ^^ @@ -2154,6 +2080,13 @@ sourceFile:contextualTyping.ts 5 > ^ 6 > ^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1->{ > 2 > f @@ -2162,38 +2095,27 @@ sourceFile:contextualTyping.ts 5 > i 6 > , 7 > s -1->Emitted(113, 5) Source(140, 5) + SourceIndex(0) -2 >Emitted(113, 6) Source(140, 6) + SourceIndex(0) -3 >Emitted(113, 8) Source(140, 8) + SourceIndex(0) -4 >Emitted(113, 18) Source(140, 17) + SourceIndex(0) -5 >Emitted(113, 19) Source(140, 18) + SourceIndex(0) -6 >Emitted(113, 21) Source(140, 20) + SourceIndex(0) -7 >Emitted(113, 22) Source(140, 21) + SourceIndex(0) ---- ->>> return s; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(114, 9) Source(140, 25) + SourceIndex(0) -2 >Emitted(114, 15) Source(140, 31) + SourceIndex(0) -3 >Emitted(114, 16) Source(140, 32) + SourceIndex(0) -4 >Emitted(114, 17) Source(140, 33) + SourceIndex(0) -5 >Emitted(114, 18) Source(140, 34) + SourceIndex(0) ---- ->>> } -1 >^^^^ -2 > ^ -1 > -2 > } -1 >Emitted(115, 5) Source(140, 35) + SourceIndex(0) -2 >Emitted(115, 6) Source(140, 36) + SourceIndex(0) +8 > ) { +9 > return +10> +11> s +12> ; +13> +14> } +1->Emitted(81, 5) Source(140, 5) + SourceIndex(0) +2 >Emitted(81, 6) Source(140, 6) + SourceIndex(0) +3 >Emitted(81, 8) Source(140, 8) + SourceIndex(0) +4 >Emitted(81, 18) Source(140, 17) + SourceIndex(0) +5 >Emitted(81, 19) Source(140, 18) + SourceIndex(0) +6 >Emitted(81, 21) Source(140, 20) + SourceIndex(0) +7 >Emitted(81, 22) Source(140, 21) + SourceIndex(0) +8 >Emitted(81, 26) Source(140, 25) + SourceIndex(0) +9 >Emitted(81, 32) Source(140, 31) + SourceIndex(0) +10>Emitted(81, 33) Source(140, 32) + SourceIndex(0) +11>Emitted(81, 34) Source(140, 33) + SourceIndex(0) +12>Emitted(81, 35) Source(140, 34) + SourceIndex(0) +13>Emitted(81, 36) Source(140, 35) + SourceIndex(0) +14>Emitted(81, 37) Source(140, 36) + SourceIndex(0) --- >>>}); 1 >^ @@ -2204,9 +2126,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(116, 2) Source(141, 2) + SourceIndex(0) -2 >Emitted(116, 3) Source(141, 3) + SourceIndex(0) -3 >Emitted(116, 4) Source(141, 3) + SourceIndex(0) +1 >Emitted(82, 2) Source(141, 2) + SourceIndex(0) +2 >Emitted(82, 3) Source(141, 3) + SourceIndex(0) +3 >Emitted(82, 4) Source(141, 3) + SourceIndex(0) --- >>>objc8.t14 = ({ 1-> @@ -2222,12 +2144,12 @@ sourceFile:contextualTyping.ts 4 > t14 5 > = 6 > ( -1->Emitted(117, 1) Source(142, 1) + SourceIndex(0) -2 >Emitted(117, 6) Source(142, 6) + SourceIndex(0) -3 >Emitted(117, 7) Source(142, 7) + SourceIndex(0) -4 >Emitted(117, 10) Source(142, 10) + SourceIndex(0) -5 >Emitted(117, 13) Source(142, 19) + SourceIndex(0) -6 >Emitted(117, 14) Source(142, 20) + SourceIndex(0) +1->Emitted(83, 1) Source(142, 1) + SourceIndex(0) +2 >Emitted(83, 6) Source(142, 6) + SourceIndex(0) +3 >Emitted(83, 7) Source(142, 7) + SourceIndex(0) +4 >Emitted(83, 10) Source(142, 10) + SourceIndex(0) +5 >Emitted(83, 13) Source(142, 19) + SourceIndex(0) +6 >Emitted(83, 14) Source(142, 20) + SourceIndex(0) --- >>> a: [] 1 >^^^^ @@ -2239,10 +2161,10 @@ sourceFile:contextualTyping.ts 2 > a 3 > : 4 > [] -1 >Emitted(118, 5) Source(143, 5) + SourceIndex(0) -2 >Emitted(118, 6) Source(143, 6) + SourceIndex(0) -3 >Emitted(118, 8) Source(143, 8) + SourceIndex(0) -4 >Emitted(118, 10) Source(143, 10) + SourceIndex(0) +1 >Emitted(84, 5) Source(143, 5) + SourceIndex(0) +2 >Emitted(84, 6) Source(143, 6) + SourceIndex(0) +3 >Emitted(84, 8) Source(143, 8) + SourceIndex(0) +4 >Emitted(84, 10) Source(143, 10) + SourceIndex(0) --- >>>}); 1 >^ @@ -2253,9 +2175,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(119, 2) Source(144, 2) + SourceIndex(0) -2 >Emitted(119, 3) Source(144, 3) + SourceIndex(0) -3 >Emitted(119, 4) Source(144, 3) + SourceIndex(0) +1 >Emitted(85, 2) Source(144, 2) + SourceIndex(0) +2 >Emitted(85, 3) Source(144, 3) + SourceIndex(0) +3 >Emitted(85, 4) Source(144, 3) + SourceIndex(0) --- >>>// CONTEXT: Function call 1-> @@ -2266,9 +2188,9 @@ sourceFile:contextualTyping.ts > 2 > 3 >// CONTEXT: Function call -1->Emitted(120, 1) Source(146, 1) + SourceIndex(0) -2 >Emitted(120, 1) Source(145, 1) + SourceIndex(0) -3 >Emitted(120, 26) Source(145, 26) + SourceIndex(0) +1->Emitted(86, 1) Source(146, 1) + SourceIndex(0) +2 >Emitted(86, 1) Source(145, 1) + SourceIndex(0) +3 >Emitted(86, 26) Source(145, 26) + SourceIndex(0) --- >>>function c9t5(f) { } 1 >^^^^^^^^^ @@ -2282,11 +2204,11 @@ sourceFile:contextualTyping.ts 3 > ( 4 > f: (n: number) => IFoo 5 > ) {} -1 >Emitted(121, 10) Source(146, 10) + SourceIndex(0) -2 >Emitted(121, 14) Source(146, 14) + SourceIndex(0) -3 >Emitted(121, 15) Source(146, 15) + SourceIndex(0) -4 >Emitted(121, 16) Source(146, 37) + SourceIndex(0) -5 >Emitted(121, 21) Source(146, 41) + SourceIndex(0) +1 >Emitted(87, 10) Source(146, 10) + SourceIndex(0) +2 >Emitted(87, 14) Source(146, 14) + SourceIndex(0) +3 >Emitted(87, 15) Source(146, 15) + SourceIndex(0) +4 >Emitted(87, 16) Source(146, 37) + SourceIndex(0) +5 >Emitted(87, 21) Source(146, 41) + SourceIndex(0) --- >>>; 1 > @@ -2294,8 +2216,8 @@ sourceFile:contextualTyping.ts 3 > ^^^^^^^^^^^^^^^^^^^-> 1 > 2 >; -1 >Emitted(122, 1) Source(146, 41) + SourceIndex(0) -2 >Emitted(122, 2) Source(146, 42) + SourceIndex(0) +1 >Emitted(88, 1) Source(146, 41) + SourceIndex(0) +2 >Emitted(88, 2) Source(146, 42) + SourceIndex(0) --- >>>c9t5(function (n) { 1-> @@ -2310,11 +2232,11 @@ sourceFile:contextualTyping.ts 3 > ( 4 > function( 5 > n -1->Emitted(123, 1) Source(147, 1) + SourceIndex(0) -2 >Emitted(123, 5) Source(147, 5) + SourceIndex(0) -3 >Emitted(123, 6) Source(147, 6) + SourceIndex(0) -4 >Emitted(123, 16) Source(147, 15) + SourceIndex(0) -5 >Emitted(123, 17) Source(147, 16) + SourceIndex(0) +1->Emitted(89, 1) Source(147, 1) + SourceIndex(0) +2 >Emitted(89, 5) Source(147, 5) + SourceIndex(0) +3 >Emitted(89, 6) Source(147, 6) + SourceIndex(0) +4 >Emitted(89, 16) Source(147, 15) + SourceIndex(0) +5 >Emitted(89, 17) Source(147, 16) + SourceIndex(0) --- >>> return ({}); 1->^^^^ @@ -2332,13 +2254,13 @@ sourceFile:contextualTyping.ts 5 > {} 6 > ) 7 > ; -1->Emitted(124, 5) Source(148, 5) + SourceIndex(0) -2 >Emitted(124, 11) Source(148, 11) + SourceIndex(0) -3 >Emitted(124, 12) Source(148, 18) + SourceIndex(0) -4 >Emitted(124, 13) Source(148, 19) + SourceIndex(0) -5 >Emitted(124, 15) Source(148, 21) + SourceIndex(0) -6 >Emitted(124, 16) Source(148, 22) + SourceIndex(0) -7 >Emitted(124, 17) Source(148, 23) + SourceIndex(0) +1->Emitted(90, 5) Source(148, 5) + SourceIndex(0) +2 >Emitted(90, 11) Source(148, 11) + SourceIndex(0) +3 >Emitted(90, 12) Source(148, 18) + SourceIndex(0) +4 >Emitted(90, 13) Source(148, 19) + SourceIndex(0) +5 >Emitted(90, 15) Source(148, 21) + SourceIndex(0) +6 >Emitted(90, 16) Source(148, 22) + SourceIndex(0) +7 >Emitted(90, 17) Source(148, 23) + SourceIndex(0) --- >>>}); 1 > @@ -2351,115 +2273,106 @@ sourceFile:contextualTyping.ts 2 >} 3 > ) 4 > ; -1 >Emitted(125, 1) Source(149, 1) + SourceIndex(0) -2 >Emitted(125, 2) Source(149, 2) + SourceIndex(0) -3 >Emitted(125, 3) Source(149, 3) + SourceIndex(0) -4 >Emitted(125, 4) Source(149, 4) + SourceIndex(0) +1 >Emitted(91, 1) Source(149, 1) + SourceIndex(0) +2 >Emitted(91, 2) Source(149, 2) + SourceIndex(0) +3 >Emitted(91, 3) Source(149, 3) + SourceIndex(0) +4 >Emitted(91, 4) Source(149, 4) + SourceIndex(0) --- >>>// CONTEXT: Return statement 1-> 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > >// CONTEXT: Return statement > 2 > 3 >// CONTEXT: Return statement -1->Emitted(126, 1) Source(152, 1) + SourceIndex(0) -2 >Emitted(126, 1) Source(151, 1) + SourceIndex(0) -3 >Emitted(126, 29) Source(151, 29) + SourceIndex(0) +1->Emitted(92, 1) Source(152, 1) + SourceIndex(0) +2 >Emitted(92, 1) Source(151, 1) + SourceIndex(0) +3 >Emitted(92, 29) Source(151, 29) + SourceIndex(0) --- ->>>var c10t5 = function () { -1 >^^^^ +>>>var c10t5 = function () { return function (n) { return ({}); }; }; +1->^^^^ 2 > ^^^^^ 3 > ^^^ -4 > ^^^^^^^^^^^^^^-> -1 > +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^^^^^^^ +8 > ^ +9 > ^^^^ +10> ^^^^^^ +11> ^ +12> ^ +13> ^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^ +20> ^ +21> ^ +1-> >var 2 > c10t5 3 > : () => (n: number) => IFoo = -1 >Emitted(127, 5) Source(152, 5) + SourceIndex(0) -2 >Emitted(127, 10) Source(152, 10) + SourceIndex(0) -3 >Emitted(127, 13) Source(152, 40) + SourceIndex(0) ---- ->>> return function (n) { -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^^^^^ -5 > ^ -1->function() { -2 > return -3 > -4 > function( -5 > n -1->Emitted(128, 5) Source(152, 53) + SourceIndex(0) -2 >Emitted(128, 11) Source(152, 59) + SourceIndex(0) -3 >Emitted(128, 12) Source(152, 60) + SourceIndex(0) -4 >Emitted(128, 22) Source(152, 69) + SourceIndex(0) -5 >Emitted(128, 23) Source(152, 70) + SourceIndex(0) ---- ->>> return ({}); -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(129, 9) Source(152, 74) + SourceIndex(0) -2 >Emitted(129, 15) Source(152, 80) + SourceIndex(0) -3 >Emitted(129, 16) Source(152, 87) + SourceIndex(0) -4 >Emitted(129, 17) Source(152, 88) + SourceIndex(0) -5 >Emitted(129, 19) Source(152, 90) + SourceIndex(0) -6 >Emitted(129, 20) Source(152, 91) + SourceIndex(0) -7 >Emitted(129, 21) Source(152, 91) + SourceIndex(0) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^ -1 > -2 > } -3 > -1 >Emitted(130, 5) Source(152, 92) + SourceIndex(0) -2 >Emitted(130, 6) Source(152, 93) + SourceIndex(0) -3 >Emitted(130, 7) Source(152, 93) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(131, 1) Source(152, 94) + SourceIndex(0) -2 >Emitted(131, 2) Source(152, 95) + SourceIndex(0) -3 >Emitted(131, 3) Source(152, 96) + SourceIndex(0) +4 > function() { +5 > return +6 > +7 > function( +8 > n +9 > ) { +10> return +11> +12> ( +13> {} +14> ) +15> +16> +17> } +18> +19> +20> } +21> ; +1->Emitted(93, 5) Source(152, 5) + SourceIndex(0) +2 >Emitted(93, 10) Source(152, 10) + SourceIndex(0) +3 >Emitted(93, 13) Source(152, 40) + SourceIndex(0) +4 >Emitted(93, 27) Source(152, 53) + SourceIndex(0) +5 >Emitted(93, 33) Source(152, 59) + SourceIndex(0) +6 >Emitted(93, 34) Source(152, 60) + SourceIndex(0) +7 >Emitted(93, 44) Source(152, 69) + SourceIndex(0) +8 >Emitted(93, 45) Source(152, 70) + SourceIndex(0) +9 >Emitted(93, 49) Source(152, 74) + SourceIndex(0) +10>Emitted(93, 55) Source(152, 80) + SourceIndex(0) +11>Emitted(93, 56) Source(152, 87) + SourceIndex(0) +12>Emitted(93, 57) Source(152, 88) + SourceIndex(0) +13>Emitted(93, 59) Source(152, 90) + SourceIndex(0) +14>Emitted(93, 60) Source(152, 91) + SourceIndex(0) +15>Emitted(93, 61) Source(152, 91) + SourceIndex(0) +16>Emitted(93, 62) Source(152, 92) + SourceIndex(0) +17>Emitted(93, 63) Source(152, 93) + SourceIndex(0) +18>Emitted(93, 64) Source(152, 93) + SourceIndex(0) +19>Emitted(93, 65) Source(152, 94) + SourceIndex(0) +20>Emitted(93, 66) Source(152, 95) + SourceIndex(0) +21>Emitted(93, 67) Source(152, 96) + SourceIndex(0) --- >>>// CONTEXT: Newing a class -1-> +1 > 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^ 4 > ^-> -1-> +1 > > >// CONTEXT: Newing a class > 2 > 3 >// CONTEXT: Newing a class -1->Emitted(132, 1) Source(155, 1) + SourceIndex(0) -2 >Emitted(132, 1) Source(154, 1) + SourceIndex(0) -3 >Emitted(132, 27) Source(154, 27) + SourceIndex(0) +1 >Emitted(94, 1) Source(155, 1) + SourceIndex(0) +2 >Emitted(94, 1) Source(154, 1) + SourceIndex(0) +3 >Emitted(94, 27) Source(154, 27) + SourceIndex(0) --- >>>var C11t5 = (function () { 1->^^^^ @@ -2468,8 +2381,8 @@ sourceFile:contextualTyping.ts 1-> >class 2 > C11t5 -1->Emitted(133, 5) Source(155, 7) + SourceIndex(0) -2 >Emitted(133, 10) Source(155, 12) + SourceIndex(0) +1->Emitted(95, 5) Source(155, 7) + SourceIndex(0) +2 >Emitted(95, 10) Source(155, 12) + SourceIndex(0) --- >>> function C11t5(f) { 1->^^^^ @@ -2482,11 +2395,11 @@ sourceFile:contextualTyping.ts 3 > C11t5 4 > { constructor( 5 > f: (n: number) => IFoo -1->Emitted(134, 5) Source(155, 15) + SourceIndex(0) name (C11t5) -2 >Emitted(134, 14) Source(155, 7) + SourceIndex(0) name (C11t5) -3 >Emitted(134, 19) Source(155, 12) + SourceIndex(0) name (C11t5) -4 >Emitted(134, 20) Source(155, 27) + SourceIndex(0) name (C11t5) -5 >Emitted(134, 21) Source(155, 49) + SourceIndex(0) name (C11t5) +1->Emitted(96, 5) Source(155, 15) + SourceIndex(0) name (C11t5) +2 >Emitted(96, 14) Source(155, 7) + SourceIndex(0) name (C11t5) +3 >Emitted(96, 19) Source(155, 12) + SourceIndex(0) name (C11t5) +4 >Emitted(96, 20) Source(155, 27) + SourceIndex(0) name (C11t5) +5 >Emitted(96, 21) Source(155, 49) + SourceIndex(0) name (C11t5) --- >>> } 1 >^^^^ @@ -2494,16 +2407,16 @@ sourceFile:contextualTyping.ts 3 > ^^^^^^^^^^^^^-> 1 >) { 2 > } -1 >Emitted(135, 5) Source(155, 53) + SourceIndex(0) name (C11t5.constructor) -2 >Emitted(135, 6) Source(155, 54) + SourceIndex(0) name (C11t5.constructor) +1 >Emitted(97, 5) Source(155, 53) + SourceIndex(0) name (C11t5.constructor) +2 >Emitted(97, 6) Source(155, 54) + SourceIndex(0) name (C11t5.constructor) --- >>> return C11t5; 1->^^^^ 2 > ^^^^^^^^^^^^ 1-> 2 > } -1->Emitted(136, 5) Source(155, 55) + SourceIndex(0) name (C11t5) -2 >Emitted(136, 17) Source(155, 56) + SourceIndex(0) name (C11t5) +1->Emitted(98, 5) Source(155, 55) + SourceIndex(0) name (C11t5) +2 >Emitted(98, 17) Source(155, 56) + SourceIndex(0) name (C11t5) --- >>>})(); 1 > @@ -2514,21 +2427,21 @@ sourceFile:contextualTyping.ts 2 >} 3 > 4 > class C11t5 { constructor(f: (n: number) => IFoo) { } } -1 >Emitted(137, 1) Source(155, 55) + SourceIndex(0) name (C11t5) -2 >Emitted(137, 2) Source(155, 56) + SourceIndex(0) name (C11t5) -3 >Emitted(137, 2) Source(155, 1) + SourceIndex(0) -4 >Emitted(137, 6) Source(155, 56) + SourceIndex(0) +1 >Emitted(99, 1) Source(155, 55) + SourceIndex(0) name (C11t5) +2 >Emitted(99, 2) Source(155, 56) + SourceIndex(0) name (C11t5) +3 >Emitted(99, 2) Source(155, 1) + SourceIndex(0) +4 >Emitted(99, 6) Source(155, 56) + SourceIndex(0) --- >>>; 1 > 2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 >; -1 >Emitted(138, 1) Source(155, 56) + SourceIndex(0) -2 >Emitted(138, 2) Source(155, 57) + SourceIndex(0) +1 >Emitted(100, 1) Source(155, 56) + SourceIndex(0) +2 >Emitted(100, 2) Source(155, 57) + SourceIndex(0) --- ->>>var i = new C11t5(function (n) { +>>>var i = new C11t5(function (n) { return ({}); }); 1-> 2 >^^^^ 3 > ^ @@ -2538,6 +2451,17 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^^^^^^^^^ 9 > ^ +10> ^^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^^ +15> ^ +16> ^ +17> ^ +18> ^ +19> ^ +20> ^ 1-> > 2 >var @@ -2548,138 +2472,118 @@ sourceFile:contextualTyping.ts 7 > ( 8 > function( 9 > n -1->Emitted(139, 1) Source(156, 1) + SourceIndex(0) -2 >Emitted(139, 5) Source(156, 5) + SourceIndex(0) -3 >Emitted(139, 6) Source(156, 6) + SourceIndex(0) -4 >Emitted(139, 9) Source(156, 9) + SourceIndex(0) -5 >Emitted(139, 13) Source(156, 13) + SourceIndex(0) -6 >Emitted(139, 18) Source(156, 18) + SourceIndex(0) -7 >Emitted(139, 19) Source(156, 19) + SourceIndex(0) -8 >Emitted(139, 29) Source(156, 28) + SourceIndex(0) -9 >Emitted(139, 30) Source(156, 29) + SourceIndex(0) ---- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(140, 5) Source(156, 33) + SourceIndex(0) -2 >Emitted(140, 11) Source(156, 39) + SourceIndex(0) -3 >Emitted(140, 12) Source(156, 46) + SourceIndex(0) -4 >Emitted(140, 13) Source(156, 47) + SourceIndex(0) -5 >Emitted(140, 15) Source(156, 49) + SourceIndex(0) -6 >Emitted(140, 16) Source(156, 50) + SourceIndex(0) -7 >Emitted(140, 17) Source(156, 50) + SourceIndex(0) ---- ->>>}); -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ) -4 > ; -1 >Emitted(141, 1) Source(156, 51) + SourceIndex(0) -2 >Emitted(141, 2) Source(156, 52) + SourceIndex(0) -3 >Emitted(141, 3) Source(156, 53) + SourceIndex(0) -4 >Emitted(141, 4) Source(156, 54) + SourceIndex(0) +10> ) { +11> return +12> +13> ( +14> {} +15> ) +16> +17> +18> } +19> ) +20> ; +1->Emitted(101, 1) Source(156, 1) + SourceIndex(0) +2 >Emitted(101, 5) Source(156, 5) + SourceIndex(0) +3 >Emitted(101, 6) Source(156, 6) + SourceIndex(0) +4 >Emitted(101, 9) Source(156, 9) + SourceIndex(0) +5 >Emitted(101, 13) Source(156, 13) + SourceIndex(0) +6 >Emitted(101, 18) Source(156, 18) + SourceIndex(0) +7 >Emitted(101, 19) Source(156, 19) + SourceIndex(0) +8 >Emitted(101, 29) Source(156, 28) + SourceIndex(0) +9 >Emitted(101, 30) Source(156, 29) + SourceIndex(0) +10>Emitted(101, 34) Source(156, 33) + SourceIndex(0) +11>Emitted(101, 40) Source(156, 39) + SourceIndex(0) +12>Emitted(101, 41) Source(156, 46) + SourceIndex(0) +13>Emitted(101, 42) Source(156, 47) + SourceIndex(0) +14>Emitted(101, 44) Source(156, 49) + SourceIndex(0) +15>Emitted(101, 45) Source(156, 50) + SourceIndex(0) +16>Emitted(101, 46) Source(156, 50) + SourceIndex(0) +17>Emitted(101, 47) Source(156, 51) + SourceIndex(0) +18>Emitted(101, 48) Source(156, 52) + SourceIndex(0) +19>Emitted(101, 49) Source(156, 53) + SourceIndex(0) +20>Emitted(101, 50) Source(156, 54) + SourceIndex(0) --- >>>// CONTEXT: Type annotated expression -1-> +1 > 2 > 3 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1-> +4 > ^^^^^-> +1 > > >// CONTEXT: Type annotated expression > 2 > 3 >// CONTEXT: Type annotated expression -1->Emitted(142, 1) Source(159, 1) + SourceIndex(0) -2 >Emitted(142, 1) Source(158, 1) + SourceIndex(0) -3 >Emitted(142, 38) Source(158, 38) + SourceIndex(0) +1 >Emitted(102, 1) Source(159, 1) + SourceIndex(0) +2 >Emitted(102, 1) Source(158, 1) + SourceIndex(0) +3 >Emitted(102, 38) Source(158, 38) + SourceIndex(0) --- ->>>var c12t1 = (function (s) { -1 >^^^^ +>>>var c12t1 = (function (s) { return s; }); +1->^^^^ 2 > ^^^^^ 3 > ^^^ 4 > ^ 5 > ^^^^^^^^^^ 6 > ^ -1 > +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^ +1-> >var 2 > c12t1 3 > = <(s: string) => string> 4 > ( 5 > function( 6 > s -1 >Emitted(143, 5) Source(159, 5) + SourceIndex(0) -2 >Emitted(143, 10) Source(159, 10) + SourceIndex(0) -3 >Emitted(143, 13) Source(159, 37) + SourceIndex(0) -4 >Emitted(143, 14) Source(159, 38) + SourceIndex(0) -5 >Emitted(143, 24) Source(159, 47) + SourceIndex(0) -6 >Emitted(143, 25) Source(159, 48) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > -1 >Emitted(144, 5) Source(159, 52) + SourceIndex(0) -2 >Emitted(144, 11) Source(159, 58) + SourceIndex(0) -3 >Emitted(144, 12) Source(159, 59) + SourceIndex(0) -4 >Emitted(144, 13) Source(159, 60) + SourceIndex(0) -5 >Emitted(144, 14) Source(159, 60) + SourceIndex(0) ---- ->>>}); -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > ) -4 > ; -1 >Emitted(145, 1) Source(159, 61) + SourceIndex(0) -2 >Emitted(145, 2) Source(159, 62) + SourceIndex(0) -3 >Emitted(145, 3) Source(159, 63) + SourceIndex(0) -4 >Emitted(145, 4) Source(159, 64) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> s +11> +12> +13> } +14> ) +15> ; +1->Emitted(103, 5) Source(159, 5) + SourceIndex(0) +2 >Emitted(103, 10) Source(159, 10) + SourceIndex(0) +3 >Emitted(103, 13) Source(159, 37) + SourceIndex(0) +4 >Emitted(103, 14) Source(159, 38) + SourceIndex(0) +5 >Emitted(103, 24) Source(159, 47) + SourceIndex(0) +6 >Emitted(103, 25) Source(159, 48) + SourceIndex(0) +7 >Emitted(103, 29) Source(159, 52) + SourceIndex(0) +8 >Emitted(103, 35) Source(159, 58) + SourceIndex(0) +9 >Emitted(103, 36) Source(159, 59) + SourceIndex(0) +10>Emitted(103, 37) Source(159, 60) + SourceIndex(0) +11>Emitted(103, 38) Source(159, 60) + SourceIndex(0) +12>Emitted(103, 39) Source(159, 61) + SourceIndex(0) +13>Emitted(103, 40) Source(159, 62) + SourceIndex(0) +14>Emitted(103, 41) Source(159, 63) + SourceIndex(0) +15>Emitted(103, 42) Source(159, 64) + SourceIndex(0) --- >>>var c12t2 = ({ -1-> +1 > 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^ -1-> +1 > > 2 >var 3 > c12t2 4 > = 5 > ( -1->Emitted(146, 1) Source(160, 1) + SourceIndex(0) -2 >Emitted(146, 5) Source(160, 5) + SourceIndex(0) -3 >Emitted(146, 10) Source(160, 10) + SourceIndex(0) -4 >Emitted(146, 13) Source(160, 20) + SourceIndex(0) -5 >Emitted(146, 14) Source(160, 21) + SourceIndex(0) +1 >Emitted(104, 1) Source(160, 1) + SourceIndex(0) +2 >Emitted(104, 5) Source(160, 5) + SourceIndex(0) +3 >Emitted(104, 10) Source(160, 10) + SourceIndex(0) +4 >Emitted(104, 13) Source(160, 20) + SourceIndex(0) +5 >Emitted(104, 14) Source(160, 21) + SourceIndex(0) --- >>> n: 1 1 >^^^^ @@ -2691,10 +2595,10 @@ sourceFile:contextualTyping.ts 2 > n 3 > : 4 > 1 -1 >Emitted(147, 5) Source(161, 5) + SourceIndex(0) -2 >Emitted(147, 6) Source(161, 6) + SourceIndex(0) -3 >Emitted(147, 8) Source(161, 8) + SourceIndex(0) -4 >Emitted(147, 9) Source(161, 9) + SourceIndex(0) +1 >Emitted(105, 5) Source(161, 5) + SourceIndex(0) +2 >Emitted(105, 6) Source(161, 6) + SourceIndex(0) +3 >Emitted(105, 8) Source(161, 8) + SourceIndex(0) +4 >Emitted(105, 9) Source(161, 9) + SourceIndex(0) --- >>>}); 1 >^ @@ -2705,9 +2609,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > ; -1 >Emitted(148, 2) Source(162, 2) + SourceIndex(0) -2 >Emitted(148, 3) Source(162, 3) + SourceIndex(0) -3 >Emitted(148, 4) Source(162, 4) + SourceIndex(0) +1 >Emitted(106, 2) Source(162, 2) + SourceIndex(0) +2 >Emitted(106, 3) Source(162, 3) + SourceIndex(0) +3 >Emitted(106, 4) Source(162, 4) + SourceIndex(0) --- >>>var c12t3 = []; 1-> @@ -2716,7 +2620,7 @@ sourceFile:contextualTyping.ts 4 > ^^^ 5 > ^^ 6 > ^ -7 > ^^^^^^^^^^^-> +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -2724,71 +2628,77 @@ sourceFile:contextualTyping.ts 4 > = 5 > [] 6 > ; -1->Emitted(149, 1) Source(163, 1) + SourceIndex(0) -2 >Emitted(149, 5) Source(163, 5) + SourceIndex(0) -3 >Emitted(149, 10) Source(163, 10) + SourceIndex(0) -4 >Emitted(149, 13) Source(163, 24) + SourceIndex(0) -5 >Emitted(149, 15) Source(163, 26) + SourceIndex(0) -6 >Emitted(149, 16) Source(163, 27) + SourceIndex(0) +1->Emitted(107, 1) Source(163, 1) + SourceIndex(0) +2 >Emitted(107, 5) Source(163, 5) + SourceIndex(0) +3 >Emitted(107, 10) Source(163, 10) + SourceIndex(0) +4 >Emitted(107, 13) Source(163, 24) + SourceIndex(0) +5 >Emitted(107, 15) Source(163, 26) + SourceIndex(0) +6 >Emitted(107, 16) Source(163, 27) + SourceIndex(0) --- ->>>var c12t4 = function () { +>>>var c12t4 = function () { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ -5 > ^^^^^-> +5 > ^^^^^^^^^^^^^^ +6 > ^^^^^^ +7 > ^ +8 > ^ +9 > ^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^^-> 1-> > 2 >var 3 > c12t4 4 > = <() => IFoo> -1->Emitted(150, 1) Source(164, 1) + SourceIndex(0) -2 >Emitted(150, 5) Source(164, 5) + SourceIndex(0) -3 >Emitted(150, 10) Source(164, 10) + SourceIndex(0) -4 >Emitted(150, 13) Source(164, 26) + SourceIndex(0) +5 > function() { +6 > return +7 > +8 > ( +9 > {} +10> ) +11> +12> +13> } +14> ; +1->Emitted(108, 1) Source(164, 1) + SourceIndex(0) +2 >Emitted(108, 5) Source(164, 5) + SourceIndex(0) +3 >Emitted(108, 10) Source(164, 10) + SourceIndex(0) +4 >Emitted(108, 13) Source(164, 26) + SourceIndex(0) +5 >Emitted(108, 27) Source(164, 39) + SourceIndex(0) +6 >Emitted(108, 33) Source(164, 45) + SourceIndex(0) +7 >Emitted(108, 34) Source(164, 52) + SourceIndex(0) +8 >Emitted(108, 35) Source(164, 53) + SourceIndex(0) +9 >Emitted(108, 37) Source(164, 55) + SourceIndex(0) +10>Emitted(108, 38) Source(164, 56) + SourceIndex(0) +11>Emitted(108, 39) Source(164, 56) + SourceIndex(0) +12>Emitted(108, 40) Source(164, 57) + SourceIndex(0) +13>Emitted(108, 41) Source(164, 58) + SourceIndex(0) +14>Emitted(108, 42) Source(164, 59) + SourceIndex(0) --- ->>> return ({}); -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1->function() { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1->Emitted(151, 5) Source(164, 39) + SourceIndex(0) -2 >Emitted(151, 11) Source(164, 45) + SourceIndex(0) -3 >Emitted(151, 12) Source(164, 52) + SourceIndex(0) -4 >Emitted(151, 13) Source(164, 53) + SourceIndex(0) -5 >Emitted(151, 15) Source(164, 55) + SourceIndex(0) -6 >Emitted(151, 16) Source(164, 56) + SourceIndex(0) -7 >Emitted(151, 17) Source(164, 56) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(152, 1) Source(164, 57) + SourceIndex(0) -2 >Emitted(152, 2) Source(164, 58) + SourceIndex(0) -3 >Emitted(152, 3) Source(164, 59) + SourceIndex(0) ---- ->>>var c12t5 = function (n) { +>>>var c12t5 = function (n) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^^^^-> 1-> > 2 >var @@ -2796,49 +2706,34 @@ sourceFile:contextualTyping.ts 4 > = <(n: number) => IFoo> 5 > function( 6 > n -1->Emitted(153, 1) Source(165, 1) + SourceIndex(0) -2 >Emitted(153, 5) Source(165, 5) + SourceIndex(0) -3 >Emitted(153, 10) Source(165, 10) + SourceIndex(0) -4 >Emitted(153, 13) Source(165, 35) + SourceIndex(0) -5 >Emitted(153, 23) Source(165, 44) + SourceIndex(0) -6 >Emitted(153, 24) Source(165, 45) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> ( +11> {} +12> ) +13> +14> +15> } +16> ; +1->Emitted(109, 1) Source(165, 1) + SourceIndex(0) +2 >Emitted(109, 5) Source(165, 5) + SourceIndex(0) +3 >Emitted(109, 10) Source(165, 10) + SourceIndex(0) +4 >Emitted(109, 13) Source(165, 35) + SourceIndex(0) +5 >Emitted(109, 23) Source(165, 44) + SourceIndex(0) +6 >Emitted(109, 24) Source(165, 45) + SourceIndex(0) +7 >Emitted(109, 28) Source(165, 49) + SourceIndex(0) +8 >Emitted(109, 34) Source(165, 55) + SourceIndex(0) +9 >Emitted(109, 35) Source(165, 62) + SourceIndex(0) +10>Emitted(109, 36) Source(165, 63) + SourceIndex(0) +11>Emitted(109, 38) Source(165, 65) + SourceIndex(0) +12>Emitted(109, 39) Source(165, 66) + SourceIndex(0) +13>Emitted(109, 40) Source(165, 66) + SourceIndex(0) +14>Emitted(109, 41) Source(165, 67) + SourceIndex(0) +15>Emitted(109, 42) Source(165, 68) + SourceIndex(0) +16>Emitted(109, 43) Source(165, 69) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(154, 5) Source(165, 49) + SourceIndex(0) -2 >Emitted(154, 11) Source(165, 55) + SourceIndex(0) -3 >Emitted(154, 12) Source(165, 62) + SourceIndex(0) -4 >Emitted(154, 13) Source(165, 63) + SourceIndex(0) -5 >Emitted(154, 15) Source(165, 65) + SourceIndex(0) -6 >Emitted(154, 16) Source(165, 66) + SourceIndex(0) -7 >Emitted(154, 17) Source(165, 66) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(155, 1) Source(165, 67) + SourceIndex(0) -2 >Emitted(155, 2) Source(165, 68) + SourceIndex(0) -3 >Emitted(155, 3) Source(165, 69) + SourceIndex(0) ---- ->>>var c12t6 = function (n, s) { +>>>var c12t6 = function (n, s) { return ({}); }; 1-> 2 >^^^^ 3 > ^^^^^ @@ -2847,6 +2742,16 @@ sourceFile:contextualTyping.ts 6 > ^ 7 > ^^ 8 > ^ +9 > ^^^^ +10> ^^^^^^ +11> ^ +12> ^ +13> ^^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ 1-> > 2 >var @@ -2856,58 +2761,52 @@ sourceFile:contextualTyping.ts 6 > n 7 > , 8 > s -1->Emitted(156, 1) Source(166, 1) + SourceIndex(0) -2 >Emitted(156, 5) Source(166, 5) + SourceIndex(0) -3 >Emitted(156, 10) Source(166, 10) + SourceIndex(0) -4 >Emitted(156, 13) Source(166, 46) + SourceIndex(0) -5 >Emitted(156, 23) Source(166, 55) + SourceIndex(0) -6 >Emitted(156, 24) Source(166, 56) + SourceIndex(0) -7 >Emitted(156, 26) Source(166, 58) + SourceIndex(0) -8 >Emitted(156, 27) Source(166, 59) + SourceIndex(0) +9 > ) { +10> return +11> +12> ( +13> {} +14> ) +15> +16> +17> } +18> ; +1->Emitted(110, 1) Source(166, 1) + SourceIndex(0) +2 >Emitted(110, 5) Source(166, 5) + SourceIndex(0) +3 >Emitted(110, 10) Source(166, 10) + SourceIndex(0) +4 >Emitted(110, 13) Source(166, 46) + SourceIndex(0) +5 >Emitted(110, 23) Source(166, 55) + SourceIndex(0) +6 >Emitted(110, 24) Source(166, 56) + SourceIndex(0) +7 >Emitted(110, 26) Source(166, 58) + SourceIndex(0) +8 >Emitted(110, 27) Source(166, 59) + SourceIndex(0) +9 >Emitted(110, 31) Source(166, 63) + SourceIndex(0) +10>Emitted(110, 37) Source(166, 69) + SourceIndex(0) +11>Emitted(110, 38) Source(166, 76) + SourceIndex(0) +12>Emitted(110, 39) Source(166, 77) + SourceIndex(0) +13>Emitted(110, 41) Source(166, 79) + SourceIndex(0) +14>Emitted(110, 42) Source(166, 80) + SourceIndex(0) +15>Emitted(110, 43) Source(166, 80) + SourceIndex(0) +16>Emitted(110, 44) Source(166, 81) + SourceIndex(0) +17>Emitted(110, 45) Source(166, 82) + SourceIndex(0) +18>Emitted(110, 46) Source(166, 83) + SourceIndex(0) --- ->>> return ({}); -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^ -6 > ^ -7 > ^ -1 >) { -2 > return -3 > -4 > ( -5 > {} -6 > ) -7 > -1 >Emitted(157, 5) Source(166, 63) + SourceIndex(0) -2 >Emitted(157, 11) Source(166, 69) + SourceIndex(0) -3 >Emitted(157, 12) Source(166, 76) + SourceIndex(0) -4 >Emitted(157, 13) Source(166, 77) + SourceIndex(0) -5 >Emitted(157, 15) Source(166, 79) + SourceIndex(0) -6 >Emitted(157, 16) Source(166, 80) + SourceIndex(0) -7 >Emitted(157, 17) Source(166, 80) + SourceIndex(0) ---- ->>>}; +>>>var c12t7 = function (n) { return n; }; 1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(158, 1) Source(166, 81) + SourceIndex(0) -2 >Emitted(158, 2) Source(166, 82) + SourceIndex(0) -3 >Emitted(158, 3) Source(166, 83) + SourceIndex(0) ---- ->>>var c12t7 = function (n) { -1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ -1-> +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ +15> ^-> +1 > > 2 >var 3 > c12t7 @@ -2917,49 +2816,44 @@ sourceFile:contextualTyping.ts > }> 5 > function( 6 > n:number -1->Emitted(159, 1) Source(167, 1) + SourceIndex(0) -2 >Emitted(159, 5) Source(167, 5) + SourceIndex(0) -3 >Emitted(159, 10) Source(167, 10) + SourceIndex(0) -4 >Emitted(159, 13) Source(170, 4) + SourceIndex(0) -5 >Emitted(159, 23) Source(170, 13) + SourceIndex(0) -6 >Emitted(159, 24) Source(170, 21) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> n +11> +12> +13> } +14> ; +1 >Emitted(111, 1) Source(167, 1) + SourceIndex(0) +2 >Emitted(111, 5) Source(167, 5) + SourceIndex(0) +3 >Emitted(111, 10) Source(167, 10) + SourceIndex(0) +4 >Emitted(111, 13) Source(170, 4) + SourceIndex(0) +5 >Emitted(111, 23) Source(170, 13) + SourceIndex(0) +6 >Emitted(111, 24) Source(170, 21) + SourceIndex(0) +7 >Emitted(111, 28) Source(170, 25) + SourceIndex(0) +8 >Emitted(111, 34) Source(170, 31) + SourceIndex(0) +9 >Emitted(111, 35) Source(170, 32) + SourceIndex(0) +10>Emitted(111, 36) Source(170, 33) + SourceIndex(0) +11>Emitted(111, 37) Source(170, 33) + SourceIndex(0) +12>Emitted(111, 38) Source(170, 34) + SourceIndex(0) +13>Emitted(111, 39) Source(170, 35) + SourceIndex(0) +14>Emitted(111, 40) Source(170, 36) + SourceIndex(0) --- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > -1 >Emitted(160, 5) Source(170, 25) + SourceIndex(0) -2 >Emitted(160, 11) Source(170, 31) + SourceIndex(0) -3 >Emitted(160, 12) Source(170, 32) + SourceIndex(0) -4 >Emitted(160, 13) Source(170, 33) + SourceIndex(0) -5 >Emitted(160, 14) Source(170, 33) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(161, 1) Source(170, 34) + SourceIndex(0) -2 >Emitted(161, 2) Source(170, 35) + SourceIndex(0) -3 >Emitted(161, 3) Source(170, 36) + SourceIndex(0) ---- ->>>var c12t8 = function (n) { +>>>var c12t8 = function (n) { return n; }; 1-> 2 >^^^^ 3 > ^^^^^ 4 > ^^^ 5 > ^^^^^^^^^^ 6 > ^ +7 > ^^^^ +8 > ^^^^^^ +9 > ^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1-> > > @@ -2968,44 +2862,31 @@ sourceFile:contextualTyping.ts 4 > = <(n: number, s: string) => number> 5 > function( 6 > n -1->Emitted(162, 1) Source(172, 1) + SourceIndex(0) -2 >Emitted(162, 5) Source(172, 5) + SourceIndex(0) -3 >Emitted(162, 10) Source(172, 10) + SourceIndex(0) -4 >Emitted(162, 13) Source(172, 48) + SourceIndex(0) -5 >Emitted(162, 23) Source(172, 57) + SourceIndex(0) -6 >Emitted(162, 24) Source(172, 58) + SourceIndex(0) ---- ->>> return n; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > n -5 > ; -1 >Emitted(163, 5) Source(172, 62) + SourceIndex(0) -2 >Emitted(163, 11) Source(172, 68) + SourceIndex(0) -3 >Emitted(163, 12) Source(172, 69) + SourceIndex(0) -4 >Emitted(163, 13) Source(172, 70) + SourceIndex(0) -5 >Emitted(163, 14) Source(172, 71) + SourceIndex(0) ---- ->>>}; -1 > -2 >^ -3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -3 > ; -1 >Emitted(164, 1) Source(172, 72) + SourceIndex(0) -2 >Emitted(164, 2) Source(172, 73) + SourceIndex(0) -3 >Emitted(164, 3) Source(172, 74) + SourceIndex(0) +7 > ) { +8 > return +9 > +10> n +11> ; +12> +13> } +14> ; +1->Emitted(112, 1) Source(172, 1) + SourceIndex(0) +2 >Emitted(112, 5) Source(172, 5) + SourceIndex(0) +3 >Emitted(112, 10) Source(172, 10) + SourceIndex(0) +4 >Emitted(112, 13) Source(172, 48) + SourceIndex(0) +5 >Emitted(112, 23) Source(172, 57) + SourceIndex(0) +6 >Emitted(112, 24) Source(172, 58) + SourceIndex(0) +7 >Emitted(112, 28) Source(172, 62) + SourceIndex(0) +8 >Emitted(112, 34) Source(172, 68) + SourceIndex(0) +9 >Emitted(112, 35) Source(172, 69) + SourceIndex(0) +10>Emitted(112, 36) Source(172, 70) + SourceIndex(0) +11>Emitted(112, 37) Source(172, 71) + SourceIndex(0) +12>Emitted(112, 38) Source(172, 72) + SourceIndex(0) +13>Emitted(112, 39) Source(172, 73) + SourceIndex(0) +14>Emitted(112, 40) Source(172, 74) + SourceIndex(0) --- >>>var c12t9 = [[], []]; -1-> +1 > 2 >^^^^ 3 > ^^^^^ 4 > ^^^ @@ -3016,7 +2897,7 @@ sourceFile:contextualTyping.ts 9 > ^ 10> ^ 11> ^^^^^^-> -1-> +1 > > 2 >var 3 > c12t9 @@ -3027,16 +2908,16 @@ sourceFile:contextualTyping.ts 8 > [] 9 > ] 10> ; -1->Emitted(165, 1) Source(173, 1) + SourceIndex(0) -2 >Emitted(165, 5) Source(173, 5) + SourceIndex(0) -3 >Emitted(165, 10) Source(173, 10) + SourceIndex(0) -4 >Emitted(165, 13) Source(173, 26) + SourceIndex(0) -5 >Emitted(165, 14) Source(173, 27) + SourceIndex(0) -6 >Emitted(165, 16) Source(173, 29) + SourceIndex(0) -7 >Emitted(165, 18) Source(173, 30) + SourceIndex(0) -8 >Emitted(165, 20) Source(173, 32) + SourceIndex(0) -9 >Emitted(165, 21) Source(173, 33) + SourceIndex(0) -10>Emitted(165, 22) Source(173, 34) + SourceIndex(0) +1 >Emitted(113, 1) Source(173, 1) + SourceIndex(0) +2 >Emitted(113, 5) Source(173, 5) + SourceIndex(0) +3 >Emitted(113, 10) Source(173, 10) + SourceIndex(0) +4 >Emitted(113, 13) Source(173, 26) + SourceIndex(0) +5 >Emitted(113, 14) Source(173, 27) + SourceIndex(0) +6 >Emitted(113, 16) Source(173, 29) + SourceIndex(0) +7 >Emitted(113, 18) Source(173, 30) + SourceIndex(0) +8 >Emitted(113, 20) Source(173, 32) + SourceIndex(0) +9 >Emitted(113, 21) Source(173, 33) + SourceIndex(0) +10>Emitted(113, 22) Source(173, 34) + SourceIndex(0) --- >>>var c12t10 = [({}), ({})]; 1-> @@ -3053,7 +2934,7 @@ sourceFile:contextualTyping.ts 12> ^ 13> ^ 14> ^ -15> ^^^^^^-> +15> ^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var @@ -3069,22 +2950,22 @@ sourceFile:contextualTyping.ts 12> ) 13> ] 14> ; -1->Emitted(166, 1) Source(174, 1) + SourceIndex(0) -2 >Emitted(166, 5) Source(174, 5) + SourceIndex(0) -3 >Emitted(166, 11) Source(174, 11) + SourceIndex(0) -4 >Emitted(166, 14) Source(174, 23) + SourceIndex(0) -5 >Emitted(166, 15) Source(174, 30) + SourceIndex(0) -6 >Emitted(166, 16) Source(174, 31) + SourceIndex(0) -7 >Emitted(166, 18) Source(174, 33) + SourceIndex(0) -8 >Emitted(166, 19) Source(174, 34) + SourceIndex(0) -9 >Emitted(166, 21) Source(174, 41) + SourceIndex(0) -10>Emitted(166, 22) Source(174, 42) + SourceIndex(0) -11>Emitted(166, 24) Source(174, 44) + SourceIndex(0) -12>Emitted(166, 25) Source(174, 45) + SourceIndex(0) -13>Emitted(166, 26) Source(174, 46) + SourceIndex(0) -14>Emitted(166, 27) Source(174, 47) + SourceIndex(0) +1->Emitted(114, 1) Source(174, 1) + SourceIndex(0) +2 >Emitted(114, 5) Source(174, 5) + SourceIndex(0) +3 >Emitted(114, 11) Source(174, 11) + SourceIndex(0) +4 >Emitted(114, 14) Source(174, 23) + SourceIndex(0) +5 >Emitted(114, 15) Source(174, 30) + SourceIndex(0) +6 >Emitted(114, 16) Source(174, 31) + SourceIndex(0) +7 >Emitted(114, 18) Source(174, 33) + SourceIndex(0) +8 >Emitted(114, 19) Source(174, 34) + SourceIndex(0) +9 >Emitted(114, 21) Source(174, 41) + SourceIndex(0) +10>Emitted(114, 22) Source(174, 42) + SourceIndex(0) +11>Emitted(114, 24) Source(174, 44) + SourceIndex(0) +12>Emitted(114, 25) Source(174, 45) + SourceIndex(0) +13>Emitted(114, 26) Source(174, 46) + SourceIndex(0) +14>Emitted(114, 27) Source(174, 47) + SourceIndex(0) --- ->>>var c12t11 = [function (n, s) { +>>>var c12t11 = [function (n, s) { return s; }]; 1-> 2 >^^^^ 3 > ^^^^^^ @@ -3094,6 +2975,15 @@ sourceFile:contextualTyping.ts 7 > ^ 8 > ^^ 9 > ^ +10> ^^^^ +11> ^^^^^^ +12> ^ +13> ^ +14> ^ +15> ^ +16> ^ +17> ^ +18> ^ 1-> > 2 >var @@ -3104,63 +2994,49 @@ sourceFile:contextualTyping.ts 7 > n 8 > , 9 > s -1->Emitted(167, 1) Source(175, 1) + SourceIndex(0) -2 >Emitted(167, 5) Source(175, 5) + SourceIndex(0) -3 >Emitted(167, 11) Source(175, 11) + SourceIndex(0) -4 >Emitted(167, 14) Source(175, 52) + SourceIndex(0) -5 >Emitted(167, 15) Source(175, 53) + SourceIndex(0) -6 >Emitted(167, 25) Source(175, 62) + SourceIndex(0) -7 >Emitted(167, 26) Source(175, 63) + SourceIndex(0) -8 >Emitted(167, 28) Source(175, 65) + SourceIndex(0) -9 >Emitted(167, 29) Source(175, 66) + SourceIndex(0) ---- ->>> return s; -1 >^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(168, 5) Source(175, 70) + SourceIndex(0) -2 >Emitted(168, 11) Source(175, 76) + SourceIndex(0) -3 >Emitted(168, 12) Source(175, 77) + SourceIndex(0) -4 >Emitted(168, 13) Source(175, 78) + SourceIndex(0) -5 >Emitted(168, 14) Source(175, 79) + SourceIndex(0) ---- ->>>}]; -1 > -2 >^ -3 > ^ -4 > ^ -5 > ^^^^^^^^^^^^-> -1 > -2 >} -3 > ] -4 > ; -1 >Emitted(169, 1) Source(175, 80) + SourceIndex(0) -2 >Emitted(169, 2) Source(175, 81) + SourceIndex(0) -3 >Emitted(169, 3) Source(175, 82) + SourceIndex(0) -4 >Emitted(169, 4) Source(175, 83) + SourceIndex(0) +10> ) { +11> return +12> +13> s +14> ; +15> +16> } +17> ] +18> ; +1->Emitted(115, 1) Source(175, 1) + SourceIndex(0) +2 >Emitted(115, 5) Source(175, 5) + SourceIndex(0) +3 >Emitted(115, 11) Source(175, 11) + SourceIndex(0) +4 >Emitted(115, 14) Source(175, 52) + SourceIndex(0) +5 >Emitted(115, 15) Source(175, 53) + SourceIndex(0) +6 >Emitted(115, 25) Source(175, 62) + SourceIndex(0) +7 >Emitted(115, 26) Source(175, 63) + SourceIndex(0) +8 >Emitted(115, 28) Source(175, 65) + SourceIndex(0) +9 >Emitted(115, 29) Source(175, 66) + SourceIndex(0) +10>Emitted(115, 33) Source(175, 70) + SourceIndex(0) +11>Emitted(115, 39) Source(175, 76) + SourceIndex(0) +12>Emitted(115, 40) Source(175, 77) + SourceIndex(0) +13>Emitted(115, 41) Source(175, 78) + SourceIndex(0) +14>Emitted(115, 42) Source(175, 79) + SourceIndex(0) +15>Emitted(115, 43) Source(175, 80) + SourceIndex(0) +16>Emitted(115, 44) Source(175, 81) + SourceIndex(0) +17>Emitted(115, 45) Source(175, 82) + SourceIndex(0) +18>Emitted(115, 46) Source(175, 83) + SourceIndex(0) --- >>>var c12t12 = { -1-> +1 > 2 >^^^^ 3 > ^^^^^^ 4 > ^^^ 5 > ^-> -1-> +1 > > 2 >var 3 > c12t12 4 > = -1->Emitted(170, 1) Source(176, 1) + SourceIndex(0) -2 >Emitted(170, 5) Source(176, 5) + SourceIndex(0) -3 >Emitted(170, 11) Source(176, 11) + SourceIndex(0) -4 >Emitted(170, 14) Source(176, 21) + SourceIndex(0) +1 >Emitted(116, 1) Source(176, 1) + SourceIndex(0) +2 >Emitted(116, 5) Source(176, 5) + SourceIndex(0) +3 >Emitted(116, 11) Source(176, 11) + SourceIndex(0) +4 >Emitted(116, 14) Source(176, 21) + SourceIndex(0) --- >>> foo: ({}) 1->^^^^ @@ -3176,12 +3052,12 @@ sourceFile:contextualTyping.ts 4 > ( 5 > {} 6 > ) -1->Emitted(171, 5) Source(177, 5) + SourceIndex(0) -2 >Emitted(171, 8) Source(177, 8) + SourceIndex(0) -3 >Emitted(171, 10) Source(177, 16) + SourceIndex(0) -4 >Emitted(171, 11) Source(177, 17) + SourceIndex(0) -5 >Emitted(171, 13) Source(177, 19) + SourceIndex(0) -6 >Emitted(171, 14) Source(177, 20) + SourceIndex(0) +1->Emitted(117, 5) Source(177, 5) + SourceIndex(0) +2 >Emitted(117, 8) Source(177, 8) + SourceIndex(0) +3 >Emitted(117, 10) Source(177, 16) + SourceIndex(0) +4 >Emitted(117, 11) Source(177, 17) + SourceIndex(0) +5 >Emitted(117, 13) Source(177, 19) + SourceIndex(0) +6 >Emitted(117, 14) Source(177, 20) + SourceIndex(0) --- >>>}; 1 >^ @@ -3190,8 +3066,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > -1 >Emitted(172, 2) Source(178, 2) + SourceIndex(0) -2 >Emitted(172, 3) Source(178, 2) + SourceIndex(0) +1 >Emitted(118, 2) Source(178, 2) + SourceIndex(0) +2 >Emitted(118, 3) Source(178, 2) + SourceIndex(0) --- >>>var c12t13 = ({ 1-> @@ -3199,20 +3075,20 @@ sourceFile:contextualTyping.ts 3 > ^^^^^^ 4 > ^^^ 5 > ^ -6 > ^^^^^^^^^^^-> +6 > ^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > 2 >var 3 > c12t13 4 > = 5 > ( -1->Emitted(173, 1) Source(179, 1) + SourceIndex(0) -2 >Emitted(173, 5) Source(179, 5) + SourceIndex(0) -3 >Emitted(173, 11) Source(179, 11) + SourceIndex(0) -4 >Emitted(173, 14) Source(179, 21) + SourceIndex(0) -5 >Emitted(173, 15) Source(179, 22) + SourceIndex(0) +1->Emitted(119, 1) Source(179, 1) + SourceIndex(0) +2 >Emitted(119, 5) Source(179, 5) + SourceIndex(0) +3 >Emitted(119, 11) Source(179, 11) + SourceIndex(0) +4 >Emitted(119, 14) Source(179, 21) + SourceIndex(0) +5 >Emitted(119, 15) Source(179, 22) + SourceIndex(0) --- ->>> f: function (i, s) { +>>> f: function (i, s) { return s; } 1->^^^^ 2 > ^ 3 > ^^ @@ -3220,6 +3096,13 @@ sourceFile:contextualTyping.ts 5 > ^ 6 > ^^ 7 > ^ +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^ +13> ^ +14> ^ 1->{ > 2 > f @@ -3228,38 +3111,27 @@ sourceFile:contextualTyping.ts 5 > i 6 > , 7 > s -1->Emitted(174, 5) Source(180, 5) + SourceIndex(0) -2 >Emitted(174, 6) Source(180, 6) + SourceIndex(0) -3 >Emitted(174, 8) Source(180, 8) + SourceIndex(0) -4 >Emitted(174, 18) Source(180, 17) + SourceIndex(0) -5 >Emitted(174, 19) Source(180, 18) + SourceIndex(0) -6 >Emitted(174, 21) Source(180, 20) + SourceIndex(0) -7 >Emitted(174, 22) Source(180, 21) + SourceIndex(0) ---- ->>> return s; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^ -1 >) { -2 > return -3 > -4 > s -5 > ; -1 >Emitted(175, 9) Source(180, 25) + SourceIndex(0) -2 >Emitted(175, 15) Source(180, 31) + SourceIndex(0) -3 >Emitted(175, 16) Source(180, 32) + SourceIndex(0) -4 >Emitted(175, 17) Source(180, 33) + SourceIndex(0) -5 >Emitted(175, 18) Source(180, 34) + SourceIndex(0) ---- ->>> } -1 >^^^^ -2 > ^ -1 > -2 > } -1 >Emitted(176, 5) Source(180, 35) + SourceIndex(0) -2 >Emitted(176, 6) Source(180, 36) + SourceIndex(0) +8 > ) { +9 > return +10> +11> s +12> ; +13> +14> } +1->Emitted(120, 5) Source(180, 5) + SourceIndex(0) +2 >Emitted(120, 6) Source(180, 6) + SourceIndex(0) +3 >Emitted(120, 8) Source(180, 8) + SourceIndex(0) +4 >Emitted(120, 18) Source(180, 17) + SourceIndex(0) +5 >Emitted(120, 19) Source(180, 18) + SourceIndex(0) +6 >Emitted(120, 21) Source(180, 20) + SourceIndex(0) +7 >Emitted(120, 22) Source(180, 21) + SourceIndex(0) +8 >Emitted(120, 26) Source(180, 25) + SourceIndex(0) +9 >Emitted(120, 32) Source(180, 31) + SourceIndex(0) +10>Emitted(120, 33) Source(180, 32) + SourceIndex(0) +11>Emitted(120, 34) Source(180, 33) + SourceIndex(0) +12>Emitted(120, 35) Source(180, 34) + SourceIndex(0) +13>Emitted(120, 36) Source(180, 35) + SourceIndex(0) +14>Emitted(120, 37) Source(180, 36) + SourceIndex(0) --- >>>}); 1 >^ @@ -3270,9 +3142,9 @@ sourceFile:contextualTyping.ts >} 2 > ) 3 > -1 >Emitted(177, 2) Source(181, 2) + SourceIndex(0) -2 >Emitted(177, 3) Source(181, 3) + SourceIndex(0) -3 >Emitted(177, 4) Source(181, 3) + SourceIndex(0) +1 >Emitted(121, 2) Source(181, 2) + SourceIndex(0) +2 >Emitted(121, 3) Source(181, 3) + SourceIndex(0) +3 >Emitted(121, 4) Source(181, 3) + SourceIndex(0) --- >>>var c12t14 = ({ 1-> @@ -3286,11 +3158,11 @@ sourceFile:contextualTyping.ts 3 > c12t14 4 > = 5 > ( -1->Emitted(178, 1) Source(182, 1) + SourceIndex(0) -2 >Emitted(178, 5) Source(182, 5) + SourceIndex(0) -3 >Emitted(178, 11) Source(182, 11) + SourceIndex(0) -4 >Emitted(178, 14) Source(182, 21) + SourceIndex(0) -5 >Emitted(178, 15) Source(182, 22) + SourceIndex(0) +1->Emitted(122, 1) Source(182, 1) + SourceIndex(0) +2 >Emitted(122, 5) Source(182, 5) + SourceIndex(0) +3 >Emitted(122, 11) Source(182, 11) + SourceIndex(0) +4 >Emitted(122, 14) Source(182, 21) + SourceIndex(0) +5 >Emitted(122, 15) Source(182, 22) + SourceIndex(0) --- >>> a: [] 1 >^^^^ @@ -3302,25 +3174,25 @@ sourceFile:contextualTyping.ts 2 > a 3 > : 4 > [] -1 >Emitted(179, 5) Source(183, 5) + SourceIndex(0) -2 >Emitted(179, 6) Source(183, 6) + SourceIndex(0) -3 >Emitted(179, 8) Source(183, 8) + SourceIndex(0) -4 >Emitted(179, 10) Source(183, 10) + SourceIndex(0) +1 >Emitted(123, 5) Source(183, 5) + SourceIndex(0) +2 >Emitted(123, 6) Source(183, 6) + SourceIndex(0) +3 >Emitted(123, 8) Source(183, 8) + SourceIndex(0) +4 >Emitted(123, 10) Source(183, 10) + SourceIndex(0) --- >>>}); 1 >^ 2 > ^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^-> +4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > >} 2 > ) 3 > -1 >Emitted(180, 2) Source(184, 2) + SourceIndex(0) -2 >Emitted(180, 3) Source(184, 3) + SourceIndex(0) -3 >Emitted(180, 4) Source(184, 3) + SourceIndex(0) +1 >Emitted(124, 2) Source(184, 2) + SourceIndex(0) +2 >Emitted(124, 3) Source(184, 3) + SourceIndex(0) +3 >Emitted(124, 4) Source(184, 3) + SourceIndex(0) --- ->>>function EF1(a, b) { +>>>function EF1(a, b) { return a + b; } 1-> 2 >^^^^^^^^^ 3 > ^^^ @@ -3328,7 +3200,15 @@ sourceFile:contextualTyping.ts 5 > ^ 6 > ^^ 7 > ^ -8 > ^-> +8 > ^^^^ +9 > ^^^^^^ +10> ^ +11> ^ +12> ^^^ +13> ^ +14> ^ +15> ^ +16> ^ 1-> > >// CONTEXT: Contextual typing declarations @@ -3343,48 +3223,34 @@ sourceFile:contextualTyping.ts 5 > a 6 > , 7 > b -1->Emitted(181, 1) Source(191, 1) + SourceIndex(0) -2 >Emitted(181, 10) Source(191, 10) + SourceIndex(0) -3 >Emitted(181, 13) Source(191, 13) + SourceIndex(0) -4 >Emitted(181, 14) Source(191, 14) + SourceIndex(0) -5 >Emitted(181, 15) Source(191, 15) + SourceIndex(0) -6 >Emitted(181, 17) Source(191, 16) + SourceIndex(0) -7 >Emitted(181, 18) Source(191, 17) + SourceIndex(0) ---- ->>> return a + b; -1->^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^ -5 > ^^^ -6 > ^ -7 > ^ -1->) { -2 > return -3 > -4 > a -5 > + -6 > b -7 > ; -1->Emitted(182, 5) Source(191, 21) + SourceIndex(0) name (EF1) -2 >Emitted(182, 11) Source(191, 27) + SourceIndex(0) name (EF1) -3 >Emitted(182, 12) Source(191, 28) + SourceIndex(0) name (EF1) -4 >Emitted(182, 13) Source(191, 29) + SourceIndex(0) name (EF1) -5 >Emitted(182, 16) Source(191, 30) + SourceIndex(0) name (EF1) -6 >Emitted(182, 17) Source(191, 31) + SourceIndex(0) name (EF1) -7 >Emitted(182, 18) Source(191, 32) + SourceIndex(0) name (EF1) ---- ->>>} -1 > -2 >^ -3 > ^^^^^^^^^^^^^^^^^^^^-> -1 > -2 >} -1 >Emitted(183, 1) Source(191, 33) + SourceIndex(0) name (EF1) -2 >Emitted(183, 2) Source(191, 34) + SourceIndex(0) name (EF1) +8 > ) { +9 > return +10> +11> a +12> + +13> b +14> ; +15> +16> } +1->Emitted(125, 1) Source(191, 1) + SourceIndex(0) +2 >Emitted(125, 10) Source(191, 10) + SourceIndex(0) +3 >Emitted(125, 13) Source(191, 13) + SourceIndex(0) +4 >Emitted(125, 14) Source(191, 14) + SourceIndex(0) +5 >Emitted(125, 15) Source(191, 15) + SourceIndex(0) +6 >Emitted(125, 17) Source(191, 16) + SourceIndex(0) +7 >Emitted(125, 18) Source(191, 17) + SourceIndex(0) +8 >Emitted(125, 22) Source(191, 21) + SourceIndex(0) name (EF1) +9 >Emitted(125, 28) Source(191, 27) + SourceIndex(0) name (EF1) +10>Emitted(125, 29) Source(191, 28) + SourceIndex(0) name (EF1) +11>Emitted(125, 30) Source(191, 29) + SourceIndex(0) name (EF1) +12>Emitted(125, 33) Source(191, 30) + SourceIndex(0) name (EF1) +13>Emitted(125, 34) Source(191, 31) + SourceIndex(0) name (EF1) +14>Emitted(125, 35) Source(191, 32) + SourceIndex(0) name (EF1) +15>Emitted(125, 36) Source(191, 33) + SourceIndex(0) name (EF1) +16>Emitted(125, 37) Source(191, 34) + SourceIndex(0) name (EF1) --- >>>var efv = EF1(1, 2); -1-> +1 > 2 >^^^^ 3 > ^^^ 4 > ^^^ @@ -3396,7 +3262,7 @@ sourceFile:contextualTyping.ts 10> ^ 11> ^ 12> ^^^-> -1-> +1 > > > 2 >var @@ -3409,17 +3275,17 @@ sourceFile:contextualTyping.ts 9 > 2 10> ) 11> ; -1->Emitted(184, 1) Source(193, 1) + SourceIndex(0) -2 >Emitted(184, 5) Source(193, 5) + SourceIndex(0) -3 >Emitted(184, 8) Source(193, 8) + SourceIndex(0) -4 >Emitted(184, 11) Source(193, 11) + SourceIndex(0) -5 >Emitted(184, 14) Source(193, 14) + SourceIndex(0) -6 >Emitted(184, 15) Source(193, 15) + SourceIndex(0) -7 >Emitted(184, 16) Source(193, 16) + SourceIndex(0) -8 >Emitted(184, 18) Source(193, 17) + SourceIndex(0) -9 >Emitted(184, 19) Source(193, 18) + SourceIndex(0) -10>Emitted(184, 20) Source(193, 19) + SourceIndex(0) -11>Emitted(184, 21) Source(193, 20) + SourceIndex(0) +1 >Emitted(126, 1) Source(193, 1) + SourceIndex(0) +2 >Emitted(126, 5) Source(193, 5) + SourceIndex(0) +3 >Emitted(126, 8) Source(193, 8) + SourceIndex(0) +4 >Emitted(126, 11) Source(193, 11) + SourceIndex(0) +5 >Emitted(126, 14) Source(193, 14) + SourceIndex(0) +6 >Emitted(126, 15) Source(193, 15) + SourceIndex(0) +7 >Emitted(126, 16) Source(193, 16) + SourceIndex(0) +8 >Emitted(126, 18) Source(193, 17) + SourceIndex(0) +9 >Emitted(126, 19) Source(193, 18) + SourceIndex(0) +10>Emitted(126, 20) Source(193, 19) + SourceIndex(0) +11>Emitted(126, 21) Source(193, 20) + SourceIndex(0) --- >>>function Point(x, y) { 1-> @@ -3450,13 +3316,13 @@ sourceFile:contextualTyping.ts 5 > x 6 > , 7 > y -1->Emitted(185, 1) Source(207, 1) + SourceIndex(0) -2 >Emitted(185, 10) Source(207, 10) + SourceIndex(0) -3 >Emitted(185, 15) Source(207, 15) + SourceIndex(0) -4 >Emitted(185, 16) Source(207, 16) + SourceIndex(0) -5 >Emitted(185, 17) Source(207, 17) + SourceIndex(0) -6 >Emitted(185, 19) Source(207, 19) + SourceIndex(0) -7 >Emitted(185, 20) Source(207, 20) + SourceIndex(0) +1->Emitted(127, 1) Source(207, 1) + SourceIndex(0) +2 >Emitted(127, 10) Source(207, 10) + SourceIndex(0) +3 >Emitted(127, 15) Source(207, 15) + SourceIndex(0) +4 >Emitted(127, 16) Source(207, 16) + SourceIndex(0) +5 >Emitted(127, 17) Source(207, 17) + SourceIndex(0) +6 >Emitted(127, 19) Source(207, 19) + SourceIndex(0) +7 >Emitted(127, 20) Source(207, 20) + SourceIndex(0) --- >>> this.x = x; 1 >^^^^ @@ -3475,13 +3341,13 @@ sourceFile:contextualTyping.ts 5 > = 6 > x 7 > ; -1 >Emitted(186, 5) Source(208, 5) + SourceIndex(0) name (Point) -2 >Emitted(186, 9) Source(208, 9) + SourceIndex(0) name (Point) -3 >Emitted(186, 10) Source(208, 10) + SourceIndex(0) name (Point) -4 >Emitted(186, 11) Source(208, 11) + SourceIndex(0) name (Point) -5 >Emitted(186, 14) Source(208, 14) + SourceIndex(0) name (Point) -6 >Emitted(186, 15) Source(208, 15) + SourceIndex(0) name (Point) -7 >Emitted(186, 16) Source(208, 16) + SourceIndex(0) name (Point) +1 >Emitted(128, 5) Source(208, 5) + SourceIndex(0) name (Point) +2 >Emitted(128, 9) Source(208, 9) + SourceIndex(0) name (Point) +3 >Emitted(128, 10) Source(208, 10) + SourceIndex(0) name (Point) +4 >Emitted(128, 11) Source(208, 11) + SourceIndex(0) name (Point) +5 >Emitted(128, 14) Source(208, 14) + SourceIndex(0) name (Point) +6 >Emitted(128, 15) Source(208, 15) + SourceIndex(0) name (Point) +7 >Emitted(128, 16) Source(208, 16) + SourceIndex(0) name (Point) --- >>> this.y = y; 1->^^^^ @@ -3500,13 +3366,13 @@ sourceFile:contextualTyping.ts 5 > = 6 > y 7 > ; -1->Emitted(187, 5) Source(209, 5) + SourceIndex(0) name (Point) -2 >Emitted(187, 9) Source(209, 9) + SourceIndex(0) name (Point) -3 >Emitted(187, 10) Source(209, 10) + SourceIndex(0) name (Point) -4 >Emitted(187, 11) Source(209, 11) + SourceIndex(0) name (Point) -5 >Emitted(187, 14) Source(209, 14) + SourceIndex(0) name (Point) -6 >Emitted(187, 15) Source(209, 15) + SourceIndex(0) name (Point) -7 >Emitted(187, 16) Source(209, 16) + SourceIndex(0) name (Point) +1->Emitted(129, 5) Source(209, 5) + SourceIndex(0) name (Point) +2 >Emitted(129, 9) Source(209, 9) + SourceIndex(0) name (Point) +3 >Emitted(129, 10) Source(209, 10) + SourceIndex(0) name (Point) +4 >Emitted(129, 11) Source(209, 11) + SourceIndex(0) name (Point) +5 >Emitted(129, 14) Source(209, 14) + SourceIndex(0) name (Point) +6 >Emitted(129, 15) Source(209, 15) + SourceIndex(0) name (Point) +7 >Emitted(129, 16) Source(209, 16) + SourceIndex(0) name (Point) --- >>> return this; 1->^^^^ @@ -3521,11 +3387,11 @@ sourceFile:contextualTyping.ts 3 > 4 > this 5 > ; -1->Emitted(188, 5) Source(211, 5) + SourceIndex(0) name (Point) -2 >Emitted(188, 11) Source(211, 11) + SourceIndex(0) name (Point) -3 >Emitted(188, 12) Source(211, 12) + SourceIndex(0) name (Point) -4 >Emitted(188, 16) Source(211, 16) + SourceIndex(0) name (Point) -5 >Emitted(188, 17) Source(211, 17) + SourceIndex(0) name (Point) +1->Emitted(130, 5) Source(211, 5) + SourceIndex(0) name (Point) +2 >Emitted(130, 11) Source(211, 11) + SourceIndex(0) name (Point) +3 >Emitted(130, 12) Source(211, 12) + SourceIndex(0) name (Point) +4 >Emitted(130, 16) Source(211, 16) + SourceIndex(0) name (Point) +5 >Emitted(130, 17) Source(211, 17) + SourceIndex(0) name (Point) --- >>>} 1 > @@ -3534,8 +3400,8 @@ sourceFile:contextualTyping.ts 1 > > 2 >} -1 >Emitted(189, 1) Source(212, 1) + SourceIndex(0) name (Point) -2 >Emitted(189, 2) Source(212, 2) + SourceIndex(0) name (Point) +1 >Emitted(131, 1) Source(212, 1) + SourceIndex(0) name (Point) +2 >Emitted(131, 2) Source(212, 2) + SourceIndex(0) name (Point) --- >>>Point.origin = new Point(0, 0); 1-> @@ -3567,19 +3433,19 @@ sourceFile:contextualTyping.ts 11> 0 12> ) 13> ; -1->Emitted(190, 1) Source(214, 1) + SourceIndex(0) -2 >Emitted(190, 6) Source(214, 6) + SourceIndex(0) -3 >Emitted(190, 7) Source(214, 7) + SourceIndex(0) -4 >Emitted(190, 13) Source(214, 13) + SourceIndex(0) -5 >Emitted(190, 16) Source(214, 16) + SourceIndex(0) -6 >Emitted(190, 20) Source(214, 20) + SourceIndex(0) -7 >Emitted(190, 25) Source(214, 25) + SourceIndex(0) -8 >Emitted(190, 26) Source(214, 26) + SourceIndex(0) -9 >Emitted(190, 27) Source(214, 27) + SourceIndex(0) -10>Emitted(190, 29) Source(214, 29) + SourceIndex(0) -11>Emitted(190, 30) Source(214, 30) + SourceIndex(0) -12>Emitted(190, 31) Source(214, 31) + SourceIndex(0) -13>Emitted(190, 32) Source(214, 32) + SourceIndex(0) +1->Emitted(132, 1) Source(214, 1) + SourceIndex(0) +2 >Emitted(132, 6) Source(214, 6) + SourceIndex(0) +3 >Emitted(132, 7) Source(214, 7) + SourceIndex(0) +4 >Emitted(132, 13) Source(214, 13) + SourceIndex(0) +5 >Emitted(132, 16) Source(214, 16) + SourceIndex(0) +6 >Emitted(132, 20) Source(214, 20) + SourceIndex(0) +7 >Emitted(132, 25) Source(214, 25) + SourceIndex(0) +8 >Emitted(132, 26) Source(214, 26) + SourceIndex(0) +9 >Emitted(132, 27) Source(214, 27) + SourceIndex(0) +10>Emitted(132, 29) Source(214, 29) + SourceIndex(0) +11>Emitted(132, 30) Source(214, 30) + SourceIndex(0) +12>Emitted(132, 31) Source(214, 31) + SourceIndex(0) +13>Emitted(132, 32) Source(214, 32) + SourceIndex(0) --- >>>Point.prototype.add = function (dx, dy) { 1-> @@ -3607,17 +3473,17 @@ sourceFile:contextualTyping.ts 9 > dx 10> , 11> dy -1->Emitted(191, 1) Source(216, 1) + SourceIndex(0) -2 >Emitted(191, 6) Source(216, 6) + SourceIndex(0) -3 >Emitted(191, 7) Source(216, 7) + SourceIndex(0) -4 >Emitted(191, 16) Source(216, 16) + SourceIndex(0) -5 >Emitted(191, 17) Source(216, 17) + SourceIndex(0) -6 >Emitted(191, 20) Source(216, 20) + SourceIndex(0) -7 >Emitted(191, 23) Source(216, 23) + SourceIndex(0) -8 >Emitted(191, 33) Source(216, 32) + SourceIndex(0) -9 >Emitted(191, 35) Source(216, 34) + SourceIndex(0) -10>Emitted(191, 37) Source(216, 36) + SourceIndex(0) -11>Emitted(191, 39) Source(216, 38) + SourceIndex(0) +1->Emitted(133, 1) Source(216, 1) + SourceIndex(0) +2 >Emitted(133, 6) Source(216, 6) + SourceIndex(0) +3 >Emitted(133, 7) Source(216, 7) + SourceIndex(0) +4 >Emitted(133, 16) Source(216, 16) + SourceIndex(0) +5 >Emitted(133, 17) Source(216, 17) + SourceIndex(0) +6 >Emitted(133, 20) Source(216, 20) + SourceIndex(0) +7 >Emitted(133, 23) Source(216, 23) + SourceIndex(0) +8 >Emitted(133, 33) Source(216, 32) + SourceIndex(0) +9 >Emitted(133, 35) Source(216, 34) + SourceIndex(0) +10>Emitted(133, 37) Source(216, 36) + SourceIndex(0) +11>Emitted(133, 39) Source(216, 38) + SourceIndex(0) --- >>> return new Point(this.x + dx, this.y + dy); 1->^^^^ @@ -3659,25 +3525,25 @@ sourceFile:contextualTyping.ts 17> dy 18> ) 19> ; -1->Emitted(192, 5) Source(217, 5) + SourceIndex(0) -2 >Emitted(192, 11) Source(217, 11) + SourceIndex(0) -3 >Emitted(192, 12) Source(217, 12) + SourceIndex(0) -4 >Emitted(192, 16) Source(217, 16) + SourceIndex(0) -5 >Emitted(192, 21) Source(217, 21) + SourceIndex(0) -6 >Emitted(192, 22) Source(217, 22) + SourceIndex(0) -7 >Emitted(192, 26) Source(217, 26) + SourceIndex(0) -8 >Emitted(192, 27) Source(217, 27) + SourceIndex(0) -9 >Emitted(192, 28) Source(217, 28) + SourceIndex(0) -10>Emitted(192, 31) Source(217, 31) + SourceIndex(0) -11>Emitted(192, 33) Source(217, 33) + SourceIndex(0) -12>Emitted(192, 35) Source(217, 35) + SourceIndex(0) -13>Emitted(192, 39) Source(217, 39) + SourceIndex(0) -14>Emitted(192, 40) Source(217, 40) + SourceIndex(0) -15>Emitted(192, 41) Source(217, 41) + SourceIndex(0) -16>Emitted(192, 44) Source(217, 44) + SourceIndex(0) -17>Emitted(192, 46) Source(217, 46) + SourceIndex(0) -18>Emitted(192, 47) Source(217, 47) + SourceIndex(0) -19>Emitted(192, 48) Source(217, 48) + SourceIndex(0) +1->Emitted(134, 5) Source(217, 5) + SourceIndex(0) +2 >Emitted(134, 11) Source(217, 11) + SourceIndex(0) +3 >Emitted(134, 12) Source(217, 12) + SourceIndex(0) +4 >Emitted(134, 16) Source(217, 16) + SourceIndex(0) +5 >Emitted(134, 21) Source(217, 21) + SourceIndex(0) +6 >Emitted(134, 22) Source(217, 22) + SourceIndex(0) +7 >Emitted(134, 26) Source(217, 26) + SourceIndex(0) +8 >Emitted(134, 27) Source(217, 27) + SourceIndex(0) +9 >Emitted(134, 28) Source(217, 28) + SourceIndex(0) +10>Emitted(134, 31) Source(217, 31) + SourceIndex(0) +11>Emitted(134, 33) Source(217, 33) + SourceIndex(0) +12>Emitted(134, 35) Source(217, 35) + SourceIndex(0) +13>Emitted(134, 39) Source(217, 39) + SourceIndex(0) +14>Emitted(134, 40) Source(217, 40) + SourceIndex(0) +15>Emitted(134, 41) Source(217, 41) + SourceIndex(0) +16>Emitted(134, 44) Source(217, 44) + SourceIndex(0) +17>Emitted(134, 46) Source(217, 46) + SourceIndex(0) +18>Emitted(134, 47) Source(217, 47) + SourceIndex(0) +19>Emitted(134, 48) Source(217, 48) + SourceIndex(0) --- >>>}; 1 > @@ -3688,9 +3554,9 @@ sourceFile:contextualTyping.ts > 2 >} 3 > ; -1 >Emitted(193, 1) Source(218, 1) + SourceIndex(0) -2 >Emitted(193, 2) Source(218, 2) + SourceIndex(0) -3 >Emitted(193, 3) Source(218, 3) + SourceIndex(0) +1 >Emitted(135, 1) Source(218, 1) + SourceIndex(0) +2 >Emitted(135, 2) Source(218, 2) + SourceIndex(0) +3 >Emitted(135, 3) Source(218, 3) + SourceIndex(0) --- >>>Point.prototype = { 1-> @@ -3705,11 +3571,11 @@ sourceFile:contextualTyping.ts 3 > . 4 > prototype 5 > = -1->Emitted(194, 1) Source(220, 1) + SourceIndex(0) -2 >Emitted(194, 6) Source(220, 6) + SourceIndex(0) -3 >Emitted(194, 7) Source(220, 7) + SourceIndex(0) -4 >Emitted(194, 16) Source(220, 16) + SourceIndex(0) -5 >Emitted(194, 19) Source(220, 19) + SourceIndex(0) +1->Emitted(136, 1) Source(220, 1) + SourceIndex(0) +2 >Emitted(136, 6) Source(220, 6) + SourceIndex(0) +3 >Emitted(136, 7) Source(220, 7) + SourceIndex(0) +4 >Emitted(136, 16) Source(220, 16) + SourceIndex(0) +5 >Emitted(136, 19) Source(220, 19) + SourceIndex(0) --- >>> x: 0, 1 >^^^^ @@ -3722,10 +3588,10 @@ sourceFile:contextualTyping.ts 2 > x 3 > : 4 > 0 -1 >Emitted(195, 5) Source(221, 5) + SourceIndex(0) -2 >Emitted(195, 6) Source(221, 6) + SourceIndex(0) -3 >Emitted(195, 8) Source(221, 8) + SourceIndex(0) -4 >Emitted(195, 9) Source(221, 9) + SourceIndex(0) +1 >Emitted(137, 5) Source(221, 5) + SourceIndex(0) +2 >Emitted(137, 6) Source(221, 6) + SourceIndex(0) +3 >Emitted(137, 8) Source(221, 8) + SourceIndex(0) +4 >Emitted(137, 9) Source(221, 9) + SourceIndex(0) --- >>> y: 0, 1->^^^^ @@ -3738,10 +3604,10 @@ sourceFile:contextualTyping.ts 2 > y 3 > : 4 > 0 -1->Emitted(196, 5) Source(222, 5) + SourceIndex(0) -2 >Emitted(196, 6) Source(222, 6) + SourceIndex(0) -3 >Emitted(196, 8) Source(222, 8) + SourceIndex(0) -4 >Emitted(196, 9) Source(222, 9) + SourceIndex(0) +1->Emitted(138, 5) Source(222, 5) + SourceIndex(0) +2 >Emitted(138, 6) Source(222, 6) + SourceIndex(0) +3 >Emitted(138, 8) Source(222, 8) + SourceIndex(0) +4 >Emitted(138, 9) Source(222, 9) + SourceIndex(0) --- >>> add: function (dx, dy) { 1->^^^^ @@ -3760,13 +3626,13 @@ sourceFile:contextualTyping.ts 5 > dx 6 > , 7 > dy -1->Emitted(197, 5) Source(223, 5) + SourceIndex(0) -2 >Emitted(197, 8) Source(223, 8) + SourceIndex(0) -3 >Emitted(197, 10) Source(223, 10) + SourceIndex(0) -4 >Emitted(197, 20) Source(223, 19) + SourceIndex(0) -5 >Emitted(197, 22) Source(223, 21) + SourceIndex(0) -6 >Emitted(197, 24) Source(223, 23) + SourceIndex(0) -7 >Emitted(197, 26) Source(223, 25) + SourceIndex(0) +1->Emitted(139, 5) Source(223, 5) + SourceIndex(0) +2 >Emitted(139, 8) Source(223, 8) + SourceIndex(0) +3 >Emitted(139, 10) Source(223, 10) + SourceIndex(0) +4 >Emitted(139, 20) Source(223, 19) + SourceIndex(0) +5 >Emitted(139, 22) Source(223, 21) + SourceIndex(0) +6 >Emitted(139, 24) Source(223, 23) + SourceIndex(0) +7 >Emitted(139, 26) Source(223, 25) + SourceIndex(0) --- >>> return new Point(this.x + dx, this.y + dy); 1->^^^^^^^^ @@ -3808,25 +3674,25 @@ sourceFile:contextualTyping.ts 17> dy 18> ) 19> ; -1->Emitted(198, 9) Source(224, 9) + SourceIndex(0) -2 >Emitted(198, 15) Source(224, 15) + SourceIndex(0) -3 >Emitted(198, 16) Source(224, 16) + SourceIndex(0) -4 >Emitted(198, 20) Source(224, 20) + SourceIndex(0) -5 >Emitted(198, 25) Source(224, 25) + SourceIndex(0) -6 >Emitted(198, 26) Source(224, 26) + SourceIndex(0) -7 >Emitted(198, 30) Source(224, 30) + SourceIndex(0) -8 >Emitted(198, 31) Source(224, 31) + SourceIndex(0) -9 >Emitted(198, 32) Source(224, 32) + SourceIndex(0) -10>Emitted(198, 35) Source(224, 35) + SourceIndex(0) -11>Emitted(198, 37) Source(224, 37) + SourceIndex(0) -12>Emitted(198, 39) Source(224, 39) + SourceIndex(0) -13>Emitted(198, 43) Source(224, 43) + SourceIndex(0) -14>Emitted(198, 44) Source(224, 44) + SourceIndex(0) -15>Emitted(198, 45) Source(224, 45) + SourceIndex(0) -16>Emitted(198, 48) Source(224, 48) + SourceIndex(0) -17>Emitted(198, 50) Source(224, 50) + SourceIndex(0) -18>Emitted(198, 51) Source(224, 51) + SourceIndex(0) -19>Emitted(198, 52) Source(224, 52) + SourceIndex(0) +1->Emitted(140, 9) Source(224, 9) + SourceIndex(0) +2 >Emitted(140, 15) Source(224, 15) + SourceIndex(0) +3 >Emitted(140, 16) Source(224, 16) + SourceIndex(0) +4 >Emitted(140, 20) Source(224, 20) + SourceIndex(0) +5 >Emitted(140, 25) Source(224, 25) + SourceIndex(0) +6 >Emitted(140, 26) Source(224, 26) + SourceIndex(0) +7 >Emitted(140, 30) Source(224, 30) + SourceIndex(0) +8 >Emitted(140, 31) Source(224, 31) + SourceIndex(0) +9 >Emitted(140, 32) Source(224, 32) + SourceIndex(0) +10>Emitted(140, 35) Source(224, 35) + SourceIndex(0) +11>Emitted(140, 37) Source(224, 37) + SourceIndex(0) +12>Emitted(140, 39) Source(224, 39) + SourceIndex(0) +13>Emitted(140, 43) Source(224, 43) + SourceIndex(0) +14>Emitted(140, 44) Source(224, 44) + SourceIndex(0) +15>Emitted(140, 45) Source(224, 45) + SourceIndex(0) +16>Emitted(140, 48) Source(224, 48) + SourceIndex(0) +17>Emitted(140, 50) Source(224, 50) + SourceIndex(0) +18>Emitted(140, 51) Source(224, 51) + SourceIndex(0) +19>Emitted(140, 52) Source(224, 52) + SourceIndex(0) --- >>> } 1 >^^^^ @@ -3834,8 +3700,8 @@ sourceFile:contextualTyping.ts 1 > > 2 > } -1 >Emitted(199, 5) Source(225, 5) + SourceIndex(0) -2 >Emitted(199, 6) Source(225, 6) + SourceIndex(0) +1 >Emitted(141, 5) Source(225, 5) + SourceIndex(0) +2 >Emitted(141, 6) Source(225, 6) + SourceIndex(0) --- >>>}; 1 >^ @@ -3844,8 +3710,8 @@ sourceFile:contextualTyping.ts 1 > >} 2 > ; -1 >Emitted(200, 2) Source(226, 2) + SourceIndex(0) -2 >Emitted(200, 3) Source(226, 3) + SourceIndex(0) +1 >Emitted(142, 2) Source(226, 2) + SourceIndex(0) +2 >Emitted(142, 3) Source(226, 3) + SourceIndex(0) --- >>>var x = {}; 1-> @@ -3865,11 +3731,11 @@ sourceFile:contextualTyping.ts 4 > : B = 5 > { } 6 > ; -1->Emitted(201, 1) Source(230, 1) + SourceIndex(0) -2 >Emitted(201, 5) Source(230, 5) + SourceIndex(0) -3 >Emitted(201, 6) Source(230, 6) + SourceIndex(0) -4 >Emitted(201, 9) Source(230, 12) + SourceIndex(0) -5 >Emitted(201, 11) Source(230, 15) + SourceIndex(0) -6 >Emitted(201, 12) Source(230, 16) + SourceIndex(0) +1->Emitted(143, 1) Source(230, 1) + SourceIndex(0) +2 >Emitted(143, 5) Source(230, 5) + SourceIndex(0) +3 >Emitted(143, 6) Source(230, 6) + SourceIndex(0) +4 >Emitted(143, 9) Source(230, 12) + SourceIndex(0) +5 >Emitted(143, 11) Source(230, 15) + SourceIndex(0) +6 >Emitted(143, 12) Source(230, 16) + SourceIndex(0) --- >>>//# sourceMappingURL=contextualTyping.js.map \ No newline at end of file diff --git a/tests/baselines/reference/contextualTyping13.js b/tests/baselines/reference/contextualTyping13.js index c035434342e..7965745b943 100644 --- a/tests/baselines/reference/contextualTyping13.js +++ b/tests/baselines/reference/contextualTyping13.js @@ -2,6 +2,4 @@ var foo:(a:number)=>number = function(a){return a}; //// [contextualTyping13.js] -var foo = function (a) { - return a; -}; +var foo = function (a) { return a; }; diff --git a/tests/baselines/reference/contextualTyping14.js b/tests/baselines/reference/contextualTyping14.js index ea9539ef41e..5bae8c948a2 100644 --- a/tests/baselines/reference/contextualTyping14.js +++ b/tests/baselines/reference/contextualTyping14.js @@ -4,9 +4,7 @@ class foo { public bar:(a:number)=>number = function(a){return a}; } //// [contextualTyping14.js] var foo = (function () { function foo() { - this.bar = function (a) { - return a; - }; + this.bar = function (a) { return a; }; } return foo; })(); diff --git a/tests/baselines/reference/contextualTyping15.js b/tests/baselines/reference/contextualTyping15.js index 99855681571..250076ec4d5 100644 --- a/tests/baselines/reference/contextualTyping15.js +++ b/tests/baselines/reference/contextualTyping15.js @@ -4,9 +4,7 @@ class foo { public bar: { (): number; (i: number): number; } = function() { retu //// [contextualTyping15.js] var foo = (function () { function foo() { - this.bar = function () { - return 1; - }; + this.bar = function () { return 1; }; } return foo; })(); diff --git a/tests/baselines/reference/contextualTyping22.js b/tests/baselines/reference/contextualTyping22.js index b8ebfd3ecb7..3c9a5cb4d3e 100644 --- a/tests/baselines/reference/contextualTyping22.js +++ b/tests/baselines/reference/contextualTyping22.js @@ -2,9 +2,5 @@ var foo:(a:number)=>number = function(a){return a}; foo = function(b){return b}; //// [contextualTyping22.js] -var foo = function (a) { - return a; -}; -foo = function (b) { - return b; -}; +var foo = function (a) { return a; }; +foo = function (b) { return b; }; diff --git a/tests/baselines/reference/contextualTyping23.js b/tests/baselines/reference/contextualTyping23.js index 187fd3f86d3..0207f6af15d 100644 --- a/tests/baselines/reference/contextualTyping23.js +++ b/tests/baselines/reference/contextualTyping23.js @@ -3,6 +3,4 @@ var foo:(a:{():number; (i:number):number; })=>number; foo = function(a){return 5 //// [contextualTyping23.js] var foo; -foo = function (a) { - return 5; -}; +foo = function (a) { return 5; }; diff --git a/tests/baselines/reference/contextualTyping24.js b/tests/baselines/reference/contextualTyping24.js index 170a6983b9f..04c4ecba21b 100644 --- a/tests/baselines/reference/contextualTyping24.js +++ b/tests/baselines/reference/contextualTyping24.js @@ -3,6 +3,4 @@ var foo:(a:{():number; (i:number):number; })=>number; foo = function(a:string){r //// [contextualTyping24.js] var foo; -foo = function (a) { - return 5; -}; +foo = function (a) { return 5; }; diff --git a/tests/baselines/reference/contextualTyping32.js b/tests/baselines/reference/contextualTyping32.js index 992724d4130..bbbafa70796 100644 --- a/tests/baselines/reference/contextualTyping32.js +++ b/tests/baselines/reference/contextualTyping32.js @@ -4,8 +4,4 @@ function foo(param: {():number; (i:number):number; }[]) { }; foo([function(){ret //// [contextualTyping32.js] function foo(param) { } ; -foo([function () { - return 1; -}, function () { - return 4; -}]); +foo([function () { return 1; }, function () { return 4; }]); diff --git a/tests/baselines/reference/contextualTyping33.js b/tests/baselines/reference/contextualTyping33.js index 0ca0c965b8b..1d800b1d113 100644 --- a/tests/baselines/reference/contextualTyping33.js +++ b/tests/baselines/reference/contextualTyping33.js @@ -4,8 +4,4 @@ function foo(param: {():number; (i:number):number; }[]) { }; foo([function(){ret //// [contextualTyping33.js] function foo(param) { } ; -foo([function () { - return 1; -}, function () { - return "foo"; -}]); +foo([function () { return 1; }, function () { return "foo"; }]); diff --git a/tests/baselines/reference/contextualTyping38.js b/tests/baselines/reference/contextualTyping38.js index 71ed8ece57d..9bed543ff7f 100644 --- a/tests/baselines/reference/contextualTyping38.js +++ b/tests/baselines/reference/contextualTyping38.js @@ -2,6 +2,4 @@ var foo = <{ (): number; }> function(a) { return a }; //// [contextualTyping38.js] -var foo = function (a) { - return a; -}; +var foo = function (a) { return a; }; diff --git a/tests/baselines/reference/contextualTyping39.js b/tests/baselines/reference/contextualTyping39.js index 9a97b7eb3cc..89d045830a3 100644 --- a/tests/baselines/reference/contextualTyping39.js +++ b/tests/baselines/reference/contextualTyping39.js @@ -2,6 +2,4 @@ var foo = <{ (): number; }> function() { return "err"; }; //// [contextualTyping39.js] -var foo = function () { - return "err"; -}; +var foo = function () { return "err"; }; diff --git a/tests/baselines/reference/contextualTyping40.js b/tests/baselines/reference/contextualTyping40.js index ba2c447b10f..0b98f8e45c6 100644 --- a/tests/baselines/reference/contextualTyping40.js +++ b/tests/baselines/reference/contextualTyping40.js @@ -2,6 +2,4 @@ var foo = <{():number; (i:number):number; }> function(){return 1;}; //// [contextualTyping40.js] -var foo = function () { - return 1; -}; +var foo = function () { return 1; }; diff --git a/tests/baselines/reference/contextualTyping41.js b/tests/baselines/reference/contextualTyping41.js index 720f1d178f6..8bce7918dd2 100644 --- a/tests/baselines/reference/contextualTyping41.js +++ b/tests/baselines/reference/contextualTyping41.js @@ -2,6 +2,4 @@ var foo = <{():number; (i:number):number; }> (function(){return "err";}); //// [contextualTyping41.js] -var foo = (function () { - return "err"; -}); +var foo = (function () { return "err"; }); diff --git a/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.js b/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.js index b2a8bf0dba1..8142b51dcdd 100644 --- a/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.js +++ b/tests/baselines/reference/contextualTypingOfGenericFunctionTypedArguments1.js @@ -22,10 +22,6 @@ var r6 = _.forEach(c2, (x) => { return x.toFixed() }); var c2; var _; // errors on all 3 lines, bug was that r5 was the only line with errors -var f = function (x) { - return x.toFixed(); -}; +var f = function (x) { return x.toFixed(); }; var r5 = _.forEach(c2, f); -var r6 = _.forEach(c2, function (x) { - return x.toFixed(); -}); +var r6 = _.forEach(c2, function (x) { return x.toFixed(); }); diff --git a/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.js b/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.js index 220e06da59d..67670bf872e 100644 --- a/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.js +++ b/tests/baselines/reference/contextualTypingOfLambdaReturnExpression.js @@ -9,6 +9,4 @@ callb((a) => { a.length; }); // Error, we picked the first overload and errored //// [contextualTypingOfLambdaReturnExpression.js] function callb(a) { } callb(function (a) { return a.length; }); // Ok, we choose the second overload because the first one gave us an error when trying to resolve the lambda return type -callb(function (a) { - a.length; -}); // Error, we picked the first overload and errored when type checking the lambda body +callb(function (a) { a.length; }); // Error, we picked the first overload and errored when type checking the lambda body diff --git a/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.js b/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.js index 415fc3acd2e..442ded4ba75 100644 --- a/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.js +++ b/tests/baselines/reference/contextualTypingOfLambdaWithMultipleSignatures2.js @@ -8,6 +8,4 @@ f = (a) => { return a.asdf } //// [contextualTypingOfLambdaWithMultipleSignatures2.js] var f; -f = function (a) { - return a.asdf; -}; +f = function (a) { return a.asdf; }; diff --git a/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.js b/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.js index f548b6daaad..5ee0c758022 100644 --- a/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.js +++ b/tests/baselines/reference/contextualTypingWithGenericAndNonGenericSignature.js @@ -19,10 +19,6 @@ f3 = (x, y) => { return x } //// [contextualTypingWithGenericAndNonGenericSignature.js] //• If e is a FunctionExpression or ArrowFunctionExpression with no type parameters and no parameter or return type annotations, and T is a function type with EXACTLY ONE non - generic call signature, then any inferences made for type parameters referenced by the parameters of T’s call signature are fixed(section 4.12.2) and e is processed with the contextual type T, as described in section 4.9.3. var f2; -f2 = function (x, y) { - return x; -}; +f2 = function (x, y) { return x; }; var f3; -f3 = function (x, y) { - return x; -}; +f3 = function (x, y) { return x; }; diff --git a/tests/baselines/reference/contextualTypingWithGenericSignature.js b/tests/baselines/reference/contextualTypingWithGenericSignature.js index a1417e90b43..611a35f38ac 100644 --- a/tests/baselines/reference/contextualTypingWithGenericSignature.js +++ b/tests/baselines/reference/contextualTypingWithGenericSignature.js @@ -10,6 +10,4 @@ f2 = (x, y) => { return x } //// [contextualTypingWithGenericSignature.js] // If e is a FunctionExpression or ArrowFunctionExpression with no type parameters and no parameter or return type annotations, and T is a function type with EXACTLY ONE non - generic call signature, then any inferences made for type parameters referenced by the parameters of T’s call signature are fixed(section 4.12.2) and e is processed with the contextual type T, as described in section 4.9.3. var f2; -f2 = function (x, y) { - return x; -}; +f2 = function (x, y) { return x; }; diff --git a/tests/baselines/reference/contextuallyTypingOrOperator.js b/tests/baselines/reference/contextuallyTypingOrOperator.js index 8d7babbbe6b..6dc3e09bf89 100644 --- a/tests/baselines/reference/contextuallyTypingOrOperator.js +++ b/tests/baselines/reference/contextuallyTypingOrOperator.js @@ -8,12 +8,6 @@ var v4 = (s: number) => 1 || function (s: string) { return s.length }; //// [contextuallyTypingOrOperator.js] var v = { a: function (s) { return s.length; } } || { a: function (s) { return 1; } }; -var v2 = function (s) { return s.length || function (s) { - s.length; -}; }; -var v3 = function (s) { return s.length || function (s) { - return 1; -}; }; -var v4 = function (s) { return 1 || function (s) { - return s.length; -}; }; +var v2 = function (s) { return s.length || function (s) { s.length; }; }; +var v3 = function (s) { return s.length || function (s) { return 1; }; }; +var v4 = function (s) { return 1 || function (s) { return s.length; }; }; diff --git a/tests/baselines/reference/contextuallyTypingOrOperator2.js b/tests/baselines/reference/contextuallyTypingOrOperator2.js index 9aa2c778345..fa850929b3e 100644 --- a/tests/baselines/reference/contextuallyTypingOrOperator2.js +++ b/tests/baselines/reference/contextuallyTypingOrOperator2.js @@ -5,6 +5,4 @@ var v2 = (s: string) => s.length || function (s) { s.aaa }; //// [contextuallyTypingOrOperator2.js] var v = { a: function (s) { return s.length; } } || { a: function (s) { return 1; } }; -var v2 = function (s) { return s.length || function (s) { - s.aaa; -}; }; +var v2 = function (s) { return s.length || function (s) { s.aaa; }; }; diff --git a/tests/baselines/reference/couldNotSelectGenericOverload.js b/tests/baselines/reference/couldNotSelectGenericOverload.js index 45ce1c42274..996ebde8448 100644 --- a/tests/baselines/reference/couldNotSelectGenericOverload.js +++ b/tests/baselines/reference/couldNotSelectGenericOverload.js @@ -9,13 +9,9 @@ var b3G = makeArray2(1, ""); // error //// [couldNotSelectGenericOverload.js] -function makeArray(items) { - return items; -} +function makeArray(items) { return items; } var b = [1, ""]; var b1G = makeArray(1, ""); // any, no error var b2G = makeArray(b); // any[] -function makeArray2(items) { - return items; -} +function makeArray2(items) { return items; } var b3G = makeArray2(1, ""); // error diff --git a/tests/baselines/reference/debuggerEmit.js b/tests/baselines/reference/debuggerEmit.js index c2f730271be..8cf5dc69cd0 100644 --- a/tests/baselines/reference/debuggerEmit.js +++ b/tests/baselines/reference/debuggerEmit.js @@ -3,7 +3,5 @@ var x = function () { debugger; } x(); //// [debuggerEmit.js] -var x = function () { - debugger; -}; +var x = function () { debugger; }; x(); diff --git a/tests/baselines/reference/declFileGenericType.js b/tests/baselines/reference/declFileGenericType.js index d6d63e3443a..e01626a7ead 100644 --- a/tests/baselines/reference/declFileGenericType.js +++ b/tests/baselines/reference/declFileGenericType.js @@ -60,29 +60,17 @@ var C; return B; })(); C.B = B; - function F(x) { - return null; - } + function F(x) { return null; } C.F = F; - function F2(x) { - return null; - } + function F2(x) { return null; } C.F2 = F2; - function F3(x) { - return null; - } + function F3(x) { return null; } C.F3 = F3; - function F4(x) { - return null; - } + function F4(x) { return null; } C.F4 = F4; - function F5() { - return null; - } + function F5() { return null; } C.F5 = F5; - function F6(x) { - return null; - } + function F6(x) { return null; } C.F6 = F6; var D = (function () { function D(val) { diff --git a/tests/baselines/reference/declFileObjectLiteralWithAccessors.js b/tests/baselines/reference/declFileObjectLiteralWithAccessors.js index 7d7c6ee73d3..85897bc2c9d 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithAccessors.js +++ b/tests/baselines/reference/declFileObjectLiteralWithAccessors.js @@ -15,12 +15,8 @@ point./*3*/x = 30; function makePoint(x) { return { b: 10, - get x() { - return x; - }, - set x(a) { - this.b = a; - } + get x() { return x; }, + set x(a) { this.b = a; } }; } ; diff --git a/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js b/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js index b3d41829637..dd39a30f7a2 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js +++ b/tests/baselines/reference/declFileObjectLiteralWithOnlyGetter.js @@ -12,9 +12,7 @@ var /*2*/x = point./*3*/x; //// [declFileObjectLiteralWithOnlyGetter.js] function makePoint(x) { return { - get x() { - return x; - } + get x() { return x; } }; } ; diff --git a/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js b/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js index dae362caf36..e219e885053 100644 --- a/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js +++ b/tests/baselines/reference/declFileObjectLiteralWithOnlySetter.js @@ -13,9 +13,7 @@ point./*2*/x = 30; function makePoint(x) { return { b: 10, - set x(a) { - this.b = a; - } + set x(a) { this.b = a; } }; } ; diff --git a/tests/baselines/reference/declFilePrivateStatic.js b/tests/baselines/reference/declFilePrivateStatic.js index 38efa8255a7..326ce62171d 100644 --- a/tests/baselines/reference/declFilePrivateStatic.js +++ b/tests/baselines/reference/declFilePrivateStatic.js @@ -21,16 +21,12 @@ var C = (function () { C.a = function () { }; C.b = function () { }; Object.defineProperty(C, "c", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); Object.defineProperty(C, "d", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js b/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js index 3cea09c8c26..0150c3f9d42 100644 --- a/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js +++ b/tests/baselines/reference/declFileRestParametersOfFunctionAndFunctionType.js @@ -16,9 +16,7 @@ function f2(x) { } function f3(x) { } function f4() { } function f5() { } -var f6 = function () { - return [10]; -}; +var f6 = function () { return [10]; }; //// [declFileRestParametersOfFunctionAndFunctionType.d.ts] diff --git a/tests/baselines/reference/declFileTypeofFunction.js b/tests/baselines/reference/declFileTypeofFunction.js index 2af519f411d..656e02b8ddd 100644 --- a/tests/baselines/reference/declFileTypeofFunction.js +++ b/tests/baselines/reference/declFileTypeofFunction.js @@ -34,12 +34,8 @@ function foo5(x: number) { } //// [declFileTypeofFunction.js] -function f() { - return undefined; -} -function g() { - return undefined; -} +function f() { return undefined; } +function g() { return undefined; } var b; function b1() { return b1; diff --git a/tests/baselines/reference/declInput-2.js b/tests/baselines/reference/declInput-2.js index 30a306c09f8..dcd37454ef0 100644 --- a/tests/baselines/reference/declInput-2.js +++ b/tests/baselines/reference/declInput-2.js @@ -38,20 +38,12 @@ var M; var D = (function () { function D() { } - D.prototype.m232 = function () { - return null; - }; - D.prototype.m242 = function () { - return null; - }; - D.prototype.m252 = function () { - return null; - }; // don't generate + D.prototype.m232 = function () { return null; }; + D.prototype.m242 = function () { return null; }; + D.prototype.m252 = function () { return null; }; // don't generate D.prototype.m26 = function (i) { }; D.prototype.m262 = function (i) { }; - D.prototype.m3 = function () { - return new C(); - }; + D.prototype.m3 = function () { return new C(); }; return D; })(); M.D = D; diff --git a/tests/baselines/reference/declInput.js b/tests/baselines/reference/declInput.js index 39d466498fa..cd558c93403 100644 --- a/tests/baselines/reference/declInput.js +++ b/tests/baselines/reference/declInput.js @@ -14,12 +14,8 @@ class bar { var bar = (function () { function bar() { } - bar.prototype.f = function () { - return ''; - }; - bar.prototype.g = function () { - return { a: null, b: undefined, c: void 4 }; - }; + bar.prototype.f = function () { return ''; }; + bar.prototype.g = function () { return { a: null, b: undefined, c: void 4 }; }; bar.prototype.h = function (x, y, z) { if (x === void 0) { x = 4; } if (y === void 0) { y = null; } diff --git a/tests/baselines/reference/declInput3.js b/tests/baselines/reference/declInput3.js index fa577a90645..3be31de3de0 100644 --- a/tests/baselines/reference/declInput3.js +++ b/tests/baselines/reference/declInput3.js @@ -14,12 +14,8 @@ class bar { var bar = (function () { function bar() { } - bar.prototype.f = function () { - return ''; - }; - bar.prototype.g = function () { - return { a: null, b: undefined, c: void 4 }; - }; + bar.prototype.f = function () { return ''; }; + bar.prototype.g = function () { return { a: null, b: undefined, c: void 4 }; }; bar.prototype.h = function (x, y, z) { if (x === void 0) { x = 4; } if (y === void 0) { y = null; } diff --git a/tests/baselines/reference/declInput4.js b/tests/baselines/reference/declInput4.js index cce9127eddc..07b6f091a14 100644 --- a/tests/baselines/reference/declInput4.js +++ b/tests/baselines/reference/declInput4.js @@ -32,12 +32,8 @@ var M; var D = (function () { function D() { } - D.prototype.m232 = function () { - return null; - }; - D.prototype.m242 = function () { - return null; - }; + D.prototype.m232 = function () { return null; }; + D.prototype.m242 = function () { return null; }; D.prototype.m26 = function (i) { }; return D; })(); diff --git a/tests/baselines/reference/declarationEmit_protectedMembers.js b/tests/baselines/reference/declarationEmit_protectedMembers.js index ff4323ce542..61a4ebdfcab 100644 --- a/tests/baselines/reference/declarationEmit_protectedMembers.js +++ b/tests/baselines/reference/declarationEmit_protectedMembers.js @@ -65,9 +65,7 @@ var C1 = (function () { return this.x; }; Object.defineProperty(C1.prototype, "accessor", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (a) { }, enumerable: true, configurable: true @@ -81,9 +79,7 @@ var C1 = (function () { configurable: true }); Object.defineProperty(C1, "staticGetter", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -116,9 +112,7 @@ var C3 = (function (_super) { return _super.sf.call(this); }; Object.defineProperty(C3, "staticGetter", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js b/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js index 8fc1c601982..34e862063ce 100644 --- a/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js +++ b/tests/baselines/reference/decrementOperatorWithNumberTypeInvalidOperations.js @@ -50,15 +50,11 @@ foo()--; // -- operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -72,14 +68,10 @@ var ResultIsNumber2 = NUMBER1--; // number type literal var ResultIsNumber3 = --1; var ResultIsNumber4 = --{ x: 1, y: 2 }; -var ResultIsNumber5 = --{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = --{ x: 1, y: function (n) { return n; } }; var ResultIsNumber6 = 1--; var ResultIsNumber7 = { x: 1, y: 2 }--; -var ResultIsNumber8 = { x: 1, y: function (n) { - return n; -} }--; +var ResultIsNumber8 = { x: 1, y: function (n) { return n; } }--; // number type expressions var ResultIsNumber9 = --foo(); var ResultIsNumber10 = --A.foo(); diff --git a/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js b/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js index 22c86aa8450..2be74a64d8f 100644 --- a/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js +++ b/tests/baselines/reference/decrementOperatorWithUnsupportedBooleanType.js @@ -57,15 +57,11 @@ objA.a--, M.n--; //// [decrementOperatorWithUnsupportedBooleanType.js] // -- operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return true; - }; + A.foo = function () { return true; }; return A; })(); var M; @@ -79,14 +75,10 @@ var ResultIsNumber2 = BOOLEAN--; // boolean type literal var ResultIsNumber3 = --true; var ResultIsNumber4 = --{ x: true, y: false }; -var ResultIsNumber5 = --{ x: true, y: function (n) { - return n; -} }; +var ResultIsNumber5 = --{ x: true, y: function (n) { return n; } }; var ResultIsNumber6 = true--; var ResultIsNumber7 = { x: true, y: false }--; -var ResultIsNumber8 = { x: true, y: function (n) { - return n; -} }--; +var ResultIsNumber8 = { x: true, y: function (n) { return n; } }--; // boolean type expressions var ResultIsNumber9 = --objA.a; var ResultIsNumber10 = --M.n; diff --git a/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js b/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js index 1747b1648d6..430f9af963f 100644 --- a/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js +++ b/tests/baselines/reference/decrementOperatorWithUnsupportedStringType.js @@ -69,15 +69,11 @@ objA.a--, M.n--; // -- operator on string type var STRING; var STRING1 = ["", ""]; -function foo() { - return ""; -} +function foo() { return ""; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -93,14 +89,10 @@ var ResultIsNumber4 = STRING1--; // string type literal var ResultIsNumber5 = --""; var ResultIsNumber6 = --{ x: "", y: "" }; -var ResultIsNumber7 = --{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber7 = --{ x: "", y: function (s) { return s; } }; var ResultIsNumber8 = ""--; var ResultIsNumber9 = { x: "", y: "" }--; -var ResultIsNumber10 = { x: "", y: function (s) { - return s; -} }--; +var ResultIsNumber10 = { x: "", y: function (s) { return s; } }--; // string type expressions var ResultIsNumber11 = --objA.a; var ResultIsNumber12 = --M.n; diff --git a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js index 98e135cc712..ad6181ba7c5 100644 --- a/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js +++ b/tests/baselines/reference/defaultBestCommonTypesHaveDecls.js @@ -20,13 +20,9 @@ var obj1; obj1.length; var obj2; obj2.length; -function concat(x, y) { - return null; -} +function concat(x, y) { return null; } var result = concat(1, ""); // error var elementCount = result.length; -function concat2(x, y) { - return null; -} +function concat2(x, y) { return null; } var result2 = concat2(1, ""); // result2 will be number|string var elementCount2 = result.length; diff --git a/tests/baselines/reference/deleteOperatorWithBooleanType.js b/tests/baselines/reference/deleteOperatorWithBooleanType.js index cab9cba2c95..b0a60a23744 100644 --- a/tests/baselines/reference/deleteOperatorWithBooleanType.js +++ b/tests/baselines/reference/deleteOperatorWithBooleanType.js @@ -41,15 +41,11 @@ delete M.n; //// [deleteOperatorWithBooleanType.js] // delete operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/deleteOperatorWithNumberType.js b/tests/baselines/reference/deleteOperatorWithNumberType.js index d19ae045805..bb70c55024d 100644 --- a/tests/baselines/reference/deleteOperatorWithNumberType.js +++ b/tests/baselines/reference/deleteOperatorWithNumberType.js @@ -49,15 +49,11 @@ delete objA.a, M.n; // delete operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -71,9 +67,7 @@ var ResultIsBoolean2 = delete NUMBER1; // number type literal var ResultIsBoolean3 = delete 1; var ResultIsBoolean4 = delete { x: 1, y: 2 }; -var ResultIsBoolean5 = delete { x: 1, y: function (n) { - return n; -} }; +var ResultIsBoolean5 = delete { x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsBoolean6 = delete objA.a; var ResultIsBoolean7 = delete M.n; diff --git a/tests/baselines/reference/deleteOperatorWithStringType.js b/tests/baselines/reference/deleteOperatorWithStringType.js index ad27e8f84ad..79246e27725 100644 --- a/tests/baselines/reference/deleteOperatorWithStringType.js +++ b/tests/baselines/reference/deleteOperatorWithStringType.js @@ -48,15 +48,11 @@ delete objA.a,M.n; // delete operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -70,9 +66,7 @@ var ResultIsBoolean2 = delete STRING1; // string type literal var ResultIsBoolean3 = delete ""; var ResultIsBoolean4 = delete { x: "", y: "" }; -var ResultIsBoolean5 = delete { x: "", y: function (s) { - return s; -} }; +var ResultIsBoolean5 = delete { x: "", y: function (s) { return s; } }; // string type expressions var ResultIsBoolean6 = delete objA.a; var ResultIsBoolean7 = delete M.n; diff --git a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js index 1c56819b200..32e8cf4199e 100644 --- a/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js +++ b/tests/baselines/reference/derivedClassConstructorWithoutSuperCall.js @@ -66,9 +66,7 @@ var Derived2 = (function (_super) { var Derived3 = (function (_super) { __extends(Derived3, _super); function Derived3() { - var r = function () { - _super.call(this); - }; // error + var r = function () { _super.call(this); }; // error } return Derived3; })(Base2); diff --git a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js index bdfa31cb04f..f2e816604d2 100644 --- a/tests/baselines/reference/derivedClassIncludesInheritedMembers.js +++ b/tests/baselines/reference/derivedClassIncludesInheritedMembers.js @@ -52,18 +52,14 @@ var Base = (function () { } Base.prototype.b = function () { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return ''; - }, + get: function () { return ''; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function () { }; Object.defineProperty(Base, "t", { - get: function () { - return ''; - }, + get: function () { return ''; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js index af725e9b7bd..b66d356a73e 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers.js @@ -50,18 +50,14 @@ var Base = (function () { } Base.prototype.b = function (a) { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function (a) { }; Object.defineProperty(Base, "t", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true @@ -75,18 +71,14 @@ var Derived = (function (_super) { } Derived.prototype.b = function (a) { }; Object.defineProperty(Derived.prototype, "c", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (v) { }, enumerable: true, configurable: true }); Derived.s = function (a) { }; Object.defineProperty(Derived, "t", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (a) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js index b1f5de00fb5..80f7456ab9a 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers2.js @@ -77,18 +77,14 @@ var Base = (function () { } Base.prototype.b = function (a) { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function (a) { }; Object.defineProperty(Base, "t", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true @@ -103,18 +99,14 @@ var Derived = (function (_super) { } Derived.prototype.b = function (a) { }; Object.defineProperty(Derived.prototype, "c", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (v) { }, enumerable: true, configurable: true }); Derived.s = function (a) { }; Object.defineProperty(Derived, "t", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (a) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js index d6b93addbd3..cfb6116ee85 100644 --- a/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js +++ b/tests/baselines/reference/derivedClassOverridesProtectedMembers3.js @@ -85,18 +85,14 @@ var Base = (function () { } Base.prototype.b = function (a) { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function (a) { }; Object.defineProperty(Base, "t", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true @@ -126,9 +122,7 @@ var Derived3 = (function (_super) { _super.call(this, a); } Object.defineProperty(Derived3.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, enumerable: true, configurable: true }); @@ -174,9 +168,7 @@ var Derived8 = (function (_super) { _super.call(this, a); } Object.defineProperty(Derived8, "t", { - get: function () { - return x; - }, + get: function () { return x; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/derivedClassOverridesPublicMembers.js b/tests/baselines/reference/derivedClassOverridesPublicMembers.js index a1df28586d9..9d7df0eee40 100644 --- a/tests/baselines/reference/derivedClassOverridesPublicMembers.js +++ b/tests/baselines/reference/derivedClassOverridesPublicMembers.js @@ -76,18 +76,14 @@ var Base = (function () { } Base.prototype.b = function (a) { }; Object.defineProperty(Base.prototype, "c", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true }); Base.s = function (a) { }; Object.defineProperty(Base, "t", { - get: function () { - return x; - }, + get: function () { return x; }, set: function (v) { }, enumerable: true, configurable: true @@ -101,18 +97,14 @@ var Derived = (function (_super) { } Derived.prototype.b = function (a) { }; Object.defineProperty(Derived.prototype, "c", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (v) { }, enumerable: true, configurable: true }); Derived.s = function (a) { }; Object.defineProperty(Derived, "t", { - get: function () { - return y; - }, + get: function () { return y; }, set: function (a) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js index 7e61be1c1c9..1902b6f4068 100644 --- a/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js +++ b/tests/baselines/reference/derivedClassSuperCallsWithThisArg.js @@ -67,9 +67,7 @@ var Derived3 = (function (_super) { var Derived4 = (function (_super) { __extends(Derived4, _super); function Derived4(a) { - _super.call(this, function () { - return this; - }); // ok + _super.call(this, function () { return this; }); // ok this.a = a; } return Derived4; diff --git a/tests/baselines/reference/derivedClassWithAny.js b/tests/baselines/reference/derivedClassWithAny.js index 0b568eaec9b..8070e689bd0 100644 --- a/tests/baselines/reference/derivedClassWithAny.js +++ b/tests/baselines/reference/derivedClassWithAny.js @@ -70,9 +70,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "X", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); @@ -125,9 +123,7 @@ var E = (function (_super) { _super.apply(this, arguments); } Object.defineProperty(E.prototype, "X", { - get: function () { - return ''; - }, + get: function () { return ''; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js index 63c33f87836..8b00c632058 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingProtectedInstance.js @@ -36,9 +36,7 @@ var Base = (function () { return ''; }; Object.defineProperty(Base.prototype, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -55,9 +53,7 @@ var Derived = (function (_super) { return ''; }; Object.defineProperty(Derived.prototype, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js index 692ae1569ec..4ac57d159e6 100644 --- a/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js +++ b/tests/baselines/reference/derivedClassWithPrivateInstanceShadowingPublicInstance.js @@ -46,9 +46,7 @@ var Base = (function () { return ''; }; Object.defineProperty(Base.prototype, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -65,9 +63,7 @@ var Derived = (function (_super) { return ''; }; Object.defineProperty(Derived.prototype, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js index 56ce444de0b..1037d3faaae 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingProtectedStatic.js @@ -35,9 +35,7 @@ var Base = (function () { return ''; }; Object.defineProperty(Base, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -54,9 +52,7 @@ var Derived = (function (_super) { return ''; }; Object.defineProperty(Derived, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js index 7ae518eeedf..c5bfea288bd 100644 --- a/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js +++ b/tests/baselines/reference/derivedClassWithPrivateStaticShadowingPublicStatic.js @@ -47,9 +47,7 @@ var Base = (function () { return ''; }; Object.defineProperty(Base, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -67,9 +65,7 @@ var Derived = (function (_super) { return ''; }; Object.defineProperty(Derived, "a", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/derivedClasses.js b/tests/baselines/reference/derivedClasses.js index a0d6de6a819..e256313d27b 100644 --- a/tests/baselines/reference/derivedClasses.js +++ b/tests/baselines/reference/derivedClasses.js @@ -44,9 +44,7 @@ var Red = (function (_super) { } Red.prototype.shade = function () { var _this = this; - var getHue = function () { - return _this.hue(); - }; + var getHue = function () { return _this.hue(); }; return getHue() + " red"; }; return Red; @@ -54,12 +52,8 @@ var Red = (function (_super) { var Color = (function () { function Color() { } - Color.prototype.shade = function () { - return "some shade"; - }; - Color.prototype.hue = function () { - return "some hue"; - }; + Color.prototype.shade = function () { return "some shade"; }; + Color.prototype.hue = function () { return "some hue"; }; return Color; })(); var Blue = (function (_super) { @@ -69,9 +63,7 @@ var Blue = (function (_super) { } Blue.prototype.shade = function () { var _this = this; - var getHue = function () { - return _this.hue(); - }; + var getHue = function () { return _this.hue(); }; return getHue() + " blue"; }; return Blue; diff --git a/tests/baselines/reference/derivedGenericClassWithAny.js b/tests/baselines/reference/derivedGenericClassWithAny.js index 677fadf3876..4d1f0452be4 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.js +++ b/tests/baselines/reference/derivedGenericClassWithAny.js @@ -53,9 +53,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "X", { - get: function () { - return null; - }, + get: function () { return null; }, enumerable: true, configurable: true }); @@ -98,9 +96,7 @@ var E = (function (_super) { _super.apply(this, arguments); } Object.defineProperty(E.prototype, "X", { - get: function () { - return ''; - } // error + get: function () { return ''; } // error , enumerable: true, configurable: true diff --git a/tests/baselines/reference/duplicateLocalVariable1.js b/tests/baselines/reference/duplicateLocalVariable1.js index cace580eea1..97becb0ff58 100644 --- a/tests/baselines/reference/duplicateLocalVariable1.js +++ b/tests/baselines/reference/duplicateLocalVariable1.js @@ -361,9 +361,7 @@ var TestRunner = (function () { this.tests = []; } TestRunner.arrayCompare = function (arg1, arg2) { - return (arg1.every(function (val, index) { - return val === arg2[index]; - })); + return (arg1.every(function (val, index) { return val === arg2[index]; })); }; TestRunner.prototype.addTest = function (test) { this.tests.push(test); @@ -410,23 +408,11 @@ exports.TestRunner = TestRunner; exports.tests = (function () { var testRunner = new TestRunner(); // First 3 are for simple harness validation - testRunner.addTest(new TestCase("Basic test", function () { - return true; - })); - testRunner.addTest(new TestCase("Test for any error", function () { - throw new Error(); - return false; - }, "")); - testRunner.addTest(new TestCase("Test RegEx error message match", function () { - throw new Error("Should also pass"); - return false; - }, "Should [also]+ pass")); - testRunner.addTest(new TestCase("Test array compare true", function () { - return TestRunner.arrayCompare([1, 2, 3], [1, 2, 3]); - })); - testRunner.addTest(new TestCase("Test array compare false", function () { - return !TestRunner.arrayCompare([3, 2, 3], [1, 2, 3]); - })); + testRunner.addTest(new TestCase("Basic test", function () { return true; })); + testRunner.addTest(new TestCase("Test for any error", function () { throw new Error(); return false; }, "")); + testRunner.addTest(new TestCase("Test RegEx error message match", function () { throw new Error("Should also pass"); return false; }, "Should [also]+ pass")); + testRunner.addTest(new TestCase("Test array compare true", function () { return TestRunner.arrayCompare([1, 2, 3], [1, 2, 3]); })); + testRunner.addTest(new TestCase("Test array compare false", function () { return !TestRunner.arrayCompare([3, 2, 3], [1, 2, 3]); })); // File detection tests testRunner.addTest(new TestCase("Check file exists", function () { return FileManager.DirectoryManager.fileExists(TestFileDir + "\\Test.txt"); @@ -516,9 +502,7 @@ exports.tests = (function () { var fb = new FileManager.FileBuffer(14); fb.writeUtf16leBom(); var chars = [0x0054, 0x00E8, 0x1D23, 0x2020, 0x000D, 0x000A]; - chars.forEach(function (val) { - fb.writeUtf16CodePoint(val, false); - }); + chars.forEach(function (val) { fb.writeUtf16CodePoint(val, false); }); fb.save(filename); var savedFile = new FileManager.FileBuffer(filename); if (savedFile.encoding !== 'utf16le') { @@ -573,9 +557,7 @@ exports.tests = (function () { var filename = TestFileDir + "\\tmpUTF8nonBmp.txt"; var fb = new FileManager.FileBuffer(15); var chars = [0x10480, 0x10481, 0x10482, 0x54, 0x68, 0x69]; - chars.forEach(function (val) { - fb.writeUtf8CodePoint(val); - }); + chars.forEach(function (val) { fb.writeUtf8CodePoint(val); }); fb.save(filename); var savedFile = new FileManager.FileBuffer(filename); if (savedFile.encoding !== 'utf8') { diff --git a/tests/baselines/reference/duplicateObjectLiteralProperty.js b/tests/baselines/reference/duplicateObjectLiteralProperty.js index 5fd2d1177f8..9c629b211cf 100644 --- a/tests/baselines/reference/duplicateObjectLiteralProperty.js +++ b/tests/baselines/reference/duplicateObjectLiteralProperty.js @@ -30,11 +30,7 @@ var x = { } }; var y = { - get a() { - return 0; - }, + get a() { return 0; }, set a(v) { }, - get a() { - return 0; - } + get a() { return 0; } }; diff --git a/tests/baselines/reference/emitArrowFunction.js b/tests/baselines/reference/emitArrowFunction.js index 41c52cbfefc..9c50c4776b1 100644 --- a/tests/baselines/reference/emitArrowFunction.js +++ b/tests/baselines/reference/emitArrowFunction.js @@ -14,6 +14,4 @@ var f3 = function (x, y) { }; var f4 = function (x, y, z) { }; function foo(func) { } foo(function () { return true; }); -foo(function () { - return false; -}); +foo(function () { return false; }); diff --git a/tests/baselines/reference/emitArrowFunctionES6.js b/tests/baselines/reference/emitArrowFunctionES6.js index 39d69cc1f0e..35078502ef7 100644 --- a/tests/baselines/reference/emitArrowFunctionES6.js +++ b/tests/baselines/reference/emitArrowFunctionES6.js @@ -15,6 +15,4 @@ var f3 = (x, y, ...rest) => { }; var f4 = (x, y, z = 10) => { }; function foo(func) { } foo(() => { return true; }); -foo(() => { - return false; -}); +foo(() => { return false; }); diff --git a/tests/baselines/reference/errorSuperPropertyAccess.js b/tests/baselines/reference/errorSuperPropertyAccess.js index 845bc9834f7..79ba631afed 100644 --- a/tests/baselines/reference/errorSuperPropertyAccess.js +++ b/tests/baselines/reference/errorSuperPropertyAccess.js @@ -209,9 +209,7 @@ var SomeDerived1 = (function (_super) { super.publicFunc.call(this); } var x = { - test: function () { - return super.publicFunc.call(this); - } + test: function () { return super.publicFunc.call(this); } }; }; return SomeDerived1; diff --git a/tests/baselines/reference/errorSupression1.js b/tests/baselines/reference/errorSupression1.js index 059530be452..53e40e585f0 100644 --- a/tests/baselines/reference/errorSupression1.js +++ b/tests/baselines/reference/errorSupression1.js @@ -12,9 +12,7 @@ baz.concat("y"); var Foo = (function () { function Foo() { } - Foo.bar = function () { - return "x"; - }; + Foo.bar = function () { return "x"; }; return Foo; })(); var baz = Foo.b; diff --git a/tests/baselines/reference/errorsInGenericTypeReference.js b/tests/baselines/reference/errorsInGenericTypeReference.js index 1a27a681e59..03bf31a6a6b 100644 --- a/tests/baselines/reference/errorsInGenericTypeReference.js +++ b/tests/baselines/reference/errorsInGenericTypeReference.js @@ -104,12 +104,8 @@ var tc2 = new testClass2(); // error: could not find symbol V var testClass3 = (function () { function testClass3() { } - testClass3.prototype.testMethod1 = function () { - return null; - }; // error: could not find symbol V - testClass3.testMethod2 = function () { - return null; - }; // error: could not find symbol V + testClass3.prototype.testMethod1 = function () { return null; }; // error: could not find symbol V + testClass3.testMethod2 = function () { return null; }; // error: could not find symbol V Object.defineProperty(testClass3.prototype, "a", { set: function (value) { } // error: could not find symbol V , @@ -119,9 +115,7 @@ var testClass3 = (function () { return testClass3; })(); // in function return type annotation -function testFunction1() { - return null; -} // error: could not find symbol V +function testFunction1() { return null; } // error: could not find symbol V // in paramter types function testFunction2(p) { } // error: could not find symbol V // in var type annotation diff --git a/tests/baselines/reference/es6ClassTest.js b/tests/baselines/reference/es6ClassTest.js index 5fd9f0e9b7f..08c184a0df2 100644 --- a/tests/baselines/reference/es6ClassTest.js +++ b/tests/baselines/reference/es6ClassTest.js @@ -112,12 +112,8 @@ var Foo = (function (_super) { this.x = x; this.gar = 5; } - Foo.prototype.bar = function () { - return 0; - }; - Foo.prototype.boo = function (x) { - return x; - }; + Foo.prototype.bar = function () { return 0; }; + Foo.prototype.boo = function (x) { return x; }; Foo.statVal = 0; return Foo; })(Bar); diff --git a/tests/baselines/reference/es6ClassTest2.js b/tests/baselines/reference/es6ClassTest2.js index f4854644079..fb0349c9044 100644 --- a/tests/baselines/reference/es6ClassTest2.js +++ b/tests/baselines/reference/es6ClassTest2.js @@ -243,9 +243,7 @@ var SplatMonster = (function () { SplatMonster.prototype.roar = function (name) { }; return SplatMonster; })(); -function foo() { - return true; -} +function foo() { return true; } var PrototypeMonster = (function () { function PrototypeMonster() { this.age = 1; diff --git a/tests/baselines/reference/es6ClassTest8.js b/tests/baselines/reference/es6ClassTest8.js index 3c616e5e893..f96bbd16b0b 100644 --- a/tests/baselines/reference/es6ClassTest8.js +++ b/tests/baselines/reference/es6ClassTest8.js @@ -41,9 +41,7 @@ class Camera { //// [es6ClassTest8.js] -function f1(x) { - return x; -} +function f1(x) { return x; } var C = (function () { function C() { var bar = (function () { @@ -59,21 +57,11 @@ var Vector = (function () { this.y = y; this.z = z; } - Vector.norm = function (v) { - return null; - }; - Vector.minus = function (v1, v2) { - return null; - }; - Vector.times = function (v1, v2) { - return null; - }; - Vector.cross = function (v1, v2) { - return null; - }; - Vector.dot = function (v1, v2) { - return null; - }; + Vector.norm = function (v) { return null; }; + Vector.minus = function (v1, v2) { return null; }; + Vector.times = function (v1, v2) { return null; }; + Vector.cross = function (v1, v2) { return null; }; + Vector.dot = function (v1, v2) { return null; }; return Vector; })(); var Camera = (function () { diff --git a/tests/baselines/reference/es6MemberScoping.js b/tests/baselines/reference/es6MemberScoping.js index 85f76a93934..7e70045ceb3 100644 --- a/tests/baselines/reference/es6MemberScoping.js +++ b/tests/baselines/reference/es6MemberScoping.js @@ -30,8 +30,6 @@ var Foo = (function () { var Foo2 = (function () { function Foo2() { } - Foo2.Foo2 = function () { - return 0; - }; // should not be an error + Foo2.Foo2 = function () { return 0; }; // should not be an error return Foo2; })(); diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.js b/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.js index 291bcfcb68f..707801dc4ee 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.js +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInitializer.js @@ -59,9 +59,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -70,9 +68,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var aNumber = 9.9; diff --git a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.js b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.js index 7191aef20bf..40e45bf7ec0 100644 --- a/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.js +++ b/tests/baselines/reference/everyTypeWithAnnotationAndInvalidInitializer.js @@ -65,12 +65,8 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} -function F2(x) { - return x < 42; -} +function F(x) { return 42; } +function F2(x) { return x < 42; } var M; (function (M) { var A = (function () { @@ -79,9 +75,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var N; @@ -92,9 +86,7 @@ var N; return A; })(); N.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } N.F2 = F2; })(N || (N = {})); var aNumber = 'this is a string'; diff --git a/tests/baselines/reference/everyTypeWithInitializer.js b/tests/baselines/reference/everyTypeWithInitializer.js index 74904a5ea30..aae0a9fe291 100644 --- a/tests/baselines/reference/everyTypeWithInitializer.js +++ b/tests/baselines/reference/everyTypeWithInitializer.js @@ -60,9 +60,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -71,9 +69,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var aNumber = 9.9; diff --git a/tests/baselines/reference/exportAssignmentFunction.js b/tests/baselines/reference/exportAssignmentFunction.js index 6d4336bd4bd..825d0f983ea 100644 --- a/tests/baselines/reference/exportAssignmentFunction.js +++ b/tests/baselines/reference/exportAssignmentFunction.js @@ -12,9 +12,7 @@ var n: number = fooFunc(); //// [exportAssignmentFunction_A.js] define(["require", "exports"], function (require, exports) { - function foo() { - return 0; - } + function foo() { return 0; } return foo; }); //// [exportAssignmentFunction_B.js] diff --git a/tests/baselines/reference/exportImportMultipleFiles.js b/tests/baselines/reference/exportImportMultipleFiles.js index 225b605f689..10909808ffc 100644 --- a/tests/baselines/reference/exportImportMultipleFiles.js +++ b/tests/baselines/reference/exportImportMultipleFiles.js @@ -14,9 +14,7 @@ lib.math.add(3, 4); // Shouldnt be error //// [exportImportMultipleFiles_math.js] define(["require", "exports"], function (require, exports) { - function add(a, b) { - return a + b; - } + function add(a, b) { return a + b; } exports.add = add; }); //// [exportImportMultipleFiles_library.js] diff --git a/tests/baselines/reference/exportPrivateType.js b/tests/baselines/reference/exportPrivateType.js index 96acc83edb5..11ccc037ef6 100644 --- a/tests/baselines/reference/exportPrivateType.js +++ b/tests/baselines/reference/exportPrivateType.js @@ -41,9 +41,7 @@ var foo; var C2 = (function () { function C2() { } - C2.prototype.test = function () { - return true; - }; + C2.prototype.test = function () { return true; }; return C2; })(); // None of the types are exported, so per section 10.3, should all be errors diff --git a/tests/baselines/reference/fatArrowfunctionAsType.js b/tests/baselines/reference/fatArrowfunctionAsType.js index bd2dc4310d9..894267580c6 100644 --- a/tests/baselines/reference/fatArrowfunctionAsType.js +++ b/tests/baselines/reference/fatArrowfunctionAsType.js @@ -7,7 +7,5 @@ b = c; //// [fatArrowfunctionAsType.js] -var c = function (x) { - return 42; -}; +var c = function (x) { return 42; }; b = c; diff --git a/tests/baselines/reference/fatarrowfunctions.js b/tests/baselines/reference/fatarrowfunctions.js index 1ad00820990..eb57d1a9817 100644 --- a/tests/baselines/reference/fatarrowfunctions.js +++ b/tests/baselines/reference/fatarrowfunctions.js @@ -49,56 +49,30 @@ var messenger = { function foo(x) { return x(); } -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function () { - return 0; -}); foo(function (x, y, z) { return x + y + z; }); foo(function (x, y, z) { return x + y + z; }); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function (x, y, z) { - return x + y + z; -}); -foo(function () { - return 0; -}); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function () { return 0; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function (x, y, z) { return x + y + z; }); +foo(function () { return 0; }); foo((function (x) { return x; })); foo(function (x) { return x * x; }); var y = function (x) { return x * x; }; var z = function (x) { return x * x; }; var w = function () { return 3; }; function ternaryTest(isWhile) { - var f = isWhile ? function (n) { - return n > 0; - } : function (n) { - return n === 0; - }; + var f = isWhile ? function (n) { return n > 0; } : function (n) { return n === 0; }; } var messenger = { message: "Hello World", start: function () { var _this = this; - setTimeout(function () { - _this.message.toString(); - }, 3000); + setTimeout(function () { _this.message.toString(); }, 3000); } }; diff --git a/tests/baselines/reference/fatarrowfunctionsErrors.js b/tests/baselines/reference/fatarrowfunctionsErrors.js index 59baa802c9f..7b7a8f30f05 100644 --- a/tests/baselines/reference/fatarrowfunctionsErrors.js +++ b/tests/baselines/reference/fatarrowfunctionsErrors.js @@ -21,9 +21,7 @@ foo(function () { return 0; }); foo((1), { return: 0 }); -foo(function (x) { - return x; -}); +foo(function (x) { return x; }); foo(function (x) { if (x === void 0) { x = 0; } return x; diff --git a/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js b/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js index 6d6e3013fbb..9052b894337 100644 --- a/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js +++ b/tests/baselines/reference/fatarrowfunctionsOptionalArgs.js @@ -208,9 +208,7 @@ foo( return 28; }); // in multiple paren -((((function (arg) { - return 32; -})))); +((((function (arg) { return 32; })))); // in ternary exression false ? function () { return 41; } : null; false ? function (arg) { return 42; } : null; @@ -275,17 +273,9 @@ false ? null : function () { return 68; }; // nested ternary expressions -(function (a) { - return a; -}) ? function (b) { - return b; -} : function (c) { - return c; -}; +(function (a) { return a; }) ? function (b) { return b; } : function (c) { return c; }; //multiple levels -(function (a) { - return a; -}); +(function (a) { return a; }); (function (b) { return function (c) { return 81; }; }); (function (c) { return function (d) { return 82; }; }); // In Expressions diff --git a/tests/baselines/reference/fieldAndGetterWithSameName.js b/tests/baselines/reference/fieldAndGetterWithSameName.js index 64129ff9365..ddd95b9e8f2 100644 --- a/tests/baselines/reference/fieldAndGetterWithSameName.js +++ b/tests/baselines/reference/fieldAndGetterWithSameName.js @@ -10,9 +10,7 @@ define(["require", "exports"], function (require, exports) { function C() { } Object.defineProperty(C.prototype, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/for-inStatements.js b/tests/baselines/reference/for-inStatements.js index 00f1a64a8d6..32e1389232d 100644 --- a/tests/baselines/reference/for-inStatements.js +++ b/tests/baselines/reference/for-inStatements.js @@ -106,9 +106,7 @@ for (var x in '' ? c : d) { } for (var x in 42 ? d[x] : c[x]) { } for (var x in c[d]) { } for (var x in (function (x) { return x; })) { } -for (var x in function (x, y) { - return x + y; -}) { } +for (var x in function (x, y) { return x + y; }) { } var A = (function () { function A() { } diff --git a/tests/baselines/reference/for-inStatementsInvalid.js b/tests/baselines/reference/for-inStatementsInvalid.js index fc43665e99e..6d42a550a01 100644 --- a/tests/baselines/reference/for-inStatementsInvalid.js +++ b/tests/baselines/reference/for-inStatementsInvalid.js @@ -87,9 +87,7 @@ for (var x in '' ? c : d) { } for (var x in 42 ? d[x] : c[x]) { } for (var x in c[23]) { } for (var x in (function (x) { return x; })) { } -for (var x in function (x, y) { - return x + y; -}) { } +for (var x in function (x, y) { return x + y; }) { } var A = (function () { function A() { } diff --git a/tests/baselines/reference/forStatements.js b/tests/baselines/reference/forStatements.js index 1755ff51fdc..39fdb6c8871 100644 --- a/tests/baselines/reference/forStatements.js +++ b/tests/baselines/reference/forStatements.js @@ -57,9 +57,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -68,9 +66,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); for (var aNumber = 9.9;;) { } diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js index 5c856398be2..2282136be3a 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.js @@ -77,9 +77,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -88,9 +86,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); // all of these are errors diff --git a/tests/baselines/reference/forStatementsMultipleValidDecl.js b/tests/baselines/reference/forStatementsMultipleValidDecl.js index 76571ce1ff4..e95e37d63ac 100644 --- a/tests/baselines/reference/forStatementsMultipleValidDecl.js +++ b/tests/baselines/reference/forStatementsMultipleValidDecl.js @@ -49,9 +49,7 @@ for (var p = { x: 1, y: undefined };;) { } for (var p = { x: 1, y: 2 };;) { } for (var p = { x: 0, y: undefined };;) { } for (var p;;) { } -for (var fn = function (s) { - return 42; -};;) { } +for (var fn = function (s) { return 42; };;) { } for (var fn = function (s) { return 3; };;) { } for (var fn;;) { } for (var fn;;) { } diff --git a/tests/baselines/reference/functionAssignment.js b/tests/baselines/reference/functionAssignment.js index 5a3e07c9e8d..3237f53bf9a 100644 --- a/tests/baselines/reference/functionAssignment.js +++ b/tests/baselines/reference/functionAssignment.js @@ -53,6 +53,4 @@ f2(function () { function f3(a) { } f3({ a: 0, b: 0 }); function callb(a) { } -callb(function (a) { - a.length; -}); +callb(function (a) { a.length; }); diff --git a/tests/baselines/reference/functionAssignmentError.js b/tests/baselines/reference/functionAssignmentError.js index e19547096b8..dd35ccb271a 100644 --- a/tests/baselines/reference/functionAssignmentError.js +++ b/tests/baselines/reference/functionAssignmentError.js @@ -3,9 +3,5 @@ var func = function (){return "ONE";}; func = function (){return "ONE";}; //// [functionAssignmentError.js] -var func = function () { - return "ONE"; -}; -func = function () { - return "ONE"; -}; +var func = function () { return "ONE"; }; +func = function () { return "ONE"; }; diff --git a/tests/baselines/reference/functionCall1.js b/tests/baselines/reference/functionCall1.js index 8025ad5a6f5..cb8c1a46a23 100644 --- a/tests/baselines/reference/functionCall1.js +++ b/tests/baselines/reference/functionCall1.js @@ -3,8 +3,6 @@ function foo():any{return ""}; var x = foo(); //// [functionCall1.js] -function foo() { - return ""; -} +function foo() { return ""; } ; var x = foo(); diff --git a/tests/baselines/reference/functionCall2.js b/tests/baselines/reference/functionCall2.js index 5b6da378103..5351dc116ff 100644 --- a/tests/baselines/reference/functionCall2.js +++ b/tests/baselines/reference/functionCall2.js @@ -3,8 +3,6 @@ function foo():number{return 1}; var x = foo(); //// [functionCall2.js] -function foo() { - return 1; -} +function foo() { return 1; } ; var x = foo(); diff --git a/tests/baselines/reference/functionCall3.js b/tests/baselines/reference/functionCall3.js index db29b44db7a..74540c2ccf6 100644 --- a/tests/baselines/reference/functionCall3.js +++ b/tests/baselines/reference/functionCall3.js @@ -3,7 +3,5 @@ function foo():any[]{return [1];} var x = foo(); //// [functionCall3.js] -function foo() { - return [1]; -} +function foo() { return [1]; } var x = foo(); diff --git a/tests/baselines/reference/functionCall4.js b/tests/baselines/reference/functionCall4.js index 05021c33563..0f937337d49 100644 --- a/tests/baselines/reference/functionCall4.js +++ b/tests/baselines/reference/functionCall4.js @@ -4,12 +4,8 @@ function bar():()=>any{return foo}; var x = bar(); //// [functionCall4.js] -function foo() { - return ""; -} +function foo() { return ""; } ; -function bar() { - return foo; -} +function bar() { return foo; } ; var x = bar(); diff --git a/tests/baselines/reference/functionCall5.js b/tests/baselines/reference/functionCall5.js index e6b0e049ef6..dc7db4a9959 100644 --- a/tests/baselines/reference/functionCall5.js +++ b/tests/baselines/reference/functionCall5.js @@ -13,8 +13,6 @@ var m1; })(); m1.c1 = c1; })(m1 || (m1 = {})); -function foo() { - return new m1.c1(); -} +function foo() { return new m1.c1(); } ; var x = foo(); diff --git a/tests/baselines/reference/functionCall7.js b/tests/baselines/reference/functionCall7.js index b32c21b5892..cb30e5d8b24 100644 --- a/tests/baselines/reference/functionCall7.js +++ b/tests/baselines/reference/functionCall7.js @@ -18,9 +18,7 @@ var m1; })(); m1.c1 = c1; })(m1 || (m1 = {})); -function foo(a) { - a.a = 1; -} +function foo(a) { a.a = 1; } ; var myC = new m1.c1(); foo(myC); diff --git a/tests/baselines/reference/functionConstraintSatisfaction.js b/tests/baselines/reference/functionConstraintSatisfaction.js index a16f4d1ed36..b8741456178 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction.js +++ b/tests/baselines/reference/functionConstraintSatisfaction.js @@ -63,9 +63,7 @@ function foo2(x: T, y: U) { //// [functionConstraintSatisfaction.js] // satisfaction of a constraint to Function, no errors expected -function foo(x) { - return x; -} +function foo(x) { return x; } var i; var C = (function () { function C() { @@ -78,12 +76,8 @@ var c; var r = foo(new Function()); var r1 = foo(function (x) { return x; }); var r2 = foo(function (x) { return x; }); -var r3 = foo(function (x) { - return x; -}); -var r4 = foo(function (x) { - return x; -}); +var r3 = foo(function (x) { return x; }); +var r4 = foo(function (x) { return x; }); var r5 = foo(i); var r6 = foo(C); var r7 = foo(b); @@ -98,9 +92,7 @@ var a2; var b2; var c2; var r9 = foo(function (x) { return x; }); -var r10 = foo(function (x) { - return x; -}); +var r10 = foo(function (x) { return x; }); var r11 = foo(function (x) { return x; }); var r12 = foo(function (x, y) { return x; }); var r13 = foo(i2); diff --git a/tests/baselines/reference/functionConstraintSatisfaction2.js b/tests/baselines/reference/functionConstraintSatisfaction2.js index 982dcb37a49..9e70a508ccd 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction2.js +++ b/tests/baselines/reference/functionConstraintSatisfaction2.js @@ -42,15 +42,11 @@ function fff(x: T, y: U) { //// [functionConstraintSatisfaction2.js] // satisfaction of a constraint to Function, all of these invocations are errors unless otherwise noted -function foo(x) { - return x; -} +function foo(x) { return x; } foo(1); foo(function () { }, 1); foo(1, function () { }); -function foo2(x) { - return x; -} +function foo2(x) { return x; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/functionConstraintSatisfaction3.js b/tests/baselines/reference/functionConstraintSatisfaction3.js index 4738cecedab..2c1bfa4d399 100644 --- a/tests/baselines/reference/functionConstraintSatisfaction3.js +++ b/tests/baselines/reference/functionConstraintSatisfaction3.js @@ -43,9 +43,7 @@ var r15 = foo(c2); //// [functionConstraintSatisfaction3.js] // satisfaction of a constraint to Function, no errors expected -function foo(x) { - return x; -} +function foo(x) { return x; } var i; var C = (function () { function C() { @@ -57,12 +55,8 @@ var b; var c; var r1 = foo(function (x) { return x; }); var r2 = foo(function (x) { return x; }); -var r3 = foo(function (x) { - return x; -}); -var r4 = foo(function (x) { - return x; -}); +var r3 = foo(function (x) { return x; }); +var r4 = foo(function (x) { return x; }); var r5 = foo(i); var r8 = foo(c); var i2; @@ -74,9 +68,7 @@ var C2 = (function () { var a2; var b2; var c2; -var r9 = foo(function (x) { - return x; -}); +var r9 = foo(function (x) { return x; }); var r10 = foo(function (x) { return x; }); var r12 = foo(i2); var r15 = foo(c2); diff --git a/tests/baselines/reference/functionExpressionReturningItself.js b/tests/baselines/reference/functionExpressionReturningItself.js index 8553d2da867..9485100164e 100644 --- a/tests/baselines/reference/functionExpressionReturningItself.js +++ b/tests/baselines/reference/functionExpressionReturningItself.js @@ -2,9 +2,7 @@ var x = function somefn() { return somefn; }; //// [functionExpressionReturningItself.js] -var x = function somefn() { - return somefn; -}; +var x = function somefn() { return somefn; }; //// [functionExpressionReturningItself.d.ts] diff --git a/tests/baselines/reference/functionOverloadAmbiguity1.js b/tests/baselines/reference/functionOverloadAmbiguity1.js index f2fa78e1c14..2833ccbcdc3 100644 --- a/tests/baselines/reference/functionOverloadAmbiguity1.js +++ b/tests/baselines/reference/functionOverloadAmbiguity1.js @@ -12,10 +12,6 @@ callb2((a) => { a.length; } ); // ok, chose first overload //// [functionOverloadAmbiguity1.js] function callb(a) { } -callb(function (a) { - a.length; -}); // error, chose first overload +callb(function (a) { a.length; }); // error, chose first overload function callb2(a) { } -callb2(function (a) { - a.length; -}); // ok, chose first overload +callb2(function (a) { a.length; }); // ok, chose first overload diff --git a/tests/baselines/reference/functionOverloads.js b/tests/baselines/reference/functionOverloads.js index 5504b286628..7e38b8fe993 100644 --- a/tests/baselines/reference/functionOverloads.js +++ b/tests/baselines/reference/functionOverloads.js @@ -5,8 +5,6 @@ function foo(bar?: string): any { return "" }; var x = foo(5); //// [functionOverloads.js] -function foo(bar) { - return ""; -} +function foo(bar) { return ""; } ; var x = foo(5); diff --git a/tests/baselines/reference/functionOverloads1.js b/tests/baselines/reference/functionOverloads1.js index 695a9c37808..5b4acabd02c 100644 --- a/tests/baselines/reference/functionOverloads1.js +++ b/tests/baselines/reference/functionOverloads1.js @@ -5,6 +5,4 @@ function foo():string { return "a" } //// [functionOverloads1.js] 1 + 1; -function foo() { - return "a"; -} +function foo() { return "a"; } diff --git a/tests/baselines/reference/functionOverloads11.js b/tests/baselines/reference/functionOverloads11.js index efc9c793125..8d85b0ffb7b 100644 --- a/tests/baselines/reference/functionOverloads11.js +++ b/tests/baselines/reference/functionOverloads11.js @@ -4,6 +4,4 @@ function foo():string { return "" } //// [functionOverloads11.js] -function foo() { - return ""; -} +function foo() { return ""; } diff --git a/tests/baselines/reference/functionOverloads12.js b/tests/baselines/reference/functionOverloads12.js index ff789083eeb..4681e43ee5b 100644 --- a/tests/baselines/reference/functionOverloads12.js +++ b/tests/baselines/reference/functionOverloads12.js @@ -5,9 +5,7 @@ function foo():any { if (true) return ""; else return 0;} //// [functionOverloads12.js] -function foo() { - if (true) - return ""; - else - return 0; -} +function foo() { if (true) + return ""; +else + return 0; } diff --git a/tests/baselines/reference/functionOverloads13.js b/tests/baselines/reference/functionOverloads13.js index f9eb4d59e47..ff43c85e3df 100644 --- a/tests/baselines/reference/functionOverloads13.js +++ b/tests/baselines/reference/functionOverloads13.js @@ -5,6 +5,4 @@ function foo(bar?:number):any { return "" } //// [functionOverloads13.js] -function foo(bar) { - return ""; -} +function foo(bar) { return ""; } diff --git a/tests/baselines/reference/functionOverloads14.js b/tests/baselines/reference/functionOverloads14.js index f9a08ecf952..826b096290a 100644 --- a/tests/baselines/reference/functionOverloads14.js +++ b/tests/baselines/reference/functionOverloads14.js @@ -5,6 +5,4 @@ function foo():{a:any;} { return {a:1} } //// [functionOverloads14.js] -function foo() { - return { a: 1 }; -} +function foo() { return { a: 1 }; } diff --git a/tests/baselines/reference/functionOverloads15.js b/tests/baselines/reference/functionOverloads15.js index 2b80df6630c..fe0c90f82af 100644 --- a/tests/baselines/reference/functionOverloads15.js +++ b/tests/baselines/reference/functionOverloads15.js @@ -5,6 +5,4 @@ function foo(foo:{a:string; b?:number;}):any { return "" } //// [functionOverloads15.js] -function foo(foo) { - return ""; -} +function foo(foo) { return ""; } diff --git a/tests/baselines/reference/functionOverloads16.js b/tests/baselines/reference/functionOverloads16.js index ebf82febd16..a0fdaa88894 100644 --- a/tests/baselines/reference/functionOverloads16.js +++ b/tests/baselines/reference/functionOverloads16.js @@ -5,6 +5,4 @@ function foo(foo:{a:string; b?:number;}):any { return "" } //// [functionOverloads16.js] -function foo(foo) { - return ""; -} +function foo(foo) { return ""; } diff --git a/tests/baselines/reference/functionOverloads17.js b/tests/baselines/reference/functionOverloads17.js index d9fa54b744b..3a5dcd81914 100644 --- a/tests/baselines/reference/functionOverloads17.js +++ b/tests/baselines/reference/functionOverloads17.js @@ -4,6 +4,4 @@ function foo():{a:string;} { return {a:""} } //// [functionOverloads17.js] -function foo() { - return { a: "" }; -} +function foo() { return { a: "" }; } diff --git a/tests/baselines/reference/functionOverloads18.js b/tests/baselines/reference/functionOverloads18.js index e1061a32c09..8c196831e48 100644 --- a/tests/baselines/reference/functionOverloads18.js +++ b/tests/baselines/reference/functionOverloads18.js @@ -4,6 +4,4 @@ function foo(bar:{a:string;}) { return {a:""} } //// [functionOverloads18.js] -function foo(bar) { - return { a: "" }; -} +function foo(bar) { return { a: "" }; } diff --git a/tests/baselines/reference/functionOverloads19.js b/tests/baselines/reference/functionOverloads19.js index 6b383225dd0..4183f6a48b8 100644 --- a/tests/baselines/reference/functionOverloads19.js +++ b/tests/baselines/reference/functionOverloads19.js @@ -5,6 +5,4 @@ function foo(bar:{a:any;}) { return {a:""} } //// [functionOverloads19.js] -function foo(bar) { - return { a: "" }; -} +function foo(bar) { return { a: "" }; } diff --git a/tests/baselines/reference/functionOverloads2.js b/tests/baselines/reference/functionOverloads2.js index 7e9eb45d236..39a58663cf4 100644 --- a/tests/baselines/reference/functionOverloads2.js +++ b/tests/baselines/reference/functionOverloads2.js @@ -5,8 +5,6 @@ function foo(bar: any): any { return bar }; var x = foo(true); //// [functionOverloads2.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } ; var x = foo(true); diff --git a/tests/baselines/reference/functionOverloads20.js b/tests/baselines/reference/functionOverloads20.js index 012f2ce09cd..4f259a88538 100644 --- a/tests/baselines/reference/functionOverloads20.js +++ b/tests/baselines/reference/functionOverloads20.js @@ -5,6 +5,4 @@ function foo(bar:{a:any;}): string {return ""} //// [functionOverloads20.js] -function foo(bar) { - return ""; -} +function foo(bar) { return ""; } diff --git a/tests/baselines/reference/functionOverloads21.js b/tests/baselines/reference/functionOverloads21.js index 78fb1fe011f..6e69169efbf 100644 --- a/tests/baselines/reference/functionOverloads21.js +++ b/tests/baselines/reference/functionOverloads21.js @@ -5,6 +5,4 @@ function foo(bar:{a:any; b?:string;}[]) { return 0 } //// [functionOverloads21.js] -function foo(bar) { - return 0; -} +function foo(bar) { return 0; } diff --git a/tests/baselines/reference/functionOverloads22.js b/tests/baselines/reference/functionOverloads22.js index 531c37770b1..54b745d96dd 100644 --- a/tests/baselines/reference/functionOverloads22.js +++ b/tests/baselines/reference/functionOverloads22.js @@ -5,6 +5,4 @@ function foo(bar:any):{a:any;b?:any;}[] { return [{a:""}] } //// [functionOverloads22.js] -function foo(bar) { - return [{ a: "" }]; -} +function foo(bar) { return [{ a: "" }]; } diff --git a/tests/baselines/reference/functionOverloads23.js b/tests/baselines/reference/functionOverloads23.js index d8cac7eb8ee..aa3a7172ada 100644 --- a/tests/baselines/reference/functionOverloads23.js +++ b/tests/baselines/reference/functionOverloads23.js @@ -5,6 +5,4 @@ function foo(bar:(a?)=>void) { return 0 } //// [functionOverloads23.js] -function foo(bar) { - return 0; -} +function foo(bar) { return 0; } diff --git a/tests/baselines/reference/functionOverloads24.js b/tests/baselines/reference/functionOverloads24.js index c7255063174..8fcc3c81902 100644 --- a/tests/baselines/reference/functionOverloads24.js +++ b/tests/baselines/reference/functionOverloads24.js @@ -5,6 +5,4 @@ function foo(bar:any):(a)=>void { return function(){} } //// [functionOverloads24.js] -function foo(bar) { - return function () { }; -} +function foo(bar) { return function () { }; } diff --git a/tests/baselines/reference/functionOverloads25.js b/tests/baselines/reference/functionOverloads25.js index bbaef498926..d466aa82d21 100644 --- a/tests/baselines/reference/functionOverloads25.js +++ b/tests/baselines/reference/functionOverloads25.js @@ -6,8 +6,6 @@ var x = foo(); //// [functionOverloads25.js] -function foo(bar) { - return ''; -} +function foo(bar) { return ''; } ; var x = foo(); diff --git a/tests/baselines/reference/functionOverloads26.js b/tests/baselines/reference/functionOverloads26.js index 088c06147ba..bc4d017b9bb 100644 --- a/tests/baselines/reference/functionOverloads26.js +++ b/tests/baselines/reference/functionOverloads26.js @@ -6,7 +6,5 @@ var x = foo('baz'); //// [functionOverloads26.js] -function foo(bar) { - return ''; -} +function foo(bar) { return ''; } var x = foo('baz'); diff --git a/tests/baselines/reference/functionOverloads27.js b/tests/baselines/reference/functionOverloads27.js index 2b11b1f6c4e..199905d8219 100644 --- a/tests/baselines/reference/functionOverloads27.js +++ b/tests/baselines/reference/functionOverloads27.js @@ -6,7 +6,5 @@ var x = foo(5); //// [functionOverloads27.js] -function foo(bar) { - return ''; -} +function foo(bar) { return ''; } var x = foo(5); diff --git a/tests/baselines/reference/functionOverloads28.js b/tests/baselines/reference/functionOverloads28.js index 566972ee25d..d10ef52e2b2 100644 --- a/tests/baselines/reference/functionOverloads28.js +++ b/tests/baselines/reference/functionOverloads28.js @@ -6,8 +6,6 @@ var t:any; var x = foo(t); //// [functionOverloads28.js] -function foo(bar) { - return ''; -} +function foo(bar) { return ''; } var t; var x = foo(t); diff --git a/tests/baselines/reference/functionOverloads29.js b/tests/baselines/reference/functionOverloads29.js index c828bb95917..edc1ea178bc 100644 --- a/tests/baselines/reference/functionOverloads29.js +++ b/tests/baselines/reference/functionOverloads29.js @@ -6,7 +6,5 @@ var x = foo(); //// [functionOverloads29.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(); diff --git a/tests/baselines/reference/functionOverloads30.js b/tests/baselines/reference/functionOverloads30.js index 27b1436b6fb..bc7593a0771 100644 --- a/tests/baselines/reference/functionOverloads30.js +++ b/tests/baselines/reference/functionOverloads30.js @@ -6,7 +6,5 @@ var x = foo('bar'); //// [functionOverloads30.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo('bar'); diff --git a/tests/baselines/reference/functionOverloads31.js b/tests/baselines/reference/functionOverloads31.js index 01cee2c342b..2c2a15821a7 100644 --- a/tests/baselines/reference/functionOverloads31.js +++ b/tests/baselines/reference/functionOverloads31.js @@ -6,7 +6,5 @@ var x = foo(5); //// [functionOverloads31.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(5); diff --git a/tests/baselines/reference/functionOverloads32.js b/tests/baselines/reference/functionOverloads32.js index 4e0efa98b09..a5557042dfb 100644 --- a/tests/baselines/reference/functionOverloads32.js +++ b/tests/baselines/reference/functionOverloads32.js @@ -6,8 +6,6 @@ var baz:number; var x = foo(baz); //// [functionOverloads32.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var baz; var x = foo(baz); diff --git a/tests/baselines/reference/functionOverloads33.js b/tests/baselines/reference/functionOverloads33.js index 0c01cd54d1e..98bcc09b8b4 100644 --- a/tests/baselines/reference/functionOverloads33.js +++ b/tests/baselines/reference/functionOverloads33.js @@ -6,7 +6,5 @@ var x = foo(5); //// [functionOverloads33.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(5); diff --git a/tests/baselines/reference/functionOverloads34.js b/tests/baselines/reference/functionOverloads34.js index 48ac2b5fc59..3d4311e4193 100644 --- a/tests/baselines/reference/functionOverloads34.js +++ b/tests/baselines/reference/functionOverloads34.js @@ -6,7 +6,5 @@ var x = foo(); //// [functionOverloads34.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(); diff --git a/tests/baselines/reference/functionOverloads35.js b/tests/baselines/reference/functionOverloads35.js index fa373a9ee52..b25ac6c3c5f 100644 --- a/tests/baselines/reference/functionOverloads35.js +++ b/tests/baselines/reference/functionOverloads35.js @@ -6,7 +6,5 @@ var x = foo({a:1}); //// [functionOverloads35.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo({ a: 1 }); diff --git a/tests/baselines/reference/functionOverloads36.js b/tests/baselines/reference/functionOverloads36.js index 33f6156c66b..4e790917d93 100644 --- a/tests/baselines/reference/functionOverloads36.js +++ b/tests/baselines/reference/functionOverloads36.js @@ -6,7 +6,5 @@ var x = foo({a:'foo'}); //// [functionOverloads36.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo({ a: 'foo' }); diff --git a/tests/baselines/reference/functionOverloads37.js b/tests/baselines/reference/functionOverloads37.js index f9e6130dbd9..c4e0d4fd18b 100644 --- a/tests/baselines/reference/functionOverloads37.js +++ b/tests/baselines/reference/functionOverloads37.js @@ -6,7 +6,5 @@ var x = foo(); //// [functionOverloads37.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo(); diff --git a/tests/baselines/reference/functionOverloads38.js b/tests/baselines/reference/functionOverloads38.js index 410b4358ede..c973cbe7b67 100644 --- a/tests/baselines/reference/functionOverloads38.js +++ b/tests/baselines/reference/functionOverloads38.js @@ -6,7 +6,5 @@ var x = foo([{a:1}]); //// [functionOverloads38.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{ a: 1 }]); diff --git a/tests/baselines/reference/functionOverloads39.js b/tests/baselines/reference/functionOverloads39.js index 771a3148036..ad4ded394d8 100644 --- a/tests/baselines/reference/functionOverloads39.js +++ b/tests/baselines/reference/functionOverloads39.js @@ -6,7 +6,5 @@ var x = foo([{a:true}]); //// [functionOverloads39.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{ a: true }]); diff --git a/tests/baselines/reference/functionOverloads4.js b/tests/baselines/reference/functionOverloads4.js index b428f6938b4..3a1ff2ced33 100644 --- a/tests/baselines/reference/functionOverloads4.js +++ b/tests/baselines/reference/functionOverloads4.js @@ -3,6 +3,4 @@ function foo():number; function foo():string { return "a" } //// [functionOverloads4.js] -function foo() { - return "a"; -} +function foo() { return "a"; } diff --git a/tests/baselines/reference/functionOverloads40.js b/tests/baselines/reference/functionOverloads40.js index f718f0a8847..11edff26a4b 100644 --- a/tests/baselines/reference/functionOverloads40.js +++ b/tests/baselines/reference/functionOverloads40.js @@ -6,7 +6,5 @@ var x = foo([{a:'bar'}]); //// [functionOverloads40.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{ a: 'bar' }]); diff --git a/tests/baselines/reference/functionOverloads41.js b/tests/baselines/reference/functionOverloads41.js index 566ef21424f..dd730e25b31 100644 --- a/tests/baselines/reference/functionOverloads41.js +++ b/tests/baselines/reference/functionOverloads41.js @@ -6,7 +6,5 @@ var x = foo([{}]); //// [functionOverloads41.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{}]); diff --git a/tests/baselines/reference/functionOverloads42.js b/tests/baselines/reference/functionOverloads42.js index fcca395581c..979bfa86d62 100644 --- a/tests/baselines/reference/functionOverloads42.js +++ b/tests/baselines/reference/functionOverloads42.js @@ -6,7 +6,5 @@ var x = foo([{a:'s'}]); //// [functionOverloads42.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } var x = foo([{ a: 's' }]); diff --git a/tests/baselines/reference/functionOverloads7.js b/tests/baselines/reference/functionOverloads7.js index 52cac83af72..540abf9eb8c 100644 --- a/tests/baselines/reference/functionOverloads7.js +++ b/tests/baselines/reference/functionOverloads7.js @@ -14,9 +14,7 @@ class foo { var foo = (function () { function foo() { } - foo.prototype.bar = function (foo) { - return "foo"; - }; + foo.prototype.bar = function (foo) { return "foo"; }; foo.prototype.n = function () { var foo = this.bar(); foo = this.bar("test"); diff --git a/tests/baselines/reference/functionOverloads8.js b/tests/baselines/reference/functionOverloads8.js index 08c2c0b65a1..55539a61659 100644 --- a/tests/baselines/reference/functionOverloads8.js +++ b/tests/baselines/reference/functionOverloads8.js @@ -5,6 +5,4 @@ function foo(foo?:any){ return '' } //// [functionOverloads8.js] -function foo(foo) { - return ''; -} +function foo(foo) { return ''; } diff --git a/tests/baselines/reference/functionOverloads9.js b/tests/baselines/reference/functionOverloads9.js index 53cc0385a59..9d2ae21f4fa 100644 --- a/tests/baselines/reference/functionOverloads9.js +++ b/tests/baselines/reference/functionOverloads9.js @@ -5,8 +5,6 @@ var x = foo('foo'); //// [functionOverloads9.js] -function foo(foo) { - return ''; -} +function foo(foo) { return ''; } ; var x = foo('foo'); diff --git a/tests/baselines/reference/functionReturn.js b/tests/baselines/reference/functionReturn.js index fbb889589a0..c433eec190d 100644 --- a/tests/baselines/reference/functionReturn.js +++ b/tests/baselines/reference/functionReturn.js @@ -20,9 +20,7 @@ function f1() { var n = f0(); } function f2() { } -function f3() { - return; -} +function f3() { return; } function f4() { return ''; return; diff --git a/tests/baselines/reference/generatedContextualTyping.js b/tests/baselines/reference/generatedContextualTyping.js index 68cc22ff45e..0337ab8f1a1 100644 --- a/tests/baselines/reference/generatedContextualTyping.js +++ b/tests/baselines/reference/generatedContextualTyping.js @@ -382,30 +382,17 @@ var Derived2 = (function (_super) { })(Base); var b = new Base(), d1 = new Derived1(), d2 = new Derived2(); var x1 = function () { return [d1, d2]; }; -var x2 = function () { - return [d1, d2]; -}; -var x3 = function named() { - return [d1, d2]; -}; +var x2 = function () { return [d1, d2]; }; +var x3 = function named() { return [d1, d2]; }; var x4 = function () { return [d1, d2]; }; -var x5 = function () { - return [d1, d2]; -}; -var x6 = function named() { - return [d1, d2]; -}; +var x5 = function () { return [d1, d2]; }; +var x6 = function named() { return [d1, d2]; }; var x7 = [d1, d2]; var x8 = [d1, d2]; var x9 = [d1, d2]; var x10 = { n: [d1, d2] }; -var x11 = function (n) { - var n; - return null; -}; -var x12 = { func: function (n) { - return [d1, d2]; -} }; +var x11 = function (n) { var n; return null; }; +var x12 = { func: function (n) { return [d1, d2]; } }; var x13 = (function () { function x13() { this.member = function () { return [d1, d2]; }; @@ -414,17 +401,13 @@ var x13 = (function () { })(); var x14 = (function () { function x14() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x14; })(); var x15 = (function () { function x15() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x15; })(); @@ -436,17 +419,13 @@ var x16 = (function () { })(); var x17 = (function () { function x17() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x17; })(); var x18 = (function () { function x18() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x18; })(); @@ -476,18 +455,13 @@ var x22 = (function () { })(); var x23 = (function () { function x23() { - this.member = function (n) { - var n; - return null; - }; + this.member = function (n) { var n; return null; }; } return x23; })(); var x24 = (function () { function x24() { - this.member = { func: function (n) { - return [d1, d2]; - } }; + this.member = { func: function (n) { return [d1, d2]; } }; } return x24; })(); @@ -499,17 +473,13 @@ var x25 = (function () { })(); var x26 = (function () { function x26() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x26; })(); var x27 = (function () { function x27() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x27; })(); @@ -521,17 +491,13 @@ var x28 = (function () { })(); var x29 = (function () { function x29() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x29; })(); var x30 = (function () { function x30() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x30; })(); @@ -561,18 +527,13 @@ var x34 = (function () { })(); var x35 = (function () { function x35() { - this.member = function (n) { - var n; - return null; - }; + this.member = function (n) { var n; return null; }; } return x35; })(); var x36 = (function () { function x36() { - this.member = { func: function (n) { - return [d1, d2]; - } }; + this.member = { func: function (n) { return [d1, d2]; } }; } return x36; })(); @@ -584,17 +545,13 @@ var x37 = (function () { })(); var x38 = (function () { function x38() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x38; })(); var x39 = (function () { function x39() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x39; })(); @@ -606,17 +563,13 @@ var x40 = (function () { })(); var x41 = (function () { function x41() { - this.member = function () { - return [d1, d2]; - }; + this.member = function () { return [d1, d2]; }; } return x41; })(); var x42 = (function () { function x42() { - this.member = function named() { - return [d1, d2]; - }; + this.member = function named() { return [d1, d2]; }; } return x42; })(); @@ -646,18 +599,13 @@ var x46 = (function () { })(); var x47 = (function () { function x47() { - this.member = function (n) { - var n; - return null; - }; + this.member = function (n) { var n; return null; }; } return x47; })(); var x48 = (function () { function x48() { - this.member = { func: function (n) { - return [d1, d2]; - } }; + this.member = { func: function (n) { return [d1, d2]; } }; } return x48; })(); @@ -670,17 +618,13 @@ var x49 = (function () { var x50 = (function () { function x50() { } - x50.member = function () { - return [d1, d2]; - }; + x50.member = function () { return [d1, d2]; }; return x50; })(); var x51 = (function () { function x51() { } - x51.member = function named() { - return [d1, d2]; - }; + x51.member = function named() { return [d1, d2]; }; return x51; })(); var x52 = (function () { @@ -692,17 +636,13 @@ var x52 = (function () { var x53 = (function () { function x53() { } - x53.member = function () { - return [d1, d2]; - }; + x53.member = function () { return [d1, d2]; }; return x53; })(); var x54 = (function () { function x54() { } - x54.member = function named() { - return [d1, d2]; - }; + x54.member = function named() { return [d1, d2]; }; return x54; })(); var x55 = (function () { @@ -732,18 +672,13 @@ var x58 = (function () { var x59 = (function () { function x59() { } - x59.member = function (n) { - var n; - return null; - }; + x59.member = function (n) { var n; return null; }; return x59; })(); var x60 = (function () { function x60() { } - x60.member = { func: function (n) { - return [d1, d2]; - } }; + x60.member = { func: function (n) { return [d1, d2]; } }; return x60; })(); var x61 = (function () { @@ -755,17 +690,13 @@ var x61 = (function () { var x62 = (function () { function x62() { } - x62.member = function () { - return [d1, d2]; - }; + x62.member = function () { return [d1, d2]; }; return x62; })(); var x63 = (function () { function x63() { } - x63.member = function named() { - return [d1, d2]; - }; + x63.member = function named() { return [d1, d2]; }; return x63; })(); var x64 = (function () { @@ -777,17 +708,13 @@ var x64 = (function () { var x65 = (function () { function x65() { } - x65.member = function () { - return [d1, d2]; - }; + x65.member = function () { return [d1, d2]; }; return x65; })(); var x66 = (function () { function x66() { } - x66.member = function named() { - return [d1, d2]; - }; + x66.member = function named() { return [d1, d2]; }; return x66; })(); var x67 = (function () { @@ -817,18 +744,13 @@ var x70 = (function () { var x71 = (function () { function x71() { } - x71.member = function (n) { - var n; - return null; - }; + x71.member = function (n) { var n; return null; }; return x71; })(); var x72 = (function () { function x72() { } - x72.member = { func: function (n) { - return [d1, d2]; - } }; + x72.member = { func: function (n) { return [d1, d2]; } }; return x72; })(); var x73 = (function () { @@ -840,17 +762,13 @@ var x73 = (function () { var x74 = (function () { function x74() { } - x74.member = function () { - return [d1, d2]; - }; + x74.member = function () { return [d1, d2]; }; return x74; })(); var x75 = (function () { function x75() { } - x75.member = function named() { - return [d1, d2]; - }; + x75.member = function named() { return [d1, d2]; }; return x75; })(); var x76 = (function () { @@ -862,17 +780,13 @@ var x76 = (function () { var x77 = (function () { function x77() { } - x77.member = function () { - return [d1, d2]; - }; + x77.member = function () { return [d1, d2]; }; return x77; })(); var x78 = (function () { function x78() { } - x78.member = function named() { - return [d1, d2]; - }; + x78.member = function named() { return [d1, d2]; }; return x78; })(); var x79 = (function () { @@ -902,18 +816,13 @@ var x82 = (function () { var x83 = (function () { function x83() { } - x83.member = function (n) { - var n; - return null; - }; + x83.member = function (n) { var n; return null; }; return x83; })(); var x84 = (function () { function x84() { } - x84.member = { func: function (n) { - return [d1, d2]; - } }; + x84.member = { func: function (n) { return [d1, d2]; } }; return x84; })(); var x85 = (function () { @@ -924,17 +833,13 @@ var x85 = (function () { })(); var x86 = (function () { function x86(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } } return x86; })(); var x87 = (function () { function x87(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } } return x87; })(); @@ -946,17 +851,13 @@ var x88 = (function () { })(); var x89 = (function () { function x89(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } } return x89; })(); var x90 = (function () { function x90(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } } return x90; })(); @@ -986,18 +887,13 @@ var x94 = (function () { })(); var x95 = (function () { function x95(parm) { - if (parm === void 0) { parm = function (n) { - var n; - return null; - }; } + if (parm === void 0) { parm = function (n) { var n; return null; }; } } return x95; })(); var x96 = (function () { function x96(parm) { - if (parm === void 0) { parm = { func: function (n) { - return [d1, d2]; - } }; } + if (parm === void 0) { parm = { func: function (n) { return [d1, d2]; } }; } } return x96; })(); @@ -1010,18 +906,14 @@ var x97 = (function () { })(); var x98 = (function () { function x98(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } this.parm = parm; } return x98; })(); var x99 = (function () { function x99(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } this.parm = parm; } return x99; @@ -1035,18 +927,14 @@ var x100 = (function () { })(); var x101 = (function () { function x101(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } this.parm = parm; } return x101; })(); var x102 = (function () { function x102(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } this.parm = parm; } return x102; @@ -1081,19 +969,14 @@ var x106 = (function () { })(); var x107 = (function () { function x107(parm) { - if (parm === void 0) { parm = function (n) { - var n; - return null; - }; } + if (parm === void 0) { parm = function (n) { var n; return null; }; } this.parm = parm; } return x107; })(); var x108 = (function () { function x108(parm) { - if (parm === void 0) { parm = { func: function (n) { - return [d1, d2]; - } }; } + if (parm === void 0) { parm = { func: function (n) { return [d1, d2]; } }; } this.parm = parm; } return x108; @@ -1107,18 +990,14 @@ var x109 = (function () { })(); var x110 = (function () { function x110(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } this.parm = parm; } return x110; })(); var x111 = (function () { function x111(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } this.parm = parm; } return x111; @@ -1132,18 +1011,14 @@ var x112 = (function () { })(); var x113 = (function () { function x113(parm) { - if (parm === void 0) { parm = function () { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function () { return [d1, d2]; }; } this.parm = parm; } return x113; })(); var x114 = (function () { function x114(parm) { - if (parm === void 0) { parm = function named() { - return [d1, d2]; - }; } + if (parm === void 0) { parm = function named() { return [d1, d2]; }; } this.parm = parm; } return x114; @@ -1178,19 +1053,14 @@ var x118 = (function () { })(); var x119 = (function () { function x119(parm) { - if (parm === void 0) { parm = function (n) { - var n; - return null; - }; } + if (parm === void 0) { parm = function (n) { var n; return null; }; } this.parm = parm; } return x119; })(); var x120 = (function () { function x120(parm) { - if (parm === void 0) { parm = { func: function (n) { - return [d1, d2]; - } }; } + if (parm === void 0) { parm = { func: function (n) { return [d1, d2]; } }; } this.parm = parm; } return x120; @@ -1207,242 +1077,65 @@ function x129(parm) { } function x130(parm) { } function x131(parm) { } function x132(parm) { } -function x133() { - return function () { return [d1, d2]; }; -} -function x134() { - return function () { - return [d1, d2]; - }; -} -function x135() { - return function named() { - return [d1, d2]; - }; -} -function x136() { - return function () { return [d1, d2]; }; -} -function x137() { - return function () { - return [d1, d2]; - }; -} -function x138() { - return function named() { - return [d1, d2]; - }; -} -function x139() { - return [d1, d2]; -} -function x140() { - return [d1, d2]; -} -function x141() { - return [d1, d2]; -} -function x142() { - return { n: [d1, d2] }; -} -function x143() { - return function (n) { - var n; - return null; - }; -} -function x144() { - return { func: function (n) { - return [d1, d2]; - } }; -} -function x145() { - return function () { return [d1, d2]; }; - return function () { return [d1, d2]; }; -} -function x146() { - return function () { - return [d1, d2]; - }; - return function () { - return [d1, d2]; - }; -} -function x147() { - return function named() { - return [d1, d2]; - }; - return function named() { - return [d1, d2]; - }; -} -function x148() { - return function () { return [d1, d2]; }; - return function () { return [d1, d2]; }; -} -function x149() { - return function () { - return [d1, d2]; - }; - return function () { - return [d1, d2]; - }; -} -function x150() { - return function named() { - return [d1, d2]; - }; - return function named() { - return [d1, d2]; - }; -} -function x151() { - return [d1, d2]; - return [d1, d2]; -} -function x152() { - return [d1, d2]; - return [d1, d2]; -} -function x153() { - return [d1, d2]; - return [d1, d2]; -} -function x154() { - return { n: [d1, d2] }; - return { n: [d1, d2] }; -} -function x155() { - return function (n) { - var n; - return null; - }; - return function (n) { - var n; - return null; - }; -} -function x156() { - return { func: function (n) { - return [d1, d2]; - } }; - return { func: function (n) { - return [d1, d2]; - } }; -} -var x157 = function () { - return function () { return [d1, d2]; }; -}; -var x158 = function () { - return function () { - return [d1, d2]; - }; -}; -var x159 = function () { - return function named() { - return [d1, d2]; - }; -}; -var x160 = function () { - return function () { return [d1, d2]; }; -}; -var x161 = function () { - return function () { - return [d1, d2]; - }; -}; -var x162 = function () { - return function named() { - return [d1, d2]; - }; -}; -var x163 = function () { - return [d1, d2]; -}; -var x164 = function () { - return [d1, d2]; -}; -var x165 = function () { - return [d1, d2]; -}; -var x166 = function () { - return { n: [d1, d2] }; -}; -var x167 = function () { - return function (n) { - var n; - return null; - }; -}; -var x168 = function () { - return { func: function (n) { - return [d1, d2]; - } }; -}; -var x169 = function () { - return function () { return [d1, d2]; }; -}; -var x170 = function () { - return function () { - return [d1, d2]; - }; -}; -var x171 = function () { - return function named() { - return [d1, d2]; - }; -}; -var x172 = function () { - return function () { return [d1, d2]; }; -}; -var x173 = function () { - return function () { - return [d1, d2]; - }; -}; -var x174 = function () { - return function named() { - return [d1, d2]; - }; -}; -var x175 = function () { - return [d1, d2]; -}; -var x176 = function () { - return [d1, d2]; -}; -var x177 = function () { - return [d1, d2]; -}; -var x178 = function () { - return { n: [d1, d2] }; -}; -var x179 = function () { - return function (n) { - var n; - return null; - }; -}; -var x180 = function () { - return { func: function (n) { - return [d1, d2]; - } }; -}; +function x133() { return function () { return [d1, d2]; }; } +function x134() { return function () { return [d1, d2]; }; } +function x135() { return function named() { return [d1, d2]; }; } +function x136() { return function () { return [d1, d2]; }; } +function x137() { return function () { return [d1, d2]; }; } +function x138() { return function named() { return [d1, d2]; }; } +function x139() { return [d1, d2]; } +function x140() { return [d1, d2]; } +function x141() { return [d1, d2]; } +function x142() { return { n: [d1, d2] }; } +function x143() { return function (n) { var n; return null; }; } +function x144() { return { func: function (n) { return [d1, d2]; } }; } +function x145() { return function () { return [d1, d2]; }; return function () { return [d1, d2]; }; } +function x146() { return function () { return [d1, d2]; }; return function () { return [d1, d2]; }; } +function x147() { return function named() { return [d1, d2]; }; return function named() { return [d1, d2]; }; } +function x148() { return function () { return [d1, d2]; }; return function () { return [d1, d2]; }; } +function x149() { return function () { return [d1, d2]; }; return function () { return [d1, d2]; }; } +function x150() { return function named() { return [d1, d2]; }; return function named() { return [d1, d2]; }; } +function x151() { return [d1, d2]; return [d1, d2]; } +function x152() { return [d1, d2]; return [d1, d2]; } +function x153() { return [d1, d2]; return [d1, d2]; } +function x154() { return { n: [d1, d2] }; return { n: [d1, d2] }; } +function x155() { return function (n) { var n; return null; }; return function (n) { var n; return null; }; } +function x156() { return { func: function (n) { return [d1, d2]; } }; return { func: function (n) { return [d1, d2]; } }; } +var x157 = function () { return function () { return [d1, d2]; }; }; +var x158 = function () { return function () { return [d1, d2]; }; }; +var x159 = function () { return function named() { return [d1, d2]; }; }; +var x160 = function () { return function () { return [d1, d2]; }; }; +var x161 = function () { return function () { return [d1, d2]; }; }; +var x162 = function () { return function named() { return [d1, d2]; }; }; +var x163 = function () { return [d1, d2]; }; +var x164 = function () { return [d1, d2]; }; +var x165 = function () { return [d1, d2]; }; +var x166 = function () { return { n: [d1, d2] }; }; +var x167 = function () { return function (n) { var n; return null; }; }; +var x168 = function () { return { func: function (n) { return [d1, d2]; } }; }; +var x169 = function () { return function () { return [d1, d2]; }; }; +var x170 = function () { return function () { return [d1, d2]; }; }; +var x171 = function () { return function named() { return [d1, d2]; }; }; +var x172 = function () { return function () { return [d1, d2]; }; }; +var x173 = function () { return function () { return [d1, d2]; }; }; +var x174 = function () { return function named() { return [d1, d2]; }; }; +var x175 = function () { return [d1, d2]; }; +var x176 = function () { return [d1, d2]; }; +var x177 = function () { return [d1, d2]; }; +var x178 = function () { return { n: [d1, d2] }; }; +var x179 = function () { return function (n) { var n; return null; }; }; +var x180 = function () { return { func: function (n) { return [d1, d2]; } }; }; var x181; (function (x181) { var t = function () { return [d1, d2]; }; })(x181 || (x181 = {})); var x182; (function (x182) { - var t = function () { - return [d1, d2]; - }; + var t = function () { return [d1, d2]; }; })(x182 || (x182 = {})); var x183; (function (x183) { - var t = function named() { - return [d1, d2]; - }; + var t = function named() { return [d1, d2]; }; })(x183 || (x183 = {})); var x184; (function (x184) { @@ -1450,15 +1143,11 @@ var x184; })(x184 || (x184 = {})); var x185; (function (x185) { - var t = function () { - return [d1, d2]; - }; + var t = function () { return [d1, d2]; }; })(x185 || (x185 = {})); var x186; (function (x186) { - var t = function named() { - return [d1, d2]; - }; + var t = function named() { return [d1, d2]; }; })(x186 || (x186 = {})); var x187; (function (x187) { @@ -1478,16 +1167,11 @@ var x190; })(x190 || (x190 = {})); var x191; (function (x191) { - var t = function (n) { - var n; - return null; - }; + var t = function (n) { var n; return null; }; })(x191 || (x191 = {})); var x192; (function (x192) { - var t = { func: function (n) { - return [d1, d2]; - } }; + var t = { func: function (n) { return [d1, d2]; } }; })(x192 || (x192 = {})); var x193; (function (x193) { @@ -1495,15 +1179,11 @@ var x193; })(x193 || (x193 = {})); var x194; (function (x194) { - x194.t = function () { - return [d1, d2]; - }; + x194.t = function () { return [d1, d2]; }; })(x194 || (x194 = {})); var x195; (function (x195) { - x195.t = function named() { - return [d1, d2]; - }; + x195.t = function named() { return [d1, d2]; }; })(x195 || (x195 = {})); var x196; (function (x196) { @@ -1511,15 +1191,11 @@ var x196; })(x196 || (x196 = {})); var x197; (function (x197) { - x197.t = function () { - return [d1, d2]; - }; + x197.t = function () { return [d1, d2]; }; })(x197 || (x197 = {})); var x198; (function (x198) { - x198.t = function named() { - return [d1, d2]; - }; + x198.t = function named() { return [d1, d2]; }; })(x198 || (x198 = {})); var x199; (function (x199) { @@ -1539,48 +1215,25 @@ var x202; })(x202 || (x202 = {})); var x203; (function (x203) { - x203.t = function (n) { - var n; - return null; - }; + x203.t = function (n) { var n; return null; }; })(x203 || (x203 = {})); var x204; (function (x204) { - x204.t = { func: function (n) { - return [d1, d2]; - } }; + x204.t = { func: function (n) { return [d1, d2]; } }; })(x204 || (x204 = {})); -var x206 = function () { - return [d1, d2]; -}; -var x207 = function named() { - return [d1, d2]; -}; -var x209 = function () { - return [d1, d2]; -}; -var x210 = function named() { - return [d1, d2]; -}; +var x206 = function () { return [d1, d2]; }; +var x207 = function named() { return [d1, d2]; }; +var x209 = function () { return [d1, d2]; }; +var x210 = function named() { return [d1, d2]; }; var x211 = [d1, d2]; var x212 = [d1, d2]; var x213 = [d1, d2]; var x214 = { n: [d1, d2] }; -var x216 = { func: function (n) { - return [d1, d2]; -} }; -var x217 = undefined || function () { - return [d1, d2]; -}; -var x218 = undefined || function named() { - return [d1, d2]; -}; -var x219 = undefined || function () { - return [d1, d2]; -}; -var x220 = undefined || function named() { - return [d1, d2]; -}; +var x216 = { func: function (n) { return [d1, d2]; } }; +var x217 = undefined || function () { return [d1, d2]; }; +var x218 = undefined || function named() { return [d1, d2]; }; +var x219 = undefined || function () { return [d1, d2]; }; +var x220 = undefined || function named() { return [d1, d2]; }; var x221 = undefined || [d1, d2]; var x222 = undefined || [d1, d2]; var x223 = undefined || [d1, d2]; @@ -1588,23 +1241,15 @@ var x224 = undefined || { n: [d1, d2] }; var x225; x225 = function () { return [d1, d2]; }; var x226; -x226 = function () { - return [d1, d2]; -}; +x226 = function () { return [d1, d2]; }; var x227; -x227 = function named() { - return [d1, d2]; -}; +x227 = function named() { return [d1, d2]; }; var x228; x228 = function () { return [d1, d2]; }; var x229; -x229 = function () { - return [d1, d2]; -}; +x229 = function () { return [d1, d2]; }; var x230; -x230 = function named() { - return [d1, d2]; -}; +x230 = function named() { return [d1, d2]; }; var x231; x231 = [d1, d2]; var x232; @@ -1614,223 +1259,107 @@ x233 = [d1, d2]; var x234; x234 = { n: [d1, d2] }; var x235; -x235 = function (n) { - var n; - return null; -}; +x235 = function (n) { var n; return null; }; var x236; -x236 = { func: function (n) { - return [d1, d2]; -} }; +x236 = { func: function (n) { return [d1, d2]; } }; var x237 = { n: function () { return [d1, d2]; } }; -var x238 = { n: function () { - return [d1, d2]; -} }; -var x239 = { n: function named() { - return [d1, d2]; -} }; +var x238 = { n: function () { return [d1, d2]; } }; +var x239 = { n: function named() { return [d1, d2]; } }; var x240 = { n: function () { return [d1, d2]; } }; -var x241 = { n: function () { - return [d1, d2]; -} }; -var x242 = { n: function named() { - return [d1, d2]; -} }; +var x241 = { n: function () { return [d1, d2]; } }; +var x242 = { n: function named() { return [d1, d2]; } }; var x243 = { n: [d1, d2] }; var x244 = { n: [d1, d2] }; var x245 = { n: [d1, d2] }; var x246 = { n: { n: [d1, d2] } }; -var x247 = { n: function (n) { - var n; - return null; -} }; -var x248 = { n: { func: function (n) { - return [d1, d2]; -} } }; +var x247 = { n: function (n) { var n; return null; } }; +var x248 = { n: { func: function (n) { return [d1, d2]; } } }; var x252 = [function () { return [d1, d2]; }]; -var x253 = [function () { - return [d1, d2]; -}]; -var x254 = [function named() { - return [d1, d2]; -}]; +var x253 = [function () { return [d1, d2]; }]; +var x254 = [function named() { return [d1, d2]; }]; var x255 = [[d1, d2]]; var x256 = [[d1, d2]]; var x257 = [[d1, d2]]; var x258 = [{ n: [d1, d2] }]; -var x260 = [{ func: function (n) { - return [d1, d2]; -} }]; -var x261 = function () { - return [d1, d2]; -} || undefined; -var x262 = function named() { - return [d1, d2]; -} || undefined; -var x263 = function () { - return [d1, d2]; -} || undefined; -var x264 = function named() { - return [d1, d2]; -} || undefined; +var x260 = [{ func: function (n) { return [d1, d2]; } }]; +var x261 = function () { return [d1, d2]; } || undefined; +var x262 = function named() { return [d1, d2]; } || undefined; +var x263 = function () { return [d1, d2]; } || undefined; +var x264 = function named() { return [d1, d2]; } || undefined; var x265 = [d1, d2] || undefined; var x266 = [d1, d2] || undefined; var x267 = [d1, d2] || undefined; var x268 = { n: [d1, d2] } || undefined; -var x269 = undefined || function () { - return [d1, d2]; -}; -var x270 = undefined || function named() { - return [d1, d2]; -}; -var x271 = undefined || function () { - return [d1, d2]; -}; -var x272 = undefined || function named() { - return [d1, d2]; -}; +var x269 = undefined || function () { return [d1, d2]; }; +var x270 = undefined || function named() { return [d1, d2]; }; +var x271 = undefined || function () { return [d1, d2]; }; +var x272 = undefined || function named() { return [d1, d2]; }; var x273 = undefined || [d1, d2]; var x274 = undefined || [d1, d2]; var x275 = undefined || [d1, d2]; var x276 = undefined || { n: [d1, d2] }; -var x277 = function () { - return [d1, d2]; -} || function () { - return [d1, d2]; -}; -var x278 = function named() { - return [d1, d2]; -} || function named() { - return [d1, d2]; -}; -var x279 = function () { - return [d1, d2]; -} || function () { - return [d1, d2]; -}; -var x280 = function named() { - return [d1, d2]; -} || function named() { - return [d1, d2]; -}; +var x277 = function () { return [d1, d2]; } || function () { return [d1, d2]; }; +var x278 = function named() { return [d1, d2]; } || function named() { return [d1, d2]; }; +var x279 = function () { return [d1, d2]; } || function () { return [d1, d2]; }; +var x280 = function named() { return [d1, d2]; } || function named() { return [d1, d2]; }; var x281 = [d1, d2] || [d1, d2]; var x282 = [d1, d2] || [d1, d2]; var x283 = [d1, d2] || [d1, d2]; var x284 = { n: [d1, d2] } || { n: [d1, d2] }; var x285 = true ? function () { return [d1, d2]; } : function () { return [d1, d2]; }; -var x286 = true ? function () { - return [d1, d2]; -} : function () { - return [d1, d2]; -}; -var x287 = true ? function named() { - return [d1, d2]; -} : function named() { - return [d1, d2]; -}; +var x286 = true ? function () { return [d1, d2]; } : function () { return [d1, d2]; }; +var x287 = true ? function named() { return [d1, d2]; } : function named() { return [d1, d2]; }; var x288 = true ? function () { return [d1, d2]; } : function () { return [d1, d2]; }; -var x289 = true ? function () { - return [d1, d2]; -} : function () { - return [d1, d2]; -}; -var x290 = true ? function named() { - return [d1, d2]; -} : function named() { - return [d1, d2]; -}; +var x289 = true ? function () { return [d1, d2]; } : function () { return [d1, d2]; }; +var x290 = true ? function named() { return [d1, d2]; } : function named() { return [d1, d2]; }; var x291 = true ? [d1, d2] : [d1, d2]; var x292 = true ? [d1, d2] : [d1, d2]; var x293 = true ? [d1, d2] : [d1, d2]; var x294 = true ? { n: [d1, d2] } : { n: [d1, d2] }; -var x295 = true ? function (n) { - var n; - return null; -} : function (n) { - var n; - return null; -}; -var x296 = true ? { func: function (n) { - return [d1, d2]; -} } : { func: function (n) { - return [d1, d2]; -} }; +var x295 = true ? function (n) { var n; return null; } : function (n) { var n; return null; }; +var x296 = true ? { func: function (n) { return [d1, d2]; } } : { func: function (n) { return [d1, d2]; } }; var x297 = true ? undefined : function () { return [d1, d2]; }; -var x298 = true ? undefined : function () { - return [d1, d2]; -}; -var x299 = true ? undefined : function named() { - return [d1, d2]; -}; +var x298 = true ? undefined : function () { return [d1, d2]; }; +var x299 = true ? undefined : function named() { return [d1, d2]; }; var x300 = true ? undefined : function () { return [d1, d2]; }; -var x301 = true ? undefined : function () { - return [d1, d2]; -}; -var x302 = true ? undefined : function named() { - return [d1, d2]; -}; +var x301 = true ? undefined : function () { return [d1, d2]; }; +var x302 = true ? undefined : function named() { return [d1, d2]; }; var x303 = true ? undefined : [d1, d2]; var x304 = true ? undefined : [d1, d2]; var x305 = true ? undefined : [d1, d2]; var x306 = true ? undefined : { n: [d1, d2] }; -var x307 = true ? undefined : function (n) { - var n; - return null; -}; -var x308 = true ? undefined : { func: function (n) { - return [d1, d2]; -} }; +var x307 = true ? undefined : function (n) { var n; return null; }; +var x308 = true ? undefined : { func: function (n) { return [d1, d2]; } }; var x309 = true ? function () { return [d1, d2]; } : undefined; -var x310 = true ? function () { - return [d1, d2]; -} : undefined; -var x311 = true ? function named() { - return [d1, d2]; -} : undefined; +var x310 = true ? function () { return [d1, d2]; } : undefined; +var x311 = true ? function named() { return [d1, d2]; } : undefined; var x312 = true ? function () { return [d1, d2]; } : undefined; -var x313 = true ? function () { - return [d1, d2]; -} : undefined; -var x314 = true ? function named() { - return [d1, d2]; -} : undefined; +var x313 = true ? function () { return [d1, d2]; } : undefined; +var x314 = true ? function named() { return [d1, d2]; } : undefined; var x315 = true ? [d1, d2] : undefined; var x316 = true ? [d1, d2] : undefined; var x317 = true ? [d1, d2] : undefined; var x318 = true ? { n: [d1, d2] } : undefined; -var x319 = true ? function (n) { - var n; - return null; -} : undefined; -var x320 = true ? { func: function (n) { - return [d1, d2]; -} } : undefined; +var x319 = true ? function (n) { var n; return null; } : undefined; +var x320 = true ? { func: function (n) { return [d1, d2]; } } : undefined; function x321(n) { } ; x321(function () { return [d1, d2]; }); function x322(n) { } ; -x322(function () { - return [d1, d2]; -}); +x322(function () { return [d1, d2]; }); function x323(n) { } ; -x323(function named() { - return [d1, d2]; -}); +x323(function named() { return [d1, d2]; }); function x324(n) { } ; x324(function () { return [d1, d2]; }); function x325(n) { } ; -x325(function () { - return [d1, d2]; -}); +x325(function () { return [d1, d2]; }); function x326(n) { } ; -x326(function named() { - return [d1, d2]; -}); +x326(function named() { return [d1, d2]; }); function x327(n) { } ; x327([d1, d2]); @@ -1845,35 +1374,22 @@ function x330(n) { } x330({ n: [d1, d2] }); function x331(n) { } ; -x331(function (n) { - var n; - return null; -}); +x331(function (n) { var n; return null; }); function x332(n) { } ; -x332({ func: function (n) { - return [d1, d2]; -} }); +x332({ func: function (n) { return [d1, d2]; } }); var x333 = function (n) { return n; }; x333(function () { return [d1, d2]; }); var x334 = function (n) { return n; }; -x334(function () { - return [d1, d2]; -}); +x334(function () { return [d1, d2]; }); var x335 = function (n) { return n; }; -x335(function named() { - return [d1, d2]; -}); +x335(function named() { return [d1, d2]; }); var x336 = function (n) { return n; }; x336(function () { return [d1, d2]; }); var x337 = function (n) { return n; }; -x337(function () { - return [d1, d2]; -}); +x337(function () { return [d1, d2]; }); var x338 = function (n) { return n; }; -x338(function named() { - return [d1, d2]; -}); +x338(function named() { return [d1, d2]; }); var x339 = function (n) { return n; }; x339([d1, d2]); var x340 = function (n) { return n; }; @@ -1883,34 +1399,21 @@ x341([d1, d2]); var x342 = function (n) { return n; }; x342({ n: [d1, d2] }); var x343 = function (n) { return n; }; -x343(function (n) { - var n; - return null; -}); +x343(function (n) { var n; return null; }); var x344 = function (n) { return n; }; -x344({ func: function (n) { - return [d1, d2]; -} }); +x344({ func: function (n) { return [d1, d2]; } }); var x345 = function (n) { }; x345(function () { return [d1, d2]; }); var x346 = function (n) { }; -x346(function () { - return [d1, d2]; -}); +x346(function () { return [d1, d2]; }); var x347 = function (n) { }; -x347(function named() { - return [d1, d2]; -}); +x347(function named() { return [d1, d2]; }); var x348 = function (n) { }; x348(function () { return [d1, d2]; }); var x349 = function (n) { }; -x349(function () { - return [d1, d2]; -}); +x349(function () { return [d1, d2]; }); var x350 = function (n) { }; -x350(function named() { - return [d1, d2]; -}); +x350(function named() { return [d1, d2]; }); var x351 = function (n) { }; x351([d1, d2]); var x352 = function (n) { }; @@ -1920,11 +1423,6 @@ x353([d1, d2]); var x354 = function (n) { }; x354({ n: [d1, d2] }); var x355 = function (n) { }; -x355(function (n) { - var n; - return null; -}); +x355(function (n) { var n; return null; }); var x356 = function (n) { }; -x356({ func: function (n) { - return [d1, d2]; -} }); +x356({ func: function (n) { return [d1, d2]; } }); diff --git a/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.js b/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.js index 7abeeda445a..70f70ae07ba 100644 --- a/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.js +++ b/tests/baselines/reference/genericAssignmentCompatWithInterfaces1.js @@ -23,9 +23,7 @@ var a4: I = >z; var A = (function () { function A() { } - A.prototype.compareTo = function (other) { - return 1; - }; + A.prototype.compareTo = function (other) { return 1; }; return A; })(); var z = { x: new A() }; diff --git a/tests/baselines/reference/genericCallWithFunctionTypedArguments.js b/tests/baselines/reference/genericCallWithFunctionTypedArguments.js index fed1d4ca990..30d4ed353ff 100644 --- a/tests/baselines/reference/genericCallWithFunctionTypedArguments.js +++ b/tests/baselines/reference/genericCallWithFunctionTypedArguments.js @@ -48,25 +48,19 @@ var r3 = foo(function (x) { return ''; }); // {} function foo2(x, cb) { return cb(x); } -var r4 = foo2(1, function (a) { - return ''; -}); // string, contextual signature instantiation is applied to generic functions +var r4 = foo2(1, function (a) { return ''; }); // string, contextual signature instantiation is applied to generic functions var r5 = foo2(1, function (a) { return ''; }); // string var r6 = foo2('', function (a) { return 1; }); function foo3(x, cb, y) { return cb(x); } var r7 = foo3(1, function (a) { return ''; }, ''); // string -var r8 = foo3(1, function (a) { - return ''; -}, 1); // error +var r8 = foo3(1, function (a) { return ''; }, 1); // error var r9 = foo3(1, function (a) { return ''; }, ''); // string function other(t, u) { var r10 = foo2(1, function (x) { return ''; }); // error var r10 = foo2(1, function (x) { return ''; }); // string var r11 = foo3(1, function (x) { return ''; }, ''); // error var r11b = foo3(1, function (x) { return ''; }, 1); // error - var r12 = foo3(1, function (a) { - return ''; - }, 1); // error + var r12 = foo3(1, function (a) { return ''; }, 1); // error } diff --git a/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js b/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js index c289ce3de14..f140caaac61 100644 --- a/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js +++ b/tests/baselines/reference/genericCallWithObjectLiteralArguments1.js @@ -8,9 +8,7 @@ var x4 = foo({ x: "", y: 4 }, ""); var x5 = foo({ x: "", y: 4 }, ""); //// [genericCallWithObjectLiteralArguments1.js] -function foo(n, m) { - return m; -} +function foo(n, m) { return m; } // these are all errors var x = foo({ x: 3, y: "" }, 4); var x2 = foo({ x: 3, y: "" }, 4); diff --git a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.js b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.js index 25001bd86bb..b4f96f67942 100644 --- a/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.js +++ b/tests/baselines/reference/genericCallWithOverloadedFunctionTypedArguments2.js @@ -46,10 +46,7 @@ var NonGenericParameter; function foo4(cb) { return cb; } - var r3 = foo4(function (x) { - var r; - return r; - }); // ok + var r3 = foo4(function (x) { var r; return r; }); // ok })(NonGenericParameter || (NonGenericParameter = {})); var GenericParameter; (function (GenericParameter) { diff --git a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js index 5aa2c716986..4f26e35d1b0 100644 --- a/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js +++ b/tests/baselines/reference/genericClassPropertyInheritanceSpecialization.js @@ -92,9 +92,7 @@ var Portal; function Validator(message) { } Validator.prototype.destroy = function () { }; - Validator.prototype._validate = function (value) { - return 0; - }; + Validator.prototype._validate = function (value) { return 0; }; return Validator; })(); Validators.Validator = Validator; diff --git a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js index 7ec25949534..5156c4d6b12 100644 --- a/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js +++ b/tests/baselines/reference/genericClassWithFunctionTypedMemberArguments.js @@ -104,9 +104,7 @@ var WithCandidates; return C; })(); var c; - var r4 = c.foo2(1, function (a) { - return ''; - }); // string, contextual signature instantiation is applied to generic functions + var r4 = c.foo2(1, function (a) { return ''; }); // string, contextual signature instantiation is applied to generic functions var r5 = c.foo2(1, function (a) { return ''; }); // string var r6 = c.foo2('', function (a) { return 1; }); // number var C2 = (function () { @@ -119,9 +117,7 @@ var WithCandidates; })(); var c2; var r7 = c2.foo3(1, function (a) { return ''; }, ''); // string - var r8 = c2.foo3(1, function (a) { - return ''; - }, ''); // string + var r8 = c2.foo3(1, function (a) { return ''; }, ''); // string var C3 = (function () { function C3() { } @@ -136,8 +132,6 @@ var WithCandidates; var r10 = c.foo2(1, function (x) { return ''; }); // string var r11 = c3.foo3(1, function (x) { return ''; }, ''); // error var r11b = c3.foo3(1, function (x) { return ''; }, 1); // error - var r12 = c3.foo3(1, function (a) { - return ''; - }, 1); // error + var r12 = c3.foo3(1, function (a) { return ''; }, 1); // error } })(WithCandidates || (WithCandidates = {})); diff --git a/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js b/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js index 2fd410756b6..4caeacd19e2 100644 --- a/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js +++ b/tests/baselines/reference/genericClassWithStaticsUsingTypeArguments.js @@ -28,8 +28,6 @@ var Foo = (function () { Foo.a = function (n) { }; Foo.c = []; Foo.d = false || (function (x) { return x || undefined; })(null); - Foo.e = function (x) { - return null; - }; + Foo.e = function (x) { return null; }; return Foo; })(); diff --git a/tests/baselines/reference/genericCombinators2.js b/tests/baselines/reference/genericCombinators2.js index af11f056197..a23f163a906 100644 --- a/tests/baselines/reference/genericCombinators2.js +++ b/tests/baselines/reference/genericCombinators2.js @@ -19,10 +19,6 @@ var r5b = _.map(c2, rf1); //// [genericCombinators2.js] var _; var c2; -var rf1 = function (x, y) { - return x.toFixed(); -}; -var r5a = _.map(c2, function (x, y) { - return x.toFixed(); -}); +var rf1 = function (x, y) { return x.toFixed(); }; +var r5a = _.map(c2, function (x, y) { return x.toFixed(); }); var r5b = _.map(c2, rf1); diff --git a/tests/baselines/reference/genericConstraintDeclaration.js b/tests/baselines/reference/genericConstraintDeclaration.js index cdf93d676d0..6e3f8d5ff8b 100644 --- a/tests/baselines/reference/genericConstraintDeclaration.js +++ b/tests/baselines/reference/genericConstraintDeclaration.js @@ -12,9 +12,7 @@ class List{ var List = (function () { function List() { } - List.empty = function () { - return null; - }; + List.empty = function () { return null; }; return List; })(); diff --git a/tests/baselines/reference/genericFunctions0.js b/tests/baselines/reference/genericFunctions0.js index 408abdb9ce0..b52f0583524 100644 --- a/tests/baselines/reference/genericFunctions0.js +++ b/tests/baselines/reference/genericFunctions0.js @@ -4,9 +4,7 @@ function foo (x: T) { return x; } var x = foo(5); // 'x' should be number //// [genericFunctions0.js] -function foo(x) { - return x; -} +function foo(x) { return x; } var x = foo(5); // 'x' should be number diff --git a/tests/baselines/reference/genericFunctions1.js b/tests/baselines/reference/genericFunctions1.js index 25cc91820b8..d9bb3413890 100644 --- a/tests/baselines/reference/genericFunctions1.js +++ b/tests/baselines/reference/genericFunctions1.js @@ -4,9 +4,7 @@ function foo (x: T) { return x; } var x = foo(5); // 'x' should be number //// [genericFunctions1.js] -function foo(x) { - return x; -} +function foo(x) { return x; } var x = foo(5); // 'x' should be number diff --git a/tests/baselines/reference/genericFunctionsWithOptionalParameters3.js b/tests/baselines/reference/genericFunctionsWithOptionalParameters3.js index d2e1a5ecc37..9ad885a899a 100644 --- a/tests/baselines/reference/genericFunctionsWithOptionalParameters3.js +++ b/tests/baselines/reference/genericFunctionsWithOptionalParameters3.js @@ -24,20 +24,8 @@ var Collection = (function () { })(); var utils; var c = new Collection(); -var r3 = utils.mapReduce(c, function (x) { - return 1; -}, function (y) { - return new Date(); -}); -var r4 = utils.mapReduce(c, function (x) { - return 1; -}, function (y) { - return new Date(); -}); -var f1 = function (x) { - return 1; -}; -var f2 = function (y) { - return new Date(); -}; +var r3 = utils.mapReduce(c, function (x) { return 1; }, function (y) { return new Date(); }); +var r4 = utils.mapReduce(c, function (x) { return 1; }, function (y) { return new Date(); }); +var f1 = function (x) { return 1; }; +var f2 = function (y) { return new Date(); }; var r5 = utils.mapReduce(c, f1, f2); diff --git a/tests/baselines/reference/genericFunduleInModule.js b/tests/baselines/reference/genericFunduleInModule.js index 5a85a46a395..95700edecab 100644 --- a/tests/baselines/reference/genericFunduleInModule.js +++ b/tests/baselines/reference/genericFunduleInModule.js @@ -12,9 +12,7 @@ A.B(1); //// [genericFunduleInModule.js] var A; (function (A) { - function B(x) { - return x; - } + function B(x) { return x; } A.B = B; var B; (function (B) { diff --git a/tests/baselines/reference/genericFunduleInModule2.js b/tests/baselines/reference/genericFunduleInModule2.js index 6b5a0a74e23..956e9129ec7 100644 --- a/tests/baselines/reference/genericFunduleInModule2.js +++ b/tests/baselines/reference/genericFunduleInModule2.js @@ -15,9 +15,7 @@ A.B(1); //// [genericFunduleInModule2.js] var A; (function (A) { - function B(x) { - return x; - } + function B(x) { return x; } A.B = B; })(A || (A = {})); var A; diff --git a/tests/baselines/reference/genericImplements.js b/tests/baselines/reference/genericImplements.js index 17d3d2c0d20..b8d295153a4 100644 --- a/tests/baselines/reference/genericImplements.js +++ b/tests/baselines/reference/genericImplements.js @@ -37,26 +37,20 @@ var B = (function () { var X = (function () { function X() { } - X.prototype.f = function () { - return undefined; - }; + X.prototype.f = function () { return undefined; }; return X; })(); // { f: () => { b; } } // OK var Y = (function () { function Y() { } - Y.prototype.f = function () { - return undefined; - }; + Y.prototype.f = function () { return undefined; }; return Y; })(); // { f: () => { a; } } // OK var Z = (function () { function Z() { } - Z.prototype.f = function () { - return undefined; - }; + Z.prototype.f = function () { return undefined; }; return Z; })(); // { f: () => T } diff --git a/tests/baselines/reference/genericLambaArgWithoutTypeArguments.js b/tests/baselines/reference/genericLambaArgWithoutTypeArguments.js index f57f6713c9f..e1cc5cadbd5 100644 --- a/tests/baselines/reference/genericLambaArgWithoutTypeArguments.js +++ b/tests/baselines/reference/genericLambaArgWithoutTypeArguments.js @@ -12,6 +12,4 @@ foo((arg: Foo) => { return arg.x; }); function foo(a) { return null; } -foo(function (arg) { - return arg.x; -}); +foo(function (arg) { return arg.x; }); diff --git a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js index 5d4ecdc0838..9b0fbf4bcad 100644 --- a/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js +++ b/tests/baselines/reference/genericMergedDeclarationUsingTypeParameter.js @@ -7,9 +7,7 @@ module foo { //// [genericMergedDeclarationUsingTypeParameter.js] -function foo(y, z) { - return y; -} +function foo(y, z) { return y; } var foo; (function (foo) { foo.x; diff --git a/tests/baselines/reference/genericObjectLitReturnType.js b/tests/baselines/reference/genericObjectLitReturnType.js index 5191f17796b..826f5233b55 100644 --- a/tests/baselines/reference/genericObjectLitReturnType.js +++ b/tests/baselines/reference/genericObjectLitReturnType.js @@ -15,9 +15,7 @@ t1.a = 5; // Should not error: t1 should have type {a: number}, instead has type var X = (function () { function X() { } - X.prototype.f = function (t) { - return { a: t }; - }; + X.prototype.f = function (t) { return { a: t }; }; return X; })(); var x; diff --git a/tests/baselines/reference/genericOfACloduleType1.js b/tests/baselines/reference/genericOfACloduleType1.js index 85629db765b..1f115aa486a 100644 --- a/tests/baselines/reference/genericOfACloduleType1.js +++ b/tests/baselines/reference/genericOfACloduleType1.js @@ -16,9 +16,7 @@ var g2 = new G() // was: error Type reference cannot refer to container 'M. var G = (function () { function G() { } - G.prototype.bar = function (x) { - return x; - }; + G.prototype.bar = function (x) { return x; }; return G; })(); var M; diff --git a/tests/baselines/reference/genericOfACloduleType2.js b/tests/baselines/reference/genericOfACloduleType2.js index 0b10451bf2c..1d671289cb2 100644 --- a/tests/baselines/reference/genericOfACloduleType2.js +++ b/tests/baselines/reference/genericOfACloduleType2.js @@ -19,9 +19,7 @@ module N { var G = (function () { function G() { } - G.prototype.bar = function (x) { - return x; - }; + G.prototype.bar = function (x) { return x; }; return G; })(); var M; diff --git a/tests/baselines/reference/genericParameterAssignability1.js b/tests/baselines/reference/genericParameterAssignability1.js index 844c8f9a988..a6a465b4089 100644 --- a/tests/baselines/reference/genericParameterAssignability1.js +++ b/tests/baselines/reference/genericParameterAssignability1.js @@ -4,8 +4,6 @@ var r = (x: T) => x; r = f; // should be allowed //// [genericParameterAssignability1.js] -function f(x) { - return null; -} +function f(x) { return null; } var r = function (x) { return x; }; r = f; // should be allowed diff --git a/tests/baselines/reference/genericPrototypeProperty.js b/tests/baselines/reference/genericPrototypeProperty.js index c38cdb753a7..fb6f9b78848 100644 --- a/tests/baselines/reference/genericPrototypeProperty.js +++ b/tests/baselines/reference/genericPrototypeProperty.js @@ -13,9 +13,7 @@ var r3 = r.foo(null); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var r = C.prototype; diff --git a/tests/baselines/reference/genericReturnTypeFromGetter1.js b/tests/baselines/reference/genericReturnTypeFromGetter1.js index 208b12308e1..741c7218345 100644 --- a/tests/baselines/reference/genericReturnTypeFromGetter1.js +++ b/tests/baselines/reference/genericReturnTypeFromGetter1.js @@ -14,9 +14,7 @@ define(["require", "exports"], function (require, exports) { function DbSet() { } Object.defineProperty(DbSet.prototype, "entityType", { - get: function () { - return this._entityType; - } // used to ICE without return type annotation + get: function () { return this._entityType; } // used to ICE without return type annotation , enumerable: true, configurable: true diff --git a/tests/baselines/reference/genericReversingTypeParameters.js b/tests/baselines/reference/genericReversingTypeParameters.js index 0e51b0256ea..2a52c2e9ba6 100644 --- a/tests/baselines/reference/genericReversingTypeParameters.js +++ b/tests/baselines/reference/genericReversingTypeParameters.js @@ -14,12 +14,8 @@ var r2b = i.get(1); var BiMap = (function () { function BiMap() { } - BiMap.prototype.get = function (key) { - return null; - }; - BiMap.prototype.inverse = function () { - return null; - }; + BiMap.prototype.get = function (key) { return null; }; + BiMap.prototype.inverse = function () { return null; }; return BiMap; })(); var b = new BiMap(); diff --git a/tests/baselines/reference/genericReversingTypeParameters2.js b/tests/baselines/reference/genericReversingTypeParameters2.js index eb904f4a2ed..4f4bc564f89 100644 --- a/tests/baselines/reference/genericReversingTypeParameters2.js +++ b/tests/baselines/reference/genericReversingTypeParameters2.js @@ -13,12 +13,8 @@ var r2b = i.get(1); var BiMap = (function () { function BiMap() { } - BiMap.prototype.get = function (key) { - return null; - }; - BiMap.prototype.inverse = function () { - return null; - }; + BiMap.prototype.get = function (key) { return null; }; + BiMap.prototype.inverse = function () { return null; }; return BiMap; })(); var b = new BiMap(); diff --git a/tests/baselines/reference/genericSpecializations1.js b/tests/baselines/reference/genericSpecializations1.js index 3df2c5581b9..3e59fceff97 100644 --- a/tests/baselines/reference/genericSpecializations1.js +++ b/tests/baselines/reference/genericSpecializations1.js @@ -19,24 +19,18 @@ class StringFoo3 implements IFoo { var IntFooBad = (function () { function IntFooBad() { } - IntFooBad.prototype.foo = function (x) { - return null; - }; + IntFooBad.prototype.foo = function (x) { return null; }; return IntFooBad; })(); var StringFoo2 = (function () { function StringFoo2() { } - StringFoo2.prototype.foo = function (x) { - return null; - }; + StringFoo2.prototype.foo = function (x) { return null; }; return StringFoo2; })(); var StringFoo3 = (function () { function StringFoo3() { } - StringFoo3.prototype.foo = function (x) { - return null; - }; + StringFoo3.prototype.foo = function (x) { return null; }; return StringFoo3; })(); diff --git a/tests/baselines/reference/genericSpecializations2.js b/tests/baselines/reference/genericSpecializations2.js index 666ea43eeba..8497d2db8b4 100644 --- a/tests/baselines/reference/genericSpecializations2.js +++ b/tests/baselines/reference/genericSpecializations2.js @@ -31,24 +31,18 @@ var IFoo = (function () { var IntFooBad = (function () { function IntFooBad() { } - IntFooBad.prototype.foo = function (x) { - return null; - }; + IntFooBad.prototype.foo = function (x) { return null; }; return IntFooBad; })(); var StringFoo2 = (function () { function StringFoo2() { } - StringFoo2.prototype.foo = function (x) { - return null; - }; + StringFoo2.prototype.foo = function (x) { return null; }; return StringFoo2; })(); var StringFoo3 = (function () { function StringFoo3() { } - StringFoo3.prototype.foo = function (x) { - return null; - }; + StringFoo3.prototype.foo = function (x) { return null; }; return StringFoo3; })(); diff --git a/tests/baselines/reference/genericSpecializations3.js b/tests/baselines/reference/genericSpecializations3.js index 8d157761160..3c582ae31fd 100644 --- a/tests/baselines/reference/genericSpecializations3.js +++ b/tests/baselines/reference/genericSpecializations3.js @@ -41,27 +41,21 @@ iFoo.foo(1); var IntFooBad = (function () { function IntFooBad() { } - IntFooBad.prototype.foo = function (x) { - return null; - }; + IntFooBad.prototype.foo = function (x) { return null; }; return IntFooBad; })(); var intFooBad; var IntFoo = (function () { function IntFoo() { } - IntFoo.prototype.foo = function (x) { - return null; - }; + IntFoo.prototype.foo = function (x) { return null; }; return IntFoo; })(); var intFoo; var StringFoo2 = (function () { function StringFoo2() { } - StringFoo2.prototype.foo = function (x) { - return null; - }; + StringFoo2.prototype.foo = function (x) { return null; }; return StringFoo2; })(); var stringFoo2; @@ -71,9 +65,7 @@ stringFoo2 = intFoo; // error var StringFoo3 = (function () { function StringFoo3() { } - StringFoo3.prototype.foo = function (x) { - return null; - }; + StringFoo3.prototype.foo = function (x) { return null; }; return StringFoo3; })(); var stringFoo3; diff --git a/tests/baselines/reference/genericStaticAnyTypeFunction.js b/tests/baselines/reference/genericStaticAnyTypeFunction.js index 055e6b4f683..6816afec910 100644 --- a/tests/baselines/reference/genericStaticAnyTypeFunction.js +++ b/tests/baselines/reference/genericStaticAnyTypeFunction.js @@ -25,9 +25,7 @@ var A = (function () { A.one = function (source, value) { return source; }; - A.goo = function () { - return 0; - }; + A.goo = function () { return 0; }; A.two = function (source) { return this.one(source, 42); // should not error }; diff --git a/tests/baselines/reference/genericTypeAssertions3.js b/tests/baselines/reference/genericTypeAssertions3.js index 19a477c142c..b67a277654f 100644 --- a/tests/baselines/reference/genericTypeAssertions3.js +++ b/tests/baselines/reference/genericTypeAssertions3.js @@ -4,9 +4,5 @@ var s = < (x: T) => T > ((x: any) => { return null; }); // no error //// [genericTypeAssertions3.js] -var r = (function (x) { - return null; -}); // bug was 'could not find dotted symbol T' on x's annotation in the type assertion instead of no error -var s = (function (x) { - return null; -}); // no error +var r = (function (x) { return null; }); // bug was 'could not find dotted symbol T' on x's annotation in the type assertion instead of no error +var s = (function (x) { return null; }); // no error diff --git a/tests/baselines/reference/genericTypeAssertions4.js b/tests/baselines/reference/genericTypeAssertions4.js index d04b6cbe104..a607fb07428 100644 --- a/tests/baselines/reference/genericTypeAssertions4.js +++ b/tests/baselines/reference/genericTypeAssertions4.js @@ -35,9 +35,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ""; - }; + A.prototype.foo = function () { return ""; }; return A; })(); var B = (function (_super) { @@ -45,9 +43,7 @@ var B = (function (_super) { function B() { _super.apply(this, arguments); } - B.prototype.bar = function () { - return 1; - }; + B.prototype.bar = function () { return 1; }; return B; })(A); var C = (function (_super) { @@ -55,9 +51,7 @@ var C = (function (_super) { function C() { _super.apply(this, arguments); } - C.prototype.baz = function () { - return 1; - }; + C.prototype.baz = function () { return 1; }; return C; })(A); var a; diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js index 1b41116732a..4be1cce27a9 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.js @@ -55,18 +55,9 @@ var c; var a; var b; var d; -var e = function (x) { - var y; - return y; -}; -function f(x) { - var y; - return y; -} -var g = function f(x) { - var y; - return y; -}; +var e = function (x) { var y; return y; }; +function f(x) { var y; return y; } +var g = function f(x) { var y; return y; }; var D = (function (_super) { __extends(D, _super); function D() { diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js index f96e25301be..803d499705a 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.js @@ -50,18 +50,9 @@ var c; var a; var b; var d; -var e = function (x) { - var y; - return y; -}; -function f(x) { - var y; - return y; -} -var g = function f(x) { - var y; - return y; -}; +var e = function (x) { var y; return y; }; +function f(x) { var y; return y; } +var g = function f(x) { var y; return y; }; var D = (function (_super) { __extends(D, _super); function D() { diff --git a/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.js b/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.js index 69bc1c372b3..90ad9e1ff93 100644 --- a/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.js +++ b/tests/baselines/reference/genericTypeReferencesRequireTypeArgs.js @@ -15,9 +15,7 @@ var i2: I; // should be an error var C = (function () { function C() { } - C.prototype.foo = function () { - return null; - }; + C.prototype.foo = function () { return null; }; return C; })(); var c1; // error diff --git a/tests/baselines/reference/genericWithOpenTypeParameters1.js b/tests/baselines/reference/genericWithOpenTypeParameters1.js index afdce73cb11..90202767012 100644 --- a/tests/baselines/reference/genericWithOpenTypeParameters1.js +++ b/tests/baselines/reference/genericWithOpenTypeParameters1.js @@ -15,22 +15,12 @@ var f4 = (x: B) => { return x.foo(1); } // no error var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var x; x.foo(1); // no error -var f = function (x) { - return x.foo(1); -}; // error -var f2 = function (x) { - return x.foo(1); -}; // error -var f3 = function (x) { - return x.foo(1); -}; // error -var f4 = function (x) { - return x.foo(1); -}; // no error +var f = function (x) { return x.foo(1); }; // error +var f2 = function (x) { return x.foo(1); }; // error +var f3 = function (x) { return x.foo(1); }; // error +var f4 = function (x) { return x.foo(1); }; // no error diff --git a/tests/baselines/reference/genericsWithDuplicateTypeParameters1.js b/tests/baselines/reference/genericsWithDuplicateTypeParameters1.js index f01f01dbf21..72eeb1ab683 100644 --- a/tests/baselines/reference/genericsWithDuplicateTypeParameters1.js +++ b/tests/baselines/reference/genericsWithDuplicateTypeParameters1.js @@ -18,21 +18,15 @@ var m = { //// [genericsWithDuplicateTypeParameters1.js] function f() { } -function f2(a, b) { - return null; -} +function f2(a, b) { return null; } var C = (function () { function C() { } C.prototype.f = function () { }; - C.prototype.f2 = function (a, b) { - return null; - }; + C.prototype.f2 = function (a, b) { return null; }; return C; })(); var m = { a: function f() { }, - b: function f2(a, b) { - return null; - } + b: function f2(a, b) { return null; } }; diff --git a/tests/baselines/reference/genericsWithoutTypeParameters1.js b/tests/baselines/reference/genericsWithoutTypeParameters1.js index 8446d40cb11..41abffcb854 100644 --- a/tests/baselines/reference/genericsWithoutTypeParameters1.js +++ b/tests/baselines/reference/genericsWithoutTypeParameters1.js @@ -37,9 +37,7 @@ function f(x: T): A { var C = (function () { function C() { } - C.prototype.foo = function () { - return null; - }; + C.prototype.foo = function () { return null; }; return C; })(); var c1; @@ -49,9 +47,7 @@ var i2; function foo(x, y) { } function foo2(x, y) { } var x = { a: new C() }; -var x2 = { a: { bar: function () { - return 1; -} } }; +var x2 = { a: { bar: function () { return 1; } } }; var D = (function () { function D() { } diff --git a/tests/baselines/reference/getAndSetAsMemberNames.js b/tests/baselines/reference/getAndSetAsMemberNames.js index 41a89e6ec37..8b036cd0f73 100644 --- a/tests/baselines/reference/getAndSetAsMemberNames.js +++ b/tests/baselines/reference/getAndSetAsMemberNames.js @@ -49,13 +49,9 @@ var C4 = (function () { })(); var C5 = (function () { function C5() { - this.set = function () { - return true; - }; + this.set = function () { return true; }; } - C5.prototype.get = function () { - return true; - }; + C5.prototype.get = function () { return true; }; Object.defineProperty(C5.prototype, "t", { set: function (x) { }, enumerable: true, diff --git a/tests/baselines/reference/getsetReturnTypes.js b/tests/baselines/reference/getsetReturnTypes.js index 55d7e9285b0..27b6fc52fe5 100644 --- a/tests/baselines/reference/getsetReturnTypes.js +++ b/tests/baselines/reference/getsetReturnTypes.js @@ -10,9 +10,7 @@ var y: number = makePoint(2).x; //// [getsetReturnTypes.js] function makePoint(x) { return { - get x() { - return x; - } + get x() { return x; } }; } ; diff --git a/tests/baselines/reference/getterSetterNonAccessor.js b/tests/baselines/reference/getterSetterNonAccessor.js index e32c62c497e..c28337ff7b4 100644 --- a/tests/baselines/reference/getterSetterNonAccessor.js +++ b/tests/baselines/reference/getterSetterNonAccessor.js @@ -10,9 +10,7 @@ Object.defineProperty({}, "0", ({ //// [getterSetterNonAccessor.js] -function getFunc() { - return 0; -} +function getFunc() { return 0; } function setFunc(v) { } Object.defineProperty({}, "0", ({ get: getFunc, diff --git a/tests/baselines/reference/gettersAndSetters.js b/tests/baselines/reference/gettersAndSetters.js index 6fb9518cfdb..92f959e5988 100644 --- a/tests/baselines/reference/gettersAndSetters.js +++ b/tests/baselines/reference/gettersAndSetters.js @@ -50,25 +50,17 @@ var C = (function () { this.set = function () { }; // ok } Object.defineProperty(C.prototype, "Foo", { - get: function () { - return this.fooBack; - } // ok + get: function () { return this.fooBack; } // ok , - set: function (foo) { - this.fooBack = foo; - } // ok + set: function (foo) { this.fooBack = foo; } // ok , enumerable: true, configurable: true }); Object.defineProperty(C, "Bar", { - get: function () { - return C.barBack; - } // ok + get: function () { return C.barBack; } // ok , - set: function (bar) { - C.barBack = bar; - } // ok + set: function (bar) { C.barBack = bar; } // ok , enumerable: true, configurable: true @@ -84,13 +76,7 @@ C.Bar = "barv"; var baz = c.Baz; c.Baz = "bazv"; // The Foo accessors' return and param types should be contextually typed to the Foo field -var o = { get Foo() { - return 0; -}, set Foo(val) { - val; -} }; // o +var o = { get Foo() { return 0; }, set Foo(val) { val; } }; // o var ofg = o.Foo; o.Foo = 0; -var i = function (n) { - return n; -}; +var i = function (n) { return n; }; diff --git a/tests/baselines/reference/gettersAndSettersAccessibility.js b/tests/baselines/reference/gettersAndSettersAccessibility.js index f472fa36a98..e0cfa3d17c5 100644 --- a/tests/baselines/reference/gettersAndSettersAccessibility.js +++ b/tests/baselines/reference/gettersAndSettersAccessibility.js @@ -10,9 +10,7 @@ var C99 = (function () { function C99() { } Object.defineProperty(C99.prototype, "Baz", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (n) { } // error - accessors do not agree in visibility , enumerable: true, diff --git a/tests/baselines/reference/gettersAndSettersErrors.js b/tests/baselines/reference/gettersAndSettersErrors.js index 545517facea..d92f0d833f5 100644 --- a/tests/baselines/reference/gettersAndSettersErrors.js +++ b/tests/baselines/reference/gettersAndSettersErrors.js @@ -22,9 +22,7 @@ var C = (function () { this.Foo = 0; // error - duplicate identifier Foo - confirmed } Object.defineProperty(C.prototype, "Foo", { - get: function () { - return "foo"; - } // ok + get: function () { return "foo"; } // ok , set: function (foo) { } // ok , @@ -32,9 +30,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, "Goo", { - get: function (v) { - return null; - } // error - getters must not have a parameter + get: function (v) { return null; } // error - getters must not have a parameter , set: function (v) { } // error - setters must not specify a return type , @@ -47,9 +43,7 @@ var E = (function () { function E() { } Object.defineProperty(E.prototype, "Baz", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (n) { } // error - accessors do not agree in visibility , enumerable: true, diff --git a/tests/baselines/reference/gettersAndSettersTypesAgree.js b/tests/baselines/reference/gettersAndSettersTypesAgree.js index c291c457613..91d3d844981 100644 --- a/tests/baselines/reference/gettersAndSettersTypesAgree.js +++ b/tests/baselines/reference/gettersAndSettersTypesAgree.js @@ -15,9 +15,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "Foo", { - get: function () { - return "foo"; - } // ok + get: function () { return "foo"; } // ok , set: function (foo) { } // ok - type inferred from getter return statement , @@ -25,9 +23,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, "Bar", { - get: function () { - return "foo"; - } // ok + get: function () { return "foo"; } // ok , set: function (bar) { } // ok - type must be declared , @@ -36,9 +32,5 @@ var C = (function () { }); return C; })(); -var o1 = { get Foo() { - return 0; -}, set Foo(val) { } }; // ok - types agree (inference) -var o2 = { get Foo() { - return 0; -}, set Foo(val) { } }; // ok - types agree +var o1 = { get Foo() { return 0; }, set Foo(val) { } }; // ok - types agree (inference) +var o2 = { get Foo() { return 0; }, set Foo(val) { } }; // ok - types agree diff --git a/tests/baselines/reference/grammarAmbiguities.js b/tests/baselines/reference/grammarAmbiguities.js index ee81d947ff6..f603bd1023f 100644 --- a/tests/baselines/reference/grammarAmbiguities.js +++ b/tests/baselines/reference/grammarAmbiguities.js @@ -12,12 +12,8 @@ f(g < A, B > +(7)); // Should error //// [grammarAmbiguities.js] -function f(n) { - return null; -} -function g(x) { - return null; -} +function f(n) { return null; } +function g(x) { return null; } var A, B; f(g(7)); f(g < A, B > 7); // Should error diff --git a/tests/baselines/reference/grammarAmbiguities1.js b/tests/baselines/reference/grammarAmbiguities1.js index 6ee64527bcc..1917acb7128 100644 --- a/tests/baselines/reference/grammarAmbiguities1.js +++ b/tests/baselines/reference/grammarAmbiguities1.js @@ -23,12 +23,8 @@ var B = (function () { B.prototype.bar = function () { }; return B; })(); -function f(x) { - return x; -} -function g(x) { - return f(x); -} +function f(x) { return x; } +function g(x) { return f(x); } g(7); f(g(7)); f(g < A, B > 7); diff --git a/tests/baselines/reference/ifDoWhileStatements.js b/tests/baselines/reference/ifDoWhileStatements.js index c7f6ead6b28..793094584bf 100644 --- a/tests/baselines/reference/ifDoWhileStatements.js +++ b/tests/baselines/reference/ifDoWhileStatements.js @@ -186,12 +186,8 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} -function F2(x) { - return x < 42; -} +function F(x) { return 42; } +function F2(x) { return x < 42; } var M; (function (M) { var A = (function () { @@ -200,9 +196,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var N; @@ -213,9 +207,7 @@ var N; return A; })(); N.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } N.F2 = F2; })(N || (N = {})); // literals @@ -306,9 +298,7 @@ var k = { x: 1, y: 'a' }; if (k) { } while (k) { } do { } while (k); -function fn(x) { - return null; -} +function fn(x) { return null; } if (fn()) { } while (fn()) { } do { } while (fn()); diff --git a/tests/baselines/reference/illegalSuperCallsInConstructor.js b/tests/baselines/reference/illegalSuperCallsInConstructor.js index b978af1a609..0bdcebed9c5 100644 --- a/tests/baselines/reference/illegalSuperCallsInConstructor.js +++ b/tests/baselines/reference/illegalSuperCallsInConstructor.js @@ -36,12 +36,8 @@ var Derived = (function (_super) { __extends(Derived, _super); function Derived() { var r2 = function () { return _super.call(this); }; - var r3 = function () { - _super.call(this); - }; - var r4 = function () { - _super.call(this); - }; + var r3 = function () { _super.call(this); }; + var r4 = function () { _super.call(this); }; var r5 = { get foo() { _super.call(this); diff --git a/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.js b/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.js index df1c4d51e74..9bfad713d82 100644 --- a/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.js +++ b/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.js @@ -22,26 +22,12 @@ var lambda10 = function temp1() { return 5; } var lambda = function (l1) { }; // Error at "l1" var lambd2 = function (ll1, ll2) { }; // Error at "ll1" var lamda3 = function myLambda3(myParam) { }; -var lamda4 = function () { - return null; -}; +var lamda4 = function () { return null; }; // these should be error for implicit any return type -var lambda5 = function temp() { - return null; -}; -var lambda6 = function () { - return null; -}; -var lambda7 = function temp() { - return undefined; -}; -var lambda8 = function () { - return undefined; -}; +var lambda5 = function temp() { return null; }; +var lambda6 = function () { return null; }; +var lambda7 = function temp() { return undefined; }; +var lambda8 = function () { return undefined; }; // this shouldn't be an error -var lambda9 = function () { - return 5; -}; -var lambda10 = function temp1() { - return 5; -}; +var lambda9 = function () { return 5; }; +var lambda10 = function temp1() { return 5; }; diff --git a/tests/baselines/reference/implicitAnyFromCircularInference.js b/tests/baselines/reference/implicitAnyFromCircularInference.js index d97b8420ebf..d818ea17105 100644 --- a/tests/baselines/reference/implicitAnyFromCircularInference.js +++ b/tests/baselines/reference/implicitAnyFromCircularInference.js @@ -58,13 +58,9 @@ var b; var c; // Error expected var d; -function f() { - return f; -} +function f() { return f; } // Error expected -function g() { - return g(); -} +function g() { return g(); } // Error expected var f1 = function () { return f1(); @@ -78,9 +74,7 @@ function h() { return h() || "hello"; } } -function foo(x) { - return "abc"; -} +function foo(x) { return "abc"; } var C = (function () { function C() { // Error expected diff --git a/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.js b/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.js index 699b57603eb..82eb56fbde6 100644 --- a/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.js +++ b/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.js @@ -26,12 +26,8 @@ undefinedWidenFunction(); //// [implicitAnyFunctionReturnNullOrUndefined.js] // this should be an error -function nullWidenFunction() { - return null; -} // error at "nullWidenFunction" -function undefinedWidenFunction() { - return undefined; -} // error at "undefinedWidenFunction" +function nullWidenFunction() { return null; } // error at "nullWidenFunction" +function undefinedWidenFunction() { return undefined; } // error at "undefinedWidenFunction" var C = (function () { function C() { } @@ -44,18 +40,10 @@ var C = (function () { return C; })(); // this should not be an error -function foo1() { - return null; -} -function bar1() { - return undefined; -} -function fooBar() { - return 1; -} -function fooFoo() { - return 5; -} +function foo1() { return null; } +function bar1() { return undefined; } +function fooBar() { return 1; } +function fooFoo() { return 5; } // this should not be an error as the error is raised by expr above nullWidenFunction(); undefinedWidenFunction(); diff --git a/tests/baselines/reference/implicitAnyGenericTypeInference.js b/tests/baselines/reference/implicitAnyGenericTypeInference.js index 2679ae8285c..583ab7f0b01 100644 --- a/tests/baselines/reference/implicitAnyGenericTypeInference.js +++ b/tests/baselines/reference/implicitAnyGenericTypeInference.js @@ -10,7 +10,5 @@ var r = c.compareTo(1, ''); //// [implicitAnyGenericTypeInference.js] var c; -c = { compareTo: function (x, y) { - return y; -} }; +c = { compareTo: function (x, y) { return y; } }; var r = c.compareTo(1, ''); diff --git a/tests/baselines/reference/implicitAnyGenerics.js b/tests/baselines/reference/implicitAnyGenerics.js index a5c98590a8f..daea0dfe54c 100644 --- a/tests/baselines/reference/implicitAnyGenerics.js +++ b/tests/baselines/reference/implicitAnyGenerics.js @@ -46,9 +46,7 @@ var d2 = new D(1); var d3 = new D(1); var d4 = new D(1); var d5 = new D(null); -function foo() { - return null; -} +function foo() { return null; } ; foo(); foo(); diff --git a/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.js b/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.js index 4218d9a9a21..9e558122b15 100644 --- a/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.js +++ b/tests/baselines/reference/implicitAnyNewExprLackConstructorSignature.js @@ -3,7 +3,5 @@ function Point() { this.x = 3; } var x: any = new Point(); // error at "new" //// [implicitAnyNewExprLackConstructorSignature.js] -function Point() { - this.x = 3; -} +function Point() { this.x = 3; } var x = new Point(); // error at "new" diff --git a/tests/baselines/reference/importAsBaseClass.js b/tests/baselines/reference/importAsBaseClass.js index 9e52c4dd067..8114e88ca4b 100644 --- a/tests/baselines/reference/importAsBaseClass.js +++ b/tests/baselines/reference/importAsBaseClass.js @@ -14,9 +14,7 @@ class Hello extends Greeter { } var Greeter = (function () { function Greeter() { } - Greeter.prototype.greet = function () { - return 'greet'; - }; + Greeter.prototype.greet = function () { return 'greet'; }; return Greeter; })(); exports.Greeter = Greeter; diff --git a/tests/baselines/reference/importDecl.js b/tests/baselines/reference/importDecl.js index d6f2855908e..9d4839e5e7c 100644 --- a/tests/baselines/reference/importDecl.js +++ b/tests/baselines/reference/importDecl.js @@ -89,9 +89,7 @@ var d = (function () { })(); exports.d = d; exports.x; -function foo() { - return null; -} +function foo() { return null; } exports.foo = foo; //// [importDecl_require1.js] var d = (function () { @@ -101,9 +99,7 @@ var d = (function () { })(); exports.d = d; var x; -function foo() { - return null; -} +function foo() { return null; } exports.foo = foo; //// [importDecl_require2.js] var d = (function () { @@ -113,9 +109,7 @@ var d = (function () { })(); exports.d = d; exports.x; -function foo() { - return null; -} +function foo() { return null; } exports.foo = foo; //// [importDecl_require3.js] var d = (function () { @@ -125,14 +119,10 @@ var d = (function () { })(); exports.d = d; exports.x; -function foo() { - return null; -} +function foo() { return null; } exports.foo = foo; //// [importDecl_require4.js] -function foo2() { - return null; -} +function foo2() { return null; } exports.foo2 = foo2; //// [importDecl_1.js] /// diff --git a/tests/baselines/reference/importedModuleAddToGlobal.js b/tests/baselines/reference/importedModuleAddToGlobal.js index 6685bec69e3..dd7dfcd5fc9 100644 --- a/tests/baselines/reference/importedModuleAddToGlobal.js +++ b/tests/baselines/reference/importedModuleAddToGlobal.js @@ -28,7 +28,5 @@ var B; })(B || (B = {})); var C; (function (C) { - function hello() { - return null; - } + function hello() { return null; } })(C || (C = {})); diff --git a/tests/baselines/reference/inOperatorWithFunction.js b/tests/baselines/reference/inOperatorWithFunction.js index 8daeb5a30fb..bc293ca2c43 100644 --- a/tests/baselines/reference/inOperatorWithFunction.js +++ b/tests/baselines/reference/inOperatorWithFunction.js @@ -4,7 +4,5 @@ fn("a" in { "a": true }); //// [inOperatorWithFunction.js] -var fn = function (val) { - return val; -}; +var fn = function (val) { return val; }; fn("a" in { "a": true }); diff --git a/tests/baselines/reference/incompatibleTypes.js b/tests/baselines/reference/incompatibleTypes.js index 2f804f2efa1..7e24afecf5f 100644 --- a/tests/baselines/reference/incompatibleTypes.js +++ b/tests/baselines/reference/incompatibleTypes.js @@ -106,9 +106,7 @@ function if1(a) { } var c1; var c2; if1(c1); -function of1(a) { - return null; -} +function of1(a) { return null; } of1({ e: 0, f: 0 }); function foo(fn) { } diff --git a/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js b/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js index 564516ead64..eb9cd949280 100644 --- a/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js +++ b/tests/baselines/reference/incrementOperatorWithNumberTypeInvalidOperations.js @@ -50,15 +50,11 @@ foo()++; // ++ operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -72,14 +68,10 @@ var ResultIsNumber2 = NUMBER1++; // number type literal var ResultIsNumber3 = ++1; var ResultIsNumber4 = ++{ x: 1, y: 2 }; -var ResultIsNumber5 = ++{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = ++{ x: 1, y: function (n) { return n; } }; var ResultIsNumber6 = 1++; var ResultIsNumber7 = { x: 1, y: 2 }++; -var ResultIsNumber8 = { x: 1, y: function (n) { - return n; -} }++; +var ResultIsNumber8 = { x: 1, y: function (n) { return n; } }++; // number type expressions var ResultIsNumber9 = ++foo(); var ResultIsNumber10 = ++A.foo(); diff --git a/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js b/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js index 6c0775b520f..6a974443f7b 100644 --- a/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js +++ b/tests/baselines/reference/incrementOperatorWithUnsupportedBooleanType.js @@ -57,15 +57,11 @@ objA.a++, M.n++; //// [incrementOperatorWithUnsupportedBooleanType.js] // ++ operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return true; - }; + A.foo = function () { return true; }; return A; })(); var M; @@ -79,14 +75,10 @@ var ResultIsNumber2 = BOOLEAN++; // boolean type literal var ResultIsNumber3 = ++true; var ResultIsNumber4 = ++{ x: true, y: false }; -var ResultIsNumber5 = ++{ x: true, y: function (n) { - return n; -} }; +var ResultIsNumber5 = ++{ x: true, y: function (n) { return n; } }; var ResultIsNumber6 = true++; var ResultIsNumber7 = { x: true, y: false }++; -var ResultIsNumber8 = { x: true, y: function (n) { - return n; -} }++; +var ResultIsNumber8 = { x: true, y: function (n) { return n; } }++; // boolean type expressions var ResultIsNumber9 = ++objA.a; var ResultIsNumber10 = ++M.n; diff --git a/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js b/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js index 065cf6ed5eb..82bf03cd83a 100644 --- a/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js +++ b/tests/baselines/reference/incrementOperatorWithUnsupportedStringType.js @@ -69,15 +69,11 @@ objA.a++, M.n++; // ++ operator on string type var STRING; var STRING1 = ["", ""]; -function foo() { - return ""; -} +function foo() { return ""; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -93,14 +89,10 @@ var ResultIsNumber4 = STRING1++; // string type literal var ResultIsNumber5 = ++""; var ResultIsNumber6 = ++{ x: "", y: "" }; -var ResultIsNumber7 = ++{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber7 = ++{ x: "", y: function (s) { return s; } }; var ResultIsNumber8 = ""++; var ResultIsNumber9 = { x: "", y: "" }++; -var ResultIsNumber10 = { x: "", y: function (s) { - return s; -} }++; +var ResultIsNumber10 = { x: "", y: function (s) { return s; } }++; // string type expressions var ResultIsNumber11 = ++objA.a; var ResultIsNumber12 = ++M.n; diff --git a/tests/baselines/reference/indexSignaturesInferentialTyping.js b/tests/baselines/reference/indexSignaturesInferentialTyping.js index d8200338b62..53636be716c 100644 --- a/tests/baselines/reference/indexSignaturesInferentialTyping.js +++ b/tests/baselines/reference/indexSignaturesInferentialTyping.js @@ -9,12 +9,8 @@ var x4 = bar({ zero: 0, one: 1 }); // type should be number //// [indexSignaturesInferentialTyping.js] -function foo(items) { - return undefined; -} -function bar(items) { - return undefined; -} +function foo(items) { return undefined; } +function bar(items) { return undefined; } var x1 = foo({ 0: 0, 1: 1 }); // type should be number var x2 = foo({ zero: 0, one: 1 }); var x3 = bar({ 0: 0, 1: 1 }); diff --git a/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.js b/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.js index 6b6a47405ad..aeb9a840773 100644 --- a/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.js +++ b/tests/baselines/reference/inferentialTypingWithFunctionTypeNested.js @@ -5,6 +5,4 @@ declare function identity(y: V): V; var s = map("", () => { return { x: identity }; }); //// [inferentialTypingWithFunctionTypeNested.js] -var s = map("", function () { - return { x: identity }; -}); +var s = map("", function () { return { x: identity }; }); diff --git a/tests/baselines/reference/inheritance.js b/tests/baselines/reference/inheritance.js index 1fca887a9b1..f7a274b1990 100644 --- a/tests/baselines/reference/inheritance.js +++ b/tests/baselines/reference/inheritance.js @@ -79,13 +79,9 @@ var ND = (function (_super) { })(N); var Good = (function () { function Good() { - this.f = function () { - return 0; - }; + this.f = function () { return 0; }; } - Good.prototype.g = function () { - return 0; - }; + Good.prototype.g = function () { return 0; }; return Good; })(); var Baad = (function (_super) { @@ -93,11 +89,7 @@ var Baad = (function (_super) { function Baad() { _super.apply(this, arguments); } - Baad.prototype.f = function () { - return 0; - }; - Baad.prototype.g = function (n) { - return 0; - }; + Baad.prototype.f = function () { return 0; }; + Baad.prototype.g = function (n) { return 0; }; return Baad; })(Good); diff --git a/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.js b/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.js index 3ea0e6e1594..85801ca704f 100644 --- a/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.js +++ b/tests/baselines/reference/inheritedFunctionAssignmentCompatibility.js @@ -11,6 +11,4 @@ fn(function (a, b) { return true; }) //// [inheritedFunctionAssignmentCompatibility.js] function fn(cb) { } fn(function (a, b) { return true; }); -fn(function (a, b) { - return true; -}); +fn(function (a, b) { return true; }); diff --git a/tests/baselines/reference/innerFunc.js b/tests/baselines/reference/innerFunc.js index 1676d0789d1..c790c09e271 100644 --- a/tests/baselines/reference/innerFunc.js +++ b/tests/baselines/reference/innerFunc.js @@ -14,17 +14,13 @@ module M { //// [innerFunc.js] function salt() { - function pepper() { - return 5; - } + function pepper() { return 5; } return pepper(); } var M; (function (M) { function tungsten() { - function oxygen() { - return 6; - } + function oxygen() { return 6; } ; return oxygen(); } diff --git a/tests/baselines/reference/innerModExport1.js b/tests/baselines/reference/innerModExport1.js index d61e79f2396..cbeced37046 100644 --- a/tests/baselines/reference/innerModExport1.js +++ b/tests/baselines/reference/innerModExport1.js @@ -28,18 +28,12 @@ var Outer; { var non_export_var = 0; Outer.export_var = 1; - function NonExportFunc() { - return 0; - } - function ExportFunc() { - return 0; - } + function NonExportFunc() { return 0; } + function ExportFunc() { return 0; } Outer.ExportFunc = ExportFunc; } Outer.outer_var_export = 0; - function outerFuncExport() { - return 0; - } + function outerFuncExport() { return 0; } Outer.outerFuncExport = outerFuncExport; })(Outer || (Outer = {})); Outer.ExportFunc(); diff --git a/tests/baselines/reference/innerModExport2.js b/tests/baselines/reference/innerModExport2.js index 26399879e6d..a1526daf6f3 100644 --- a/tests/baselines/reference/innerModExport2.js +++ b/tests/baselines/reference/innerModExport2.js @@ -29,19 +29,13 @@ var Outer; { var non_export_var = 0; Outer.export_var = 1; - function NonExportFunc() { - return 0; - } - function ExportFunc() { - return 0; - } + function NonExportFunc() { return 0; } + function ExportFunc() { return 0; } Outer.ExportFunc = ExportFunc; } var export_var; Outer.outer_var_export = 0; - function outerFuncExport() { - return 0; - } + function outerFuncExport() { return 0; } Outer.outerFuncExport = outerFuncExport; })(Outer || (Outer = {})); Outer.NonExportFunc(); diff --git a/tests/baselines/reference/innerOverloads.js b/tests/baselines/reference/innerOverloads.js index 184b644406e..19e3fa78909 100644 --- a/tests/baselines/reference/innerOverloads.js +++ b/tests/baselines/reference/innerOverloads.js @@ -14,9 +14,7 @@ var x = outer(); // should work //// [innerOverloads.js] function outer() { - function inner(a) { - return a; - } + function inner(a) { return a; } return inner(0); } var x = outer(); // should work diff --git a/tests/baselines/reference/instanceAndStaticDeclarations1.js b/tests/baselines/reference/instanceAndStaticDeclarations1.js index 1396e2bcfa8..7dbd6dcbe7d 100644 --- a/tests/baselines/reference/instanceAndStaticDeclarations1.js +++ b/tests/baselines/reference/instanceAndStaticDeclarations1.js @@ -24,9 +24,7 @@ var Point = (function () { var dy = this.y - p.y; return Math.sqrt(dx * dx + dy * dy); }; - Point.distance = function (p1, p2) { - return p1.distance(p2); - }; + Point.distance = function (p1, p2) { return p1.distance(p2); }; Point.origin = new Point(0, 0); return Point; })(); diff --git a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js index 32507e8209e..7ab3b4a0aa3 100644 --- a/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js +++ b/tests/baselines/reference/instancePropertiesInheritedIntoClassType.js @@ -64,9 +64,7 @@ var NonGeneric; enumerable: true, configurable: true }); - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; return C; })(); var D = (function (_super) { @@ -98,9 +96,7 @@ var Generic; enumerable: true, configurable: true }); - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; return C; })(); var D = (function (_super) { diff --git a/tests/baselines/reference/instancePropertyInClassType.js b/tests/baselines/reference/instancePropertyInClassType.js index ac89621b7b9..863f18de323 100644 --- a/tests/baselines/reference/instancePropertyInClassType.js +++ b/tests/baselines/reference/instancePropertyInClassType.js @@ -54,9 +54,7 @@ var NonGeneric; enumerable: true, configurable: true }); - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; return C; })(); var c = new C(1, 2); @@ -81,9 +79,7 @@ var Generic; enumerable: true, configurable: true }); - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; return C; })(); var c = new C(1, ''); diff --git a/tests/baselines/reference/intTypeCheck.js b/tests/baselines/reference/intTypeCheck.js index ab62168007e..fbbe1bb5d03 100644 --- a/tests/baselines/reference/intTypeCheck.js +++ b/tests/baselines/reference/intTypeCheck.js @@ -219,15 +219,9 @@ var anyVar; var obj0; var obj1 = { p: null, - p3: function () { - return 0; - }, - p6: function (pa1) { - return 0; - }, - p7: function (pa1, pa2) { - return 0; - } + p3: function () { return 0; }, + p6: function (pa1) { return 0; }, + p7: function (pa1, pa2) { return 0; } }; var obj2 = new Object(); var obj3 = new obj0; @@ -247,9 +241,7 @@ var obj13 = new Object(); var obj14 = new obj11; var obj15 = new Base; var obj16 = null; -var obj17 = function () { - return 0; -}; +var obj17 = function () { return 0; }; //var obj18: i2 = function foo() { }; var obj19 = anyVar; var obj20 = new < i2 > anyVar; diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js index a230318dcc9..521a71199ad 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate1.js @@ -38,9 +38,7 @@ var C = (function () { function C() { this.x = 1; } - C.prototype.foo = function (x) { - return x; - }; + C.prototype.foo = function (x) { return x; }; return C; })(); var D = (function (_super) { @@ -48,12 +46,8 @@ var D = (function (_super) { function D() { _super.apply(this, arguments); } - D.prototype.foo = function (x) { - return x; - }; - D.prototype.other = function (x) { - return x; - }; + D.prototype.foo = function (x) { return x; }; + D.prototype.other = function (x) { return x; }; D.prototype.bar = function () { }; return D; })(C); diff --git a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js index b55c6207661..c177f2e7a90 100644 --- a/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js +++ b/tests/baselines/reference/interfaceExtendsClassWithPrivate2.js @@ -34,9 +34,7 @@ var C = (function () { function C() { this.x = 1; } - C.prototype.foo = function (x) { - return x; - }; + C.prototype.foo = function (x) { return x; }; return C; })(); var D = (function (_super) { @@ -46,12 +44,8 @@ var D = (function (_super) { this.x = 2; this.y = 3; } - D.prototype.foo = function (x) { - return x; - }; - D.prototype.other = function (x) { - return x; - }; + D.prototype.foo = function (x) { return x; }; + D.prototype.other = function (x) { return x; }; D.prototype.bar = function () { }; return D; })(C); @@ -61,12 +55,8 @@ var D2 = (function (_super) { _super.apply(this, arguments); this.x = ""; } - D2.prototype.foo = function (x) { - return x; - }; - D2.prototype.other = function (x) { - return x; - }; + D2.prototype.foo = function (x) { return x; }; + D2.prototype.other = function (x) { return x; }; D2.prototype.bar = function () { }; return D2; })(C); diff --git a/tests/baselines/reference/interfaceImplementation5.js b/tests/baselines/reference/interfaceImplementation5.js index 1edfdeb8294..c710eda84f5 100644 --- a/tests/baselines/reference/interfaceImplementation5.js +++ b/tests/baselines/reference/interfaceImplementation5.js @@ -36,9 +36,7 @@ var C1 = (function () { function C1() { } Object.defineProperty(C1.prototype, "getset1", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); @@ -58,9 +56,7 @@ var C3 = (function () { function C3() { } Object.defineProperty(C3.prototype, "getset1", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (baz) { }, enumerable: true, configurable: true @@ -71,10 +67,7 @@ var C4 = (function () { function C4() { } Object.defineProperty(C4.prototype, "getset1", { - get: function () { - var x; - return x; - }, + get: function () { var x; return x; }, enumerable: true, configurable: true }); @@ -94,10 +87,7 @@ var C6 = (function () { function C6() { } Object.defineProperty(C6.prototype, "getset1", { - get: function () { - var x; - return x; - }, + get: function () { var x; return x; }, set: function (baz) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/interfaceImplementation7.js b/tests/baselines/reference/interfaceImplementation7.js index 6345fe93a33..2813d7ee0fe 100644 --- a/tests/baselines/reference/interfaceImplementation7.js +++ b/tests/baselines/reference/interfaceImplementation7.js @@ -14,8 +14,6 @@ class C1 implements i4 { var C1 = (function () { function C1() { } - C1.prototype.name = function () { - return ""; - }; + C1.prototype.name = function () { return ""; }; return C1; })(); diff --git a/tests/baselines/reference/interfaceSubtyping.js b/tests/baselines/reference/interfaceSubtyping.js index 840ce79d869..43004985782 100644 --- a/tests/baselines/reference/interfaceSubtyping.js +++ b/tests/baselines/reference/interfaceSubtyping.js @@ -14,8 +14,6 @@ var Camera = (function () { function Camera(str) { this.str = str; } - Camera.prototype.foo = function () { - return "s"; - }; + Camera.prototype.foo = function () { return "s"; }; return Camera; })(); diff --git a/tests/baselines/reference/invalidMultipleVariableDeclarations.js b/tests/baselines/reference/invalidMultipleVariableDeclarations.js index fe3d62c4ba5..824bee92227 100644 --- a/tests/baselines/reference/invalidMultipleVariableDeclarations.js +++ b/tests/baselines/reference/invalidMultipleVariableDeclarations.js @@ -77,9 +77,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -88,9 +86,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); // all of these are errors diff --git a/tests/baselines/reference/invalidReturnStatements.js b/tests/baselines/reference/invalidReturnStatements.js index 9dc30431326..d637158780a 100644 --- a/tests/baselines/reference/invalidReturnStatements.js +++ b/tests/baselines/reference/invalidReturnStatements.js @@ -46,9 +46,5 @@ var D = (function (_super) { } return D; })(C); -function fn10() { - return { id: 12 }; -} -function fn11() { - return new C(); -} +function fn10() { return { id: 12 }; } +function fn11() { return new C(); } diff --git a/tests/baselines/reference/invalidStaticField.js b/tests/baselines/reference/invalidStaticField.js index 5521af05c83..620c019fc18 100644 --- a/tests/baselines/reference/invalidStaticField.js +++ b/tests/baselines/reference/invalidStaticField.js @@ -6,9 +6,7 @@ class B { static NOT_NULL = new B(); } var A = (function () { function A() { } - A.prototype.foo = function () { - return B.NULL; - }; + A.prototype.foo = function () { return B.NULL; }; return A; })(); var B = (function () { diff --git a/tests/baselines/reference/ipromise4.js b/tests/baselines/reference/ipromise4.js index bb8a3f12e0b..98660aa5824 100644 --- a/tests/baselines/reference/ipromise4.js +++ b/tests/baselines/reference/ipromise4.js @@ -19,8 +19,4 @@ p.then(function (x) { return "hello"; } ).then(function (x) { return x } ); // s //// [ipromise4.js] var p = null; p.then(function (x) { }); // should not error -p.then(function (x) { - return "hello"; -}).then(function (x) { - return x; -}); // should not error +p.then(function (x) { return "hello"; }).then(function (x) { return x; }); // should not error diff --git a/tests/baselines/reference/lift.js b/tests/baselines/reference/lift.js index 21c09aaeb53..33f8200530b 100644 --- a/tests/baselines/reference/lift.js +++ b/tests/baselines/reference/lift.js @@ -37,11 +37,7 @@ var C = (function (_super) { var x = 10 + w; var ll = x * w; } - C.prototype.liftxyz = function () { - return x + z + this.y; - }; - C.prototype.liftxylocllz = function () { - return x + z + this.y + this.ll; - }; + C.prototype.liftxyz = function () { return x + z + this.y; }; + C.prototype.liftxylocllz = function () { return x + z + this.y + this.ll; }; return C; })(B); diff --git a/tests/baselines/reference/logicalNotOperatorWithBooleanType.js b/tests/baselines/reference/logicalNotOperatorWithBooleanType.js index 0f3c39a09ff..107bd9a88ec 100644 --- a/tests/baselines/reference/logicalNotOperatorWithBooleanType.js +++ b/tests/baselines/reference/logicalNotOperatorWithBooleanType.js @@ -41,15 +41,11 @@ var ResultIsBoolean = !!BOOLEAN; //// [logicalNotOperatorWithBooleanType.js] // ! operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/logicalNotOperatorWithNumberType.js b/tests/baselines/reference/logicalNotOperatorWithNumberType.js index 48e1468285e..0d0601cad23 100644 --- a/tests/baselines/reference/logicalNotOperatorWithNumberType.js +++ b/tests/baselines/reference/logicalNotOperatorWithNumberType.js @@ -49,15 +49,11 @@ var ResultIsBoolean13 = !!!(NUMBER + NUMBER); // ! operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -71,9 +67,7 @@ var ResultIsBoolean2 = !NUMBER1; // number type literal var ResultIsBoolean3 = !1; var ResultIsBoolean4 = !{ x: 1, y: 2 }; -var ResultIsBoolean5 = !{ x: 1, y: function (n) { - return n; -} }; +var ResultIsBoolean5 = !{ x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsBoolean6 = !objA.a; var ResultIsBoolean7 = !M.n; diff --git a/tests/baselines/reference/logicalNotOperatorWithStringType.js b/tests/baselines/reference/logicalNotOperatorWithStringType.js index 1bab5de239d..7f75814d601 100644 --- a/tests/baselines/reference/logicalNotOperatorWithStringType.js +++ b/tests/baselines/reference/logicalNotOperatorWithStringType.js @@ -48,15 +48,11 @@ var ResultIsBoolean14 = !!!(STRING + STRING); // ! operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -70,9 +66,7 @@ var ResultIsBoolean2 = !STRING1; // string type literal var ResultIsBoolean3 = !""; var ResultIsBoolean4 = !{ x: "", y: "" }; -var ResultIsBoolean5 = !{ x: "", y: function (s) { - return s; -} }; +var ResultIsBoolean5 = !{ x: "", y: function (s) { return s; } }; // string type expressions var ResultIsBoolean6 = !objA.a; var ResultIsBoolean7 = !M.n; diff --git a/tests/baselines/reference/maxConstraints.js b/tests/baselines/reference/maxConstraints.js index 4ea37d30501..b2098ccaf2b 100644 --- a/tests/baselines/reference/maxConstraints.js +++ b/tests/baselines/reference/maxConstraints.js @@ -9,7 +9,5 @@ var max2: Comparer = (x, y) => { return (x.compareTo(y) > 0) ? x : y }; var maxResult = max2(1, 2); //// [maxConstraints.js] -var max2 = function (x, y) { - return (x.compareTo(y) > 0) ? x : y; -}; +var max2 = function (x, y) { return (x.compareTo(y) > 0) ? x : y; }; var maxResult = max2(1, 2); diff --git a/tests/baselines/reference/missingSelf.js b/tests/baselines/reference/missingSelf.js index c2c1e04ad5c..56dcc4f9fa0 100644 --- a/tests/baselines/reference/missingSelf.js +++ b/tests/baselines/reference/missingSelf.js @@ -22,9 +22,7 @@ c2.b(); var CalcButton = (function () { function CalcButton() { } - CalcButton.prototype.a = function () { - this.onClick(); - }; + CalcButton.prototype.a = function () { this.onClick(); }; CalcButton.prototype.onClick = function () { }; return CalcButton; })(); diff --git a/tests/baselines/reference/modFunctionCrash.js b/tests/baselines/reference/modFunctionCrash.js index f216788c0eb..0d4f62eae63 100644 --- a/tests/baselines/reference/modFunctionCrash.js +++ b/tests/baselines/reference/modFunctionCrash.js @@ -7,6 +7,4 @@ declare module Q { Q.f(function() {this;}); //// [modFunctionCrash.js] -Q.f(function () { - this; -}); +Q.f(function () { this; }); diff --git a/tests/baselines/reference/moduleReopenedTypeOtherBlock.js b/tests/baselines/reference/moduleReopenedTypeOtherBlock.js index d2dc938872a..951c558ddfd 100644 --- a/tests/baselines/reference/moduleReopenedTypeOtherBlock.js +++ b/tests/baselines/reference/moduleReopenedTypeOtherBlock.js @@ -23,9 +23,7 @@ var M; var C2 = (function () { function C2() { } - C2.prototype.f = function () { - return null; - }; + C2.prototype.f = function () { return null; }; return C2; })(); M.C2 = C2; diff --git a/tests/baselines/reference/moduleReopenedTypeSameBlock.js b/tests/baselines/reference/moduleReopenedTypeSameBlock.js index c3546f20b2f..92e7e9e5228 100644 --- a/tests/baselines/reference/moduleReopenedTypeSameBlock.js +++ b/tests/baselines/reference/moduleReopenedTypeSameBlock.js @@ -21,9 +21,7 @@ var M; var C2 = (function () { function C2() { } - C2.prototype.f = function () { - return null; - }; + C2.prototype.f = function () { return null; }; return C2; })(); M.C2 = C2; diff --git a/tests/baselines/reference/moduleSymbolMerging.js b/tests/baselines/reference/moduleSymbolMerging.js index 0a812a62e09..d43fff1378a 100644 --- a/tests/baselines/reference/moduleSymbolMerging.js +++ b/tests/baselines/reference/moduleSymbolMerging.js @@ -22,9 +22,7 @@ var A; })(A || (A = {})); var B; (function (B) { - function f() { - return null; - } + function f() { return null; } B.f = f; })(B || (B = {})); diff --git a/tests/baselines/reference/moduleUnassignedVariable.js b/tests/baselines/reference/moduleUnassignedVariable.js index 179a2577adf..1765342efcd 100644 --- a/tests/baselines/reference/moduleUnassignedVariable.js +++ b/tests/baselines/reference/moduleUnassignedVariable.js @@ -12,11 +12,7 @@ module Bar { var Bar; (function (Bar) { Bar.a = 1; - function fooA() { - return Bar.a; - } // Correct: return Bar.a + function fooA() { return Bar.a; } // Correct: return Bar.a Bar.b; - function fooB() { - return Bar.b; - } // Incorrect: return b + function fooB() { return Bar.b; } // Incorrect: return b })(Bar || (Bar = {})); diff --git a/tests/baselines/reference/moduleVisibilityTest1.js b/tests/baselines/reference/moduleVisibilityTest1.js index d8bdedfafe2..a2957cb9582 100644 --- a/tests/baselines/reference/moduleVisibilityTest1.js +++ b/tests/baselines/reference/moduleVisibilityTest1.js @@ -70,15 +70,11 @@ c.someMethodThatCallsAnOuterMethod(); //// [moduleVisibilityTest1.js] var OuterMod; (function (OuterMod) { - function someExportedOuterFunc() { - return -1; - } + function someExportedOuterFunc() { return -1; } OuterMod.someExportedOuterFunc = someExportedOuterFunc; var OuterInnerMod; (function (OuterInnerMod) { - function someExportedOuterInnerFunc() { - return "foo"; - } + function someExportedOuterInnerFunc() { return "foo"; } OuterInnerMod.someExportedOuterInnerFunc = someExportedOuterInnerFunc; })(OuterInnerMod = OuterMod.OuterInnerMod || (OuterMod.OuterInnerMod = {})); })(OuterMod || (OuterMod = {})); @@ -87,9 +83,7 @@ var M; (function (M) { var InnerMod; (function (InnerMod) { - function someExportedInnerFunc() { - return -2; - } + function someExportedInnerFunc() { return -2; } InnerMod.someExportedInnerFunc = someExportedInnerFunc; })(InnerMod = M.InnerMod || (M.InnerMod = {})); (function (E) { @@ -109,30 +103,18 @@ var M; var C = (function () { function C() { this.someProp = 1; - function someInnerFunc() { - return 2; - } + function someInnerFunc() { return 2; } var someInnerVar = 3; } - C.prototype.someMethodThatCallsAnOuterMethod = function () { - return OuterInnerAlias.someExportedOuterInnerFunc(); - }; - C.prototype.someMethodThatCallsAnInnerMethod = function () { - return InnerMod.someExportedInnerFunc(); - }; - C.prototype.someMethodThatCallsAnOuterInnerMethod = function () { - return OuterMod.someExportedOuterFunc(); - }; - C.prototype.someMethod = function () { - return 0; - }; + C.prototype.someMethodThatCallsAnOuterMethod = function () { return OuterInnerAlias.someExportedOuterInnerFunc(); }; + C.prototype.someMethodThatCallsAnInnerMethod = function () { return InnerMod.someExportedInnerFunc(); }; + C.prototype.someMethodThatCallsAnOuterInnerMethod = function () { return OuterMod.someExportedOuterFunc(); }; + C.prototype.someMethod = function () { return 0; }; return C; })(); M.C = C; var someModuleVar = 4; - function someModuleFunction() { - return 5; - } + function someModuleFunction() { return 5; } })(M || (M = {})); var M; (function (M) { diff --git a/tests/baselines/reference/moduleVisibilityTest2.js b/tests/baselines/reference/moduleVisibilityTest2.js index 63ecaf0c135..9102bd17ae2 100644 --- a/tests/baselines/reference/moduleVisibilityTest2.js +++ b/tests/baselines/reference/moduleVisibilityTest2.js @@ -71,15 +71,11 @@ c.someMethodThatCallsAnOuterMethod(); //// [moduleVisibilityTest2.js] var OuterMod; (function (OuterMod) { - function someExportedOuterFunc() { - return -1; - } + function someExportedOuterFunc() { return -1; } OuterMod.someExportedOuterFunc = someExportedOuterFunc; var OuterInnerMod; (function (OuterInnerMod) { - function someExportedOuterInnerFunc() { - return "foo"; - } + function someExportedOuterInnerFunc() { return "foo"; } OuterInnerMod.someExportedOuterInnerFunc = someExportedOuterInnerFunc; })(OuterInnerMod = OuterMod.OuterInnerMod || (OuterMod.OuterInnerMod = {})); })(OuterMod || (OuterMod = {})); @@ -88,9 +84,7 @@ var M; (function (M) { var InnerMod; (function (InnerMod) { - function someExportedInnerFunc() { - return -2; - } + function someExportedInnerFunc() { return -2; } InnerMod.someExportedInnerFunc = someExportedInnerFunc; })(InnerMod || (InnerMod = {})); var E; @@ -110,30 +104,18 @@ var M; var C = (function () { function C() { this.someProp = 1; - function someInnerFunc() { - return 2; - } + function someInnerFunc() { return 2; } var someInnerVar = 3; } - C.prototype.someMethodThatCallsAnOuterMethod = function () { - return OuterInnerAlias.someExportedOuterInnerFunc(); - }; - C.prototype.someMethodThatCallsAnInnerMethod = function () { - return InnerMod.someExportedInnerFunc(); - }; - C.prototype.someMethodThatCallsAnOuterInnerMethod = function () { - return OuterMod.someExportedOuterFunc(); - }; - C.prototype.someMethod = function () { - return 0; - }; + C.prototype.someMethodThatCallsAnOuterMethod = function () { return OuterInnerAlias.someExportedOuterInnerFunc(); }; + C.prototype.someMethodThatCallsAnInnerMethod = function () { return InnerMod.someExportedInnerFunc(); }; + C.prototype.someMethodThatCallsAnOuterInnerMethod = function () { return OuterMod.someExportedOuterFunc(); }; + C.prototype.someMethod = function () { return 0; }; return C; })(); M.C = C; var someModuleVar = 4; - function someModuleFunction() { - return 5; - } + function someModuleFunction() { return 5; } })(M || (M = {})); var M; (function (M) { diff --git a/tests/baselines/reference/multiModuleClodule1.js b/tests/baselines/reference/multiModuleClodule1.js index 8fa142812cd..9f6d7b5014c 100644 --- a/tests/baselines/reference/multiModuleClodule1.js +++ b/tests/baselines/reference/multiModuleClodule1.js @@ -36,9 +36,7 @@ var C; (function (C) { function foo() { } C.foo = foo; - function baz() { - return ''; - } + function baz() { return ''; } })(C || (C = {})); var c = new C(C.x); c.foo = C.foo; diff --git a/tests/baselines/reference/multipleInheritance.js b/tests/baselines/reference/multipleInheritance.js index 9cab77f3dba..269d5c2ea19 100644 --- a/tests/baselines/reference/multipleInheritance.js +++ b/tests/baselines/reference/multipleInheritance.js @@ -97,13 +97,9 @@ var ND = (function (_super) { })(N); var Good = (function () { function Good() { - this.f = function () { - return 0; - }; + this.f = function () { return 0; }; } - Good.prototype.g = function () { - return 0; - }; + Good.prototype.g = function () { return 0; }; return Good; })(); var Baad = (function (_super) { @@ -111,11 +107,7 @@ var Baad = (function (_super) { function Baad() { _super.apply(this, arguments); } - Baad.prototype.f = function () { - return 0; - }; - Baad.prototype.g = function (n) { - return 0; - }; + Baad.prototype.f = function () { return 0; }; + Baad.prototype.g = function (n) { return 0; }; return Baad; })(Good); diff --git a/tests/baselines/reference/mutrec.js b/tests/baselines/reference/mutrec.js index ba6c8ade036..1d1ccb4e90b 100644 --- a/tests/baselines/reference/mutrec.js +++ b/tests/baselines/reference/mutrec.js @@ -43,15 +43,11 @@ g(i4); //// [mutrec.js] -function f(p) { - return p; -} +function f(p) { return p; } ; var b; f(b); -function g(p) { - return p; -} +function g(p) { return p; } ; var i2; g(i2); diff --git a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js index 585a3d2178b..76fd13aa320 100644 --- a/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js +++ b/tests/baselines/reference/mutuallyRecursiveGenericBaseTypes2.js @@ -20,9 +20,7 @@ var __extends = this.__extends || function (d, b) { var foo = (function () { function foo() { } - foo.prototype.bar = function () { - return null; - }; + foo.prototype.bar = function () { return null; }; return foo; })(); var foo2 = (function (_super) { diff --git a/tests/baselines/reference/nameCollisionsInPropertyAssignments.js b/tests/baselines/reference/nameCollisionsInPropertyAssignments.js index 3035ab6e628..1f3631e03ba 100644 --- a/tests/baselines/reference/nameCollisionsInPropertyAssignments.js +++ b/tests/baselines/reference/nameCollisionsInPropertyAssignments.js @@ -4,6 +4,4 @@ var y = { x() { x++; } }; //// [nameCollisionsInPropertyAssignments.js] var x = 1; -var y = { x: function () { - x++; -} }; +var y = { x: function () { x++; } }; diff --git a/tests/baselines/reference/negateOperatorWithBooleanType.js b/tests/baselines/reference/negateOperatorWithBooleanType.js index ce7b14b2d82..9442f54490f 100644 --- a/tests/baselines/reference/negateOperatorWithBooleanType.js +++ b/tests/baselines/reference/negateOperatorWithBooleanType.js @@ -38,15 +38,11 @@ var ResultIsNumber7 = -A.foo(); //// [negateOperatorWithBooleanType.js] // - operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/negateOperatorWithNumberType.js b/tests/baselines/reference/negateOperatorWithNumberType.js index 15e0eeca435..5fa83e088c8 100644 --- a/tests/baselines/reference/negateOperatorWithNumberType.js +++ b/tests/baselines/reference/negateOperatorWithNumberType.js @@ -45,15 +45,11 @@ var ResultIsNumber11 = -(NUMBER - NUMBER); // - operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -67,9 +63,7 @@ var ResultIsNumber2 = -NUMBER1; // number type literal var ResultIsNumber3 = -1; var ResultIsNumber4 = -{ x: 1, y: 2 }; -var ResultIsNumber5 = -{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = -{ x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsNumber6 = -objA.a; var ResultIsNumber7 = -M.n; diff --git a/tests/baselines/reference/negateOperatorWithStringType.js b/tests/baselines/reference/negateOperatorWithStringType.js index 228733b65c5..bdbc4a3d664 100644 --- a/tests/baselines/reference/negateOperatorWithStringType.js +++ b/tests/baselines/reference/negateOperatorWithStringType.js @@ -44,15 +44,11 @@ var ResultIsNumber12 = -STRING.charAt(0); // - operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -66,9 +62,7 @@ var ResultIsNumber2 = -STRING1; // string type literal var ResultIsNumber3 = -""; var ResultIsNumber4 = -{ x: "", y: "" }; -var ResultIsNumber5 = -{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber5 = -{ x: "", y: function (s) { return s; } }; // string type expressions var ResultIsNumber6 = -objA.a; var ResultIsNumber7 = -M.n; diff --git a/tests/baselines/reference/nestedSelf.js b/tests/baselines/reference/nestedSelf.js index 897bdd720e7..9c0feaa887f 100644 --- a/tests/baselines/reference/nestedSelf.js +++ b/tests/baselines/reference/nestedSelf.js @@ -17,9 +17,7 @@ var M; } C.prototype.foo = function () { var _this = this; - [1, 2, 3].map(function (x) { - return _this.n * x; - }); + [1, 2, 3].map(function (x) { return _this.n * x; }); }; return C; })(); diff --git a/tests/baselines/reference/newOperatorErrorCases.js b/tests/baselines/reference/newOperatorErrorCases.js index 8a44d51fb5c..b893beba02a 100644 --- a/tests/baselines/reference/newOperatorErrorCases.js +++ b/tests/baselines/reference/newOperatorErrorCases.js @@ -65,7 +65,5 @@ var c1 = new T; var c1; var c2 = new T(); // Parse error // Construct expression of non-void returning function -function fnNumber() { - return 32; -} +function fnNumber() { return 32; } var s = new fnNumber(); // Error diff --git a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.js b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.js index d144a78fae3..bdb55633682 100644 --- a/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.js +++ b/tests/baselines/reference/noCollisionThisExpressionAndLocalVarInFunction.js @@ -11,7 +11,5 @@ function x() { var console; function x() { var _this = 5; - (function (x) { - console.log(_this); - }); + (function (x) { console.log(_this); }); } diff --git a/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.js b/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.js index c34ad4c97bd..b3677681822 100644 --- a/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.js +++ b/tests/baselines/reference/noCollisionThisExpressionInFunctionAndVarInGlobal.js @@ -12,7 +12,5 @@ var console; var _this = 5; function x() { var _this = this; - (function (x) { - console.log(_this); - }); + (function (x) { console.log(_this); }); } diff --git a/tests/baselines/reference/noConstraintInReturnType1.js b/tests/baselines/reference/noConstraintInReturnType1.js index 747cbfdf758..0402f9d83cb 100644 --- a/tests/baselines/reference/noConstraintInReturnType1.js +++ b/tests/baselines/reference/noConstraintInReturnType1.js @@ -8,9 +8,7 @@ class List { var List = (function () { function List() { } - List.empty = function () { - return null; - }; + List.empty = function () { return null; }; return List; })(); diff --git a/tests/baselines/reference/noImplicitAnyWithOverloads.js b/tests/baselines/reference/noImplicitAnyWithOverloads.js index c2e9f174ada..fd56b6e0d73 100644 --- a/tests/baselines/reference/noImplicitAnyWithOverloads.js +++ b/tests/baselines/reference/noImplicitAnyWithOverloads.js @@ -11,6 +11,4 @@ callb((a) => { a.foo; }); // error, chose first overload //// [noImplicitAnyWithOverloads.js] function callb(a) { } -callb(function (a) { - a.foo; -}); // error, chose first overload +callb(function (a) { a.foo; }); // error, chose first overload diff --git a/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js index 8afbb0c6201..c32cd84ce26 100644 --- a/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js +++ b/tests/baselines/reference/nullIsSubtypeOfEverythingButUndefined.js @@ -112,12 +112,8 @@ var r6 = true ? { foo: 1 } : null; var r6 = true ? null : { foo: 1 }; var r7 = true ? function () { } : null; var r7 = true ? null : function () { }; -var r8 = true ? function (x) { - return x; -} : null; -var r8b = true ? null : function (x) { - return x; -}; // type parameters not identical across declarations +var r8 = true ? function (x) { return x; } : null; +var r8b = true ? null : function (x) { return x; }; // type parameters not identical across declarations var i1; var r9 = true ? i1 : null; var r9 = true ? null : i1; diff --git a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js index 1cfd94a0c97..0474abef393 100644 --- a/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/numericIndexerConstrainsPropertyDeclarations2.js @@ -56,9 +56,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { @@ -66,9 +64,7 @@ var B = (function (_super) { function B() { _super.apply(this, arguments); } - B.prototype.bar = function () { - return ''; - }; + B.prototype.bar = function () { return ''; }; return B; })(A); var Foo = (function () { diff --git a/tests/baselines/reference/objectLiteralErrors.js b/tests/baselines/reference/objectLiteralErrors.js index 06158cb87c9..4dccc78b67d 100644 --- a/tests/baselines/reference/objectLiteralErrors.js +++ b/tests/baselines/reference/objectLiteralErrors.js @@ -67,69 +67,25 @@ var e15 = { "100": 0, 1e2: 0 }; var e16 = { 0x20: 0, 3.2e1: 0 }; var e17 = { a: 0, b: 1, a: 0 }; // Accessor and property with the same name -var f1 = { a: 0, get a() { - return 0; -} }; -var f2 = { a: '', get a() { - return ''; -} }; -var f3 = { a: 0, get a() { - return ''; -} }; -var f4 = { a: true, get a() { - return false; -} }; -var f5 = { a: {}, get a() { - return {}; -} }; -var f6 = { a: 0, get 'a'() { - return 0; -} }; -var f7 = { 'a': 0, get a() { - return 0; -} }; -var f8 = { 'a': 0, get "a"() { - return 0; -} }; -var f9 = { 'a': 0, get 'a'() { - return 0; -} }; -var f10 = { "a": 0, get 'a'() { - return 0; -} }; -var f11 = { 1.0: 0, get '1'() { - return 0; -} }; -var f12 = { 0: 0, get 0() { - return 0; -} }; -var f13 = { 0: 0, get 0() { - return 0; -} }; -var f14 = { 0: 0, get 0x0() { - return 0; -} }; -var f14 = { 0: 0, get 000() { - return 0; -} }; -var f15 = { "100": 0, get 1e2() { - return 0; -} }; -var f16 = { 0x20: 0, get 3.2e1() { - return 0; -} }; -var f17 = { a: 0, get b() { - return 1; -}, get a() { - return 0; -} }; +var f1 = { a: 0, get a() { return 0; } }; +var f2 = { a: '', get a() { return ''; } }; +var f3 = { a: 0, get a() { return ''; } }; +var f4 = { a: true, get a() { return false; } }; +var f5 = { a: {}, get a() { return {}; } }; +var f6 = { a: 0, get 'a'() { return 0; } }; +var f7 = { 'a': 0, get a() { return 0; } }; +var f8 = { 'a': 0, get "a"() { return 0; } }; +var f9 = { 'a': 0, get 'a'() { return 0; } }; +var f10 = { "a": 0, get 'a'() { return 0; } }; +var f11 = { 1.0: 0, get '1'() { return 0; } }; +var f12 = { 0: 0, get 0() { return 0; } }; +var f13 = { 0: 0, get 0() { return 0; } }; +var f14 = { 0: 0, get 0x0() { return 0; } }; +var f14 = { 0: 0, get 000() { return 0; } }; +var f15 = { "100": 0, get 1e2() { return 0; } }; +var f16 = { 0x20: 0, get 3.2e1() { return 0; } }; +var f17 = { a: 0, get b() { return 1; }, get a() { return 0; } }; // Get and set accessor with mismatched type annotations -var g1 = { get a() { - return 4; -}, set a(n) { } }; -var g2 = { get a() { - return 4; -}, set a(n) { } }; -var g3 = { get a() { - return undefined; -}, set a(n) { } }; +var g1 = { get a() { return 4; }, set a(n) { } }; +var g2 = { get a() { return 4; }, set a(n) { } }; +var g3 = { get a() { return undefined; }, set a(n) { } }; diff --git a/tests/baselines/reference/objectLiteralErrorsES3.js b/tests/baselines/reference/objectLiteralErrorsES3.js index 6543827d9f3..031a68fd109 100644 --- a/tests/baselines/reference/objectLiteralErrorsES3.js +++ b/tests/baselines/reference/objectLiteralErrorsES3.js @@ -7,10 +7,6 @@ var e3 = { get a() { return ''; }, set a(n) { } }; //// [objectLiteralErrorsES3.js] -var e1 = { get a() { - return 4; -} }; +var e1 = { get a() { return 4; } }; var e2 = { set a(n) { } }; -var e3 = { get a() { - return ''; -}, set a(n) { } }; +var e3 = { get a() { return ''; }, set a(n) { } }; diff --git a/tests/baselines/reference/objectLiteralGettersAndSetters.js b/tests/baselines/reference/objectLiteralGettersAndSetters.js index bd261697d5f..d226c2c5569 100644 --- a/tests/baselines/reference/objectLiteralGettersAndSetters.js +++ b/tests/baselines/reference/objectLiteralGettersAndSetters.js @@ -85,62 +85,24 @@ var getParamType3 = { //// [objectLiteralGettersAndSetters.js] // Get and set accessor with the same name -var sameName1a = { get 'a'() { - return ''; -}, set a(n) { - var p = n; - var p; -} }; -var sameName2a = { get 0.0() { - return ''; -}, set 0(n) { - var p = n; - var p; -} }; -var sameName3a = { get 0x20() { - return ''; -}, set 3.2e1(n) { - var p = n; - var p; -} }; -var sameName4a = { get ''() { - return ''; -}, set ""(n) { - var p = n; - var p; -} }; -var sameName5a = { get '\t'() { - return ''; -}, set '\t'(n) { - var p = n; - var p; -} }; -var sameName6a = { get 'a'() { - return ''; -}, set a(n) { - var p = n; - var p; -} }; +var sameName1a = { get 'a'() { return ''; }, set a(n) { var p = n; var p; } }; +var sameName2a = { get 0.0() { return ''; }, set 0(n) { var p = n; var p; } }; +var sameName3a = { get 0x20() { return ''; }, set 3.2e1(n) { var p = n; var p; } }; +var sameName4a = { get ''() { return ''; }, set ""(n) { var p = n; var p; } }; +var sameName5a = { get '\t'() { return ''; }, set '\t'(n) { var p = n; var p; } }; +var sameName6a = { get 'a'() { return ''; }, set a(n) { var p = n; var p; } }; // PropertyName CallSignature{FunctionBody} is equivalent to PropertyName:function CallSignature{FunctionBody} -var callSig1 = { num: function (n) { - return ''; -} }; +var callSig1 = { num: function (n) { return ''; } }; var callSig1; -var callSig2 = { num: function (n) { - return ''; -} }; +var callSig2 = { num: function (n) { return ''; } }; var callSig2; var callSig3 = { num: function (n) { return ''; } }; var callSig3; // Get accessor only, type of the property is the annotated return type of the get accessor -var getter1 = { get x() { - return undefined; -} }; +var getter1 = { get x() { return undefined; } }; var getter1; // Get accessor only, type of the property is the inferred return type of the get accessor -var getter2 = { get x() { - return ''; -} }; +var getter2 = { get x() { return ''; } }; var getter2; // Set accessor only, type of the property is the param type of the set accessor var setter1 = { set x(n) { } }; @@ -150,18 +112,10 @@ var setter2 = { set x(n) { } }; var setter2; var anyVar; // Get and set accessor with matching type annotations -var sameType1 = { get x() { - return undefined; -}, set x(n) { } }; -var sameType2 = { get x() { - return undefined; -}, set x(n) { } }; -var sameType3 = { get x() { - return undefined; -}, set x(n) { } }; -var sameType4 = { get x() { - return undefined; -}, set x(n) { } }; +var sameType1 = { get x() { return undefined; }, set x(n) { } }; +var sameType2 = { get x() { return undefined; }, set x(n) { } }; +var sameType3 = { get x() { return undefined; }, set x(n) { } }; +var sameType4 = { get x() { return undefined; }, set x(n) { } }; // Type of unannotated get accessor return type is the type annotation of the set accessor param var setParamType1 = { set n(x) { }, @@ -187,14 +141,10 @@ var getParamType1 = { var y = x; var y; }, - get n() { - return ''; - } + get n() { return ''; } }; var getParamType2 = { - get n() { - return ''; - }, + get n() { return ''; }, set n(x) { var y = x; var y; @@ -202,9 +152,7 @@ var getParamType2 = { }; // Type of unannotated accessors is the inferred return type of the get accessor var getParamType3 = { - get n() { - return ''; - }, + get n() { return ''; }, set n(x) { var y = x; var y; diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignment.js b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignment.js index c000a30181d..251098eb6c8 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignment.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignment.js @@ -20,15 +20,9 @@ var name = "my name"; var person = { name: name, id: id }; function foo(obj) { } ; -function bar(name, id) { - return { name: name, id: id }; -} -function bar1(name, id) { - return { name: name }; -} -function baz(name, id) { - return { name: name, id: id }; -} +function bar(name, id) { return { name: name, id: id }; } +function bar1(name, id) { return { name: name }; } +function baz(name, id) { return { name: name, id: id }; } foo(person); var person1 = bar("Hello", 5); var person2 = bar("Hello", 5); diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentES6.js b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentES6.js index ee99de6d470..247ec56d127 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentES6.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentES6.js @@ -20,15 +20,9 @@ var name = "my name"; var person = { name, id }; function foo(obj) { } ; -function bar(name, id) { - return { name, id }; -} -function bar1(name, id) { - return { name }; -} -function baz(name, id) { - return { name, id }; -} +function bar(name, id) { return { name, id }; } +function bar1(name, id) { return { name }; } +function baz(name, id) { return { name, id }; } foo(person); var person1 = bar("Hello", 5); var person2 = bar("Hello", 5); diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js index 1bef1cc9554..8e2d7f80356 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentError.js @@ -16,8 +16,6 @@ var name = "my name"; var person = { name: name, id: id }; // error var person1 = name, id; ; // error: can't use short-hand property assignment in type position -function foo(name, id) { - return { name: name, id: id }; -} // error +function foo(name, id) { return { name: name, id: id }; } // error function bar(obj) { } bar({ name: name, id: id }); // error diff --git a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js index b008644116b..71449746add 100644 --- a/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js +++ b/tests/baselines/reference/objectLiteralShorthandPropertiesAssignmentErrorFromMissingIdentifier.js @@ -12,12 +12,8 @@ var person2: { name: string, id: number } = bar("hello", 5); var id = 10000; var name = "my name"; var person = { name: name, id: id }; // error -function bar(name, id) { - return { name: name, id: id }; -} // error -function foo(name, id) { - return { name: name, id: id }; -} // error +function bar(name, id) { return { name: name, id: id }; } // error +function foo(name, id) { return { name: name, id: id }; } // error var person1 = name, id; ; // error : Can't use shorthand in the type position var person2 = bar("hello", 5); diff --git a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.js b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.js index 9c327ca3a38..7a2b5e2ec2f 100644 --- a/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.js +++ b/tests/baselines/reference/objectTypeHidingMembersOfObjectAssignmentCompat2.js @@ -29,9 +29,7 @@ i = o; // error var C = (function () { function C() { } - C.prototype.toString = function () { - return 1; - }; + C.prototype.toString = function () { return 1; }; return C; })(); var c; diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignatures.js b/tests/baselines/reference/objectTypesIdentityWithCallSignatures.js index 21cfc280500..0c6952291f9 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignatures.js +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignatures.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return ''; -} }; +var b = { foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.js b/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.js index 0c7e54ded21..43473d88e0a 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.js +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignatures2.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return ''; -} }; +var b = { foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.js b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.js index 434d1cdd31e..498867f0a02 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.js +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesDifferingParamCounts.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return ''; -} }; +var b = { foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.js b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.js index 52dc447f5fb..54400ad81d1 100644 --- a/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.js +++ b/tests/baselines/reference/objectTypesIdentityWithCallSignaturesWithOverloads.js @@ -121,32 +121,24 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; var b = { - foo: function (x) { - return ''; - } + foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.js b/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.js index b3381ac5825..87067b6be28 100644 --- a/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.js +++ b/tests/baselines/reference/objectTypesIdentityWithConstructSignatures2.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.js b/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.js index 0010d8815b4..c95159ed997 100644 --- a/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.js +++ b/tests/baselines/reference/objectTypesIdentityWithConstructSignaturesDifferingParamCounts.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.js index cc17fcbeaf3..c8bed1a47ab 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return x; -} }; +var b = { foo: function (x) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.js index 0dc2c18d491..6ef5d15fd98 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignatures2.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x, y) { - return x; -} }; +var b = { foo: function (x, y) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.js index b0652b29b7f..2b83064afed 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return ''; -} }; +var b = { foo: function (x) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.js index 3486157840c..1f9c5fa5256 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints2.js @@ -121,39 +121,29 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var D = (function () { function D() { } - D.prototype.foo = function (x, y) { - return null; - }; + D.prototype.foo = function (x, y) { return null; }; return D; })(); var a; -var b = { foo: function (x, y) { - return ''; -} }; +var b = { foo: function (x, y) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.js index 714e7dbf142..21106b56b00 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByConstraints3.js @@ -140,39 +140,29 @@ var Two = (function () { var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var D = (function () { function D() { } - D.prototype.foo = function (x, y) { - return null; - }; + D.prototype.foo = function (x, y) { return null; }; return D; })(); var a; -var b = { foo: function (x, y) { - return ''; -} }; +var b = { foo: function (x, y) { return ''; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.js index e1940c41587..99188347d36 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return null; -} }; +var b = { foo: function (x) { return null; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.js index b4eaf096ec8..10d72bde0b3 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingByReturnType2.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return null; -} }; +var b = { foo: function (x) { return null; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.js index 2c9ad2767d9..5a20dfdecb6 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterCounts.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return x; -} }; +var b = { foo: function (x) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.js index 3e98e5887a9..ec9c786b890 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesDifferingTypeParameterNames.js @@ -105,31 +105,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x) { - return null; - }; + A.prototype.foo = function (x) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x) { - return null; - }; + B.prototype.foo = function (x) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x) { - return null; - }; + C.prototype.foo = function (x) { return null; }; return C; })(); var a; -var b = { foo: function (x) { - return x; -} }; +var b = { foo: function (x) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.js index 36d17758c94..a4af2bc820e 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x, y) { - return x; -} }; +var b = { foo: function (x, y) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.js index 4e58adda1c4..28b2f978b55 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams2.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x, y) { - return x; -} }; +var b = { foo: function (x, y) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.js b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.js index 71842d18781..de9b4859fa1 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericCallSignaturesOptionalParams3.js @@ -109,31 +109,23 @@ function foo15(x: any) { } var A = (function () { function A() { } - A.prototype.foo = function (x, y) { - return null; - }; + A.prototype.foo = function (x, y) { return null; }; return A; })(); var B = (function () { function B() { } - B.prototype.foo = function (x, y) { - return null; - }; + B.prototype.foo = function (x, y) { return null; }; return B; })(); var C = (function () { function C() { } - C.prototype.foo = function (x, y) { - return null; - }; + C.prototype.foo = function (x, y) { return null; }; return C; })(); var a; -var b = { foo: function (x, y) { - return x; -} }; +var b = { foo: function (x, y) { return x; } }; function foo1(x) { } function foo1b(x) { } function foo1c(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.js index 6183be4fb69..fdc67d4b84a 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints.js @@ -92,9 +92,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.js index 59a801134d4..11dcdf0a609 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints2.js @@ -109,9 +109,7 @@ var D = (function () { return D; })(); var a; -var b = { new: function (x, y) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.js index d61edd07382..5c6f59eef24 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByConstraints3.js @@ -128,9 +128,7 @@ var D = (function () { return D; })(); var a; -var b = { new: function (x, y) { - return ''; -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return ''; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.js index b390f7a933b..556d1bcaee0 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType.js @@ -99,9 +99,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return null; -} }; // not a construct signature, function called new +var b = { new: function (x) { return null; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.js index d22cc6b254e..68c32cb0e71 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingByReturnType2.js @@ -95,9 +95,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return null; -} }; // not a construct signature, function called new +var b = { new: function (x) { return null; } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.js index 99d3f8287df..789e02d2d7b 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterCounts.js @@ -87,9 +87,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return x; -} }; +var b = { new: function (x) { return x; } }; function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.js index cd77c1ee3d1..5a501d05834 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesDifferingTypeParameterNames.js @@ -87,9 +87,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x) { - return new C(x); -} }; +var b = { new: function (x) { return new C(x); } }; function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.js index 72b8e7c8d8f..685a8441d97 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x, y) { - return new C(x, y); -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return new C(x, y); } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.js index 1c781f299ce..f16d69acaa1 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams2.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x, y) { - return new C(x, y); -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return new C(x, y); } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.js b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.js index 8c5aca3cb1c..25c628e9e15 100644 --- a/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.js +++ b/tests/baselines/reference/objectTypesIdentityWithGenericConstructSignaturesOptionalParams3.js @@ -91,9 +91,7 @@ var C = (function () { return C; })(); var a; -var b = { new: function (x, y) { - return new C(x, y); -} }; // not a construct signature, function called new +var b = { new: function (x, y) { return new C(x, y); } }; // not a construct signature, function called new function foo1b(x) { } function foo1c(x) { } function foo2(x) { } diff --git a/tests/baselines/reference/optionalAccessorsInInterface1.js b/tests/baselines/reference/optionalAccessorsInInterface1.js index 3ebccc2ea8e..dd274b133e5 100644 --- a/tests/baselines/reference/optionalAccessorsInInterface1.js +++ b/tests/baselines/reference/optionalAccessorsInInterface1.js @@ -17,9 +17,5 @@ defineMyProperty2({}, "name", { get: function () { return 5; } }); //// [optionalAccessorsInInterface1.js] -defineMyProperty({}, "name", { get: function () { - return 5; -} }); -defineMyProperty2({}, "name", { get: function () { - return 5; -} }); +defineMyProperty({}, "name", { get: function () { return 5; } }); +defineMyProperty2({}, "name", { get: function () { return 5; } }); diff --git a/tests/baselines/reference/optionalFunctionArgAssignability.js b/tests/baselines/reference/optionalFunctionArgAssignability.js index bca42060066..c82a47e88da 100644 --- a/tests/baselines/reference/optionalFunctionArgAssignability.js +++ b/tests/baselines/reference/optionalFunctionArgAssignability.js @@ -9,10 +9,6 @@ a = b; // error because number is not assignable to string //// [optionalFunctionArgAssignability.js] -var a = function then(onFulfill, onReject) { - return null; -}; -var b = function then(onFulFill, onReject) { - return null; -}; +var a = function then(onFulfill, onReject) { return null; }; +var b = function then(onFulFill, onReject) { return null; }; a = b; // error because number is not assignable to string diff --git a/tests/baselines/reference/optionalParamArgsTest.js b/tests/baselines/reference/optionalParamArgsTest.js index 6f9b97036ed..202439bc79a 100644 --- a/tests/baselines/reference/optionalParamArgsTest.js +++ b/tests/baselines/reference/optionalParamArgsTest.js @@ -139,12 +139,8 @@ var C1 = (function () { if (p === void 0) { p = 0; } this.n = 0; } - C1.prototype.C1M1 = function () { - return 0; - }; // returning C1M1A1 will result in "Unresolved symbol C1M1A1" - C1.prototype.C1M2 = function (C1M2A1) { - return C1M2A1; - }; // will return C1M1A2 without complaint + C1.prototype.C1M1 = function () { return 0; }; // returning C1M1A1 will result in "Unresolved symbol C1M1A1" + C1.prototype.C1M2 = function (C1M2A1) { return C1M2A1; }; // will return C1M1A2 without complaint // C1M3 contains all optional parameters C1.prototype.C1M3 = function (C1M3A1, C1M3A2) { if (C1M3A1 === void 0) { C1M3A1 = 0; } @@ -152,9 +148,7 @@ var C1 = (function () { return C1M3A1 + C1M3A2; }; // C1M4 contains a mix of optional and non-optional parameters - C1.prototype.C1M4 = function (C1M4A1, C1M4A2) { - return C1M4A1 + C1M4A2; - }; + C1.prototype.C1M4 = function (C1M4A1, C1M4A2) { return C1M4A1 + C1M4A2; }; C1.prototype.C1M5 = function (C1M5A1, C1M5A2, C1M5A3) { if (C1M5A2 === void 0) { C1M5A2 = 0; } return C1M5A1 + C1M5A2; @@ -175,34 +169,22 @@ var C2 = (function (_super) { } return C2; })(C1); -function F1() { - return 0; -} -function F2(F2A1) { - return F2A1; -} +function F1() { return 0; } +function F2(F2A1) { return F2A1; } function F3(F3A1, F3A2) { if (F3A1 === void 0) { F3A1 = 0; } if (F3A2 === void 0) { F3A2 = F3A1; } return F3A1 + F3A2; } -function F4(F4A1, F4A2) { - return F4A1 + F4A2; -} -var L1 = function () { - return 0; -}; -var L2 = function (L2A1) { - return L2A1; -}; +function F4(F4A1, F4A2) { return F4A1 + F4A2; } +var L1 = function () { return 0; }; +var L2 = function (L2A1) { return L2A1; }; var L3 = function (L3A1, L3A2) { if (L3A1 === void 0) { L3A1 = 0; } if (L3A2 === void 0) { L3A2 = L3A1; } return L3A1 + L3A2; }; -var L4 = function (L4A1, L4A2) { - return L4A1 + L4A2; -}; +var L4 = function (L4A1, L4A2) { return L4A1 + L4A2; }; var c1o1 = new C1(5); var i1o1 = new C1(5); // Valid diff --git a/tests/baselines/reference/overloadAssignmentCompat.js b/tests/baselines/reference/overloadAssignmentCompat.js index f6767f6f33e..2d4bd931844 100644 --- a/tests/baselines/reference/overloadAssignmentCompat.js +++ b/tests/baselines/reference/overloadAssignmentCompat.js @@ -65,7 +65,5 @@ function attr2(nameOrMap, value) { return "s"; } } -function foo() { - return "a"; -} +function foo() { return "a"; } ; diff --git a/tests/baselines/reference/overloadCallTest.js b/tests/baselines/reference/overloadCallTest.js index f7eb97fc9eb..38930b7aea3 100644 --- a/tests/baselines/reference/overloadCallTest.js +++ b/tests/baselines/reference/overloadCallTest.js @@ -18,9 +18,7 @@ class foo { //// [overloadCallTest.js] var foo = (function () { function foo() { - function bar(foo) { - return "foo"; - } + function bar(foo) { return "foo"; } ; var test = bar("test"); var goo = bar(); diff --git a/tests/baselines/reference/overloadOnConstNoAnyImplementation2.js b/tests/baselines/reference/overloadOnConstNoAnyImplementation2.js index 6c66c23f1f8..52f6639e352 100644 --- a/tests/baselines/reference/overloadOnConstNoAnyImplementation2.js +++ b/tests/baselines/reference/overloadOnConstNoAnyImplementation2.js @@ -35,15 +35,7 @@ var C = (function () { return C; })(); var c; -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); diff --git a/tests/baselines/reference/overloadOnConstNoStringImplementation2.js b/tests/baselines/reference/overloadOnConstNoStringImplementation2.js index f51f84acb2a..71d7a4e4a3f 100644 --- a/tests/baselines/reference/overloadOnConstNoStringImplementation2.js +++ b/tests/baselines/reference/overloadOnConstNoStringImplementation2.js @@ -34,15 +34,7 @@ var C = (function () { return C; })(); var c; -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); -c.x1(1, function (x) { - return 1; -}); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); +c.x1(1, function (x) { return 1; }); diff --git a/tests/baselines/reference/overloadResolution.js b/tests/baselines/reference/overloadResolution.js index 8737708beda..1ee5e077c08 100644 --- a/tests/baselines/reference/overloadResolution.js +++ b/tests/baselines/reference/overloadResolution.js @@ -127,16 +127,12 @@ var SomeDerived3 = (function (_super) { } return SomeDerived3; })(SomeBase); -function fn1() { - return null; -} +function fn1() { return null; } var s = fn1(undefined); var s; // No candidate overloads found fn1({}); // Error -function fn2() { - return undefined; -} +function fn2() { return undefined; } var d = fn2(0, undefined); var d; // Generic and non - generic overload where generic overload is the only candidate when called without type arguments @@ -145,9 +141,7 @@ var s = fn2(0, ''); fn2('', 0); // Error // Generic and non - generic overload where non - generic overload is the only candidate when called without type arguments fn2('', 0); // OK -function fn3() { - return null; -} +function fn3() { return null; } var s = fn3(3); var s = fn3('', 3, ''); var n = fn3(5, 5, 5); @@ -173,8 +167,6 @@ fn4(null, null); // Error // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4(true, null); // Error fn4(null, true); // Error -function fn5() { - return undefined; -} +function fn5() { return undefined; } var n = fn5(function (n) { return n.toFixed(); }); var s = fn5(function (n) { return n.substr(0); }); diff --git a/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js b/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js index 86e84ced58f..e77e8d3371f 100644 --- a/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js +++ b/tests/baselines/reference/overloadResolutionOverNonCTLambdas.js @@ -48,13 +48,7 @@ var Bugs; return result; } })(Bugs || (Bugs = {})); -function bug3(f) { - return f("s"); -} -function fprime(x) { - return x; -} +function bug3(f) { return f("s"); } +function fprime(x) { return x; } bug3(fprime); -bug3(function (x) { - return x; -}); +bug3(function (x) { return x; }); diff --git a/tests/baselines/reference/overloadResolutionTest1.js b/tests/baselines/reference/overloadResolutionTest1.js index a08243fb27a..60b99ebf7b9 100644 --- a/tests/baselines/reference/overloadResolutionTest1.js +++ b/tests/baselines/reference/overloadResolutionTest1.js @@ -26,23 +26,17 @@ function foo4(bar:{a:any;}):any{ return bar }; var x = foo4({a:true}); // error //// [overloadResolutionTest1.js] -function foo(bar) { - return bar; -} +function foo(bar) { return bar; } ; var x1 = foo([{ a: true }]); // works var x11 = foo([{ a: 0 }]); // works var x111 = foo([{ a: "s" }]); // error - does not match any signature var x1111 = foo([{ a: null }]); // works - ambiguous call is resolved to be the first in the overload set so this returns a string -function foo2(bar) { - return bar; -} +function foo2(bar) { return bar; } ; var x2 = foo2({ a: 0 }); // works var x3 = foo2({ a: true }); // works var x4 = foo2({ a: "s" }); // error -function foo4(bar) { - return bar; -} +function foo4(bar) { return bar; } ; var x = foo4({ a: true }); // error diff --git a/tests/baselines/reference/parameterInitializersForwardReferencing.js b/tests/baselines/reference/parameterInitializersForwardReferencing.js index d810db54695..8ce7fae6874 100644 --- a/tests/baselines/reference/parameterInitializersForwardReferencing.js +++ b/tests/baselines/reference/parameterInitializersForwardReferencing.js @@ -92,8 +92,6 @@ var x = function (a, b, c) { }; // Should not produce errors - can reference later parameters if they occur within a function expression initializer. function f(a, b, c) { - if (b === void 0) { b = function () { - return c; - }; } + if (b === void 0) { b = function () { return c; }; } if (c === void 0) { c = b(); } } diff --git a/tests/baselines/reference/parametersWithNoAnnotationAreAny.js b/tests/baselines/reference/parametersWithNoAnnotationAreAny.js index 48f8d3e520c..a8d06125d25 100644 --- a/tests/baselines/reference/parametersWithNoAnnotationAreAny.js +++ b/tests/baselines/reference/parametersWithNoAnnotationAreAny.js @@ -30,12 +30,8 @@ var b = { } //// [parametersWithNoAnnotationAreAny.js] -function foo(x) { - return x; -} -var f = function foo(x) { - return x; -}; +function foo(x) { return x; } +var f = function foo(x) { return x; }; var f2 = function (x) { return x; }; var f3 = function (x) { return x; }; var C = (function () { diff --git a/tests/baselines/reference/parenthesizedContexualTyping2.js b/tests/baselines/reference/parenthesizedContexualTyping2.js index d5e4e0ebe8f..993a10ba49c 100644 --- a/tests/baselines/reference/parenthesizedContexualTyping2.js +++ b/tests/baselines/reference/parenthesizedContexualTyping2.js @@ -49,80 +49,20 @@ function fun() { } return undefined; } -var a = fun(function (x) { - x(undefined); - return x; -}, 10); -var b = fun((function (x) { - x(undefined); - return x; -}), 10); -var c = fun(((function (x) { - x(undefined); - return x; -})), 10); -var d = fun((((function (x) { - x(undefined); - return x; -}))), 10); -var e = fun(function (x) { - x(undefined); - return x; -}, function (x) { - x(undefined); - return x; -}, 10); -var f = fun((function (x) { - x(undefined); - return x; -}), (function (x) { - x(undefined); - return x; -}), 10); -var g = fun(((function (x) { - x(undefined); - return x; -})), ((function (x) { - x(undefined); - return x; -})), 10); -var h = fun((((function (x) { - x(undefined); - return x; -}))), ((function (x) { - x(undefined); - return x; -})), 10); +var a = fun(function (x) { x(undefined); return x; }, 10); +var b = fun((function (x) { x(undefined); return x; }), 10); +var c = fun(((function (x) { x(undefined); return x; })), 10); +var d = fun((((function (x) { x(undefined); return x; }))), 10); +var e = fun(function (x) { x(undefined); return x; }, function (x) { x(undefined); return x; }, 10); +var f = fun((function (x) { x(undefined); return x; }), (function (x) { x(undefined); return x; }), 10); +var g = fun(((function (x) { x(undefined); return x; })), ((function (x) { x(undefined); return x; })), 10); +var h = fun((((function (x) { x(undefined); return x; }))), ((function (x) { x(undefined); return x; })), 10); // Ternaries in parens -var i = fun((Math.random() < 0.5 ? function (x) { - x(undefined); - return x; -} : function (x) { return undefined; }), 10); -var j = fun((Math.random() < 0.5 ? (function (x) { - x(undefined); - return x; -}) : (function (x) { return undefined; })), 10); -var k = fun((Math.random() < 0.5 ? (function (x) { - x(undefined); - return x; -}) : (function (x) { return undefined; })), function (x) { - x(undefined); - return x; -}, 10); -var l = fun(((Math.random() < 0.5 ? ((function (x) { - x(undefined); - return x; -})) : ((function (x) { return undefined; })))), ((function (x) { - x(undefined); - return x; -})), 10); -var lambda1 = function (x) { - x(undefined); - return x; -}; -var lambda2 = (function (x) { - x(undefined); - return x; -}); +var i = fun((Math.random() < 0.5 ? function (x) { x(undefined); return x; } : function (x) { return undefined; }), 10); +var j = fun((Math.random() < 0.5 ? (function (x) { x(undefined); return x; }) : (function (x) { return undefined; })), 10); +var k = fun((Math.random() < 0.5 ? (function (x) { x(undefined); return x; }) : (function (x) { return undefined; })), function (x) { x(undefined); return x; }, 10); +var l = fun(((Math.random() < 0.5 ? ((function (x) { x(undefined); return x; })) : ((function (x) { return undefined; })))), ((function (x) { x(undefined); return x; })), 10); +var lambda1 = function (x) { x(undefined); return x; }; +var lambda2 = (function (x) { x(undefined); return x; }); var obj1 = { x: function (x) { return (x, undefined); }, y: function (y) { return (y, undefined); } }; var obj2 = ({ x: function (x) { return (x, undefined); }, y: function (y) { return (y, undefined); } }); diff --git a/tests/baselines/reference/parseTypes.js b/tests/baselines/reference/parseTypes.js index 193533de04a..08cc9f2a6bd 100644 --- a/tests/baselines/reference/parseTypes.js +++ b/tests/baselines/reference/parseTypes.js @@ -18,13 +18,9 @@ var x = null; var y = null; var z = null; var w = null; -function f() { - return 3; -} +function f() { return 3; } ; -function g(s) { - true; -} +function g(s) { true; } ; y = f; y = g; diff --git a/tests/baselines/reference/parser15.4.4.14-9-2.js b/tests/baselines/reference/parser15.4.4.14-9-2.js index 9680dbff36b..be7ff5141a5 100644 --- a/tests/baselines/reference/parser15.4.4.14-9-2.js +++ b/tests/baselines/reference/parser15.4.4.14-9-2.js @@ -37,9 +37,7 @@ runTestCase(testcase); * @description Array.prototype.indexOf must return correct index (Number) */ function testcase() { - var obj = { toString: function () { - return 0; - } }; + var obj = { toString: function () { return 0; } }; var one = 1; var _float = -(4 / 3); var a = new Array(false, undefined, null, "0", obj, -1.3333333333333, "str", -0, true, +0, one, 1, 0, false, _float, -(4 / 3)); diff --git a/tests/baselines/reference/parserClass1.js b/tests/baselines/reference/parserClass1.js index 1245da3363f..eb1d17566aa 100644 --- a/tests/baselines/reference/parserClass1.js +++ b/tests/baselines/reference/parserClass1.js @@ -13,21 +13,11 @@ var NullLogger = (function () { function NullLogger() { } - NullLogger.prototype.information = function () { - return false; - }; - NullLogger.prototype.debug = function () { - return false; - }; - NullLogger.prototype.warning = function () { - return false; - }; - NullLogger.prototype.error = function () { - return false; - }; - NullLogger.prototype.fatal = function () { - return false; - }; + NullLogger.prototype.information = function () { return false; }; + NullLogger.prototype.debug = function () { return false; }; + NullLogger.prototype.warning = function () { return false; }; + NullLogger.prototype.error = function () { return false; }; + NullLogger.prototype.fatal = function () { return false; }; NullLogger.prototype.log = function (s) { }; return NullLogger; diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js index c26b16b5a0a..ae2509c3f49 100644 --- a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable1.js @@ -41,9 +41,7 @@ var Shapes; this.con = "hello"; } // Instance member - Point.prototype.getDist = function () { - return Math.sqrt(this.x * this.x + this.y * this.y); - }; + Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; // Static member Point.origin = new Point(0, 0); return Point; diff --git a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js index 866f96a8030..4936b1ea8bc 100644 --- a/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js +++ b/tests/baselines/reference/parserErrorRecovery_IncompleteMemberVariable2.js @@ -41,9 +41,7 @@ var Shapes; this.con = "hello"; } // Instance member - Point.prototype.getDist = function () { - return Math.sqrt(this.x * this.x + this.y * this.y); - }; + Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; // Static member Point.origin = new Point(0, 0); return Point; diff --git a/tests/baselines/reference/parserRealSource1.js b/tests/baselines/reference/parserRealSource1.js index c62897c9aff..d19c2242f0b 100644 --- a/tests/baselines/reference/parserRealSource1.js +++ b/tests/baselines/reference/parserRealSource1.js @@ -189,21 +189,11 @@ var TypeScript; var NullLogger = (function () { function NullLogger() { } - NullLogger.prototype.information = function () { - return false; - }; - NullLogger.prototype.debug = function () { - return false; - }; - NullLogger.prototype.warning = function () { - return false; - }; - NullLogger.prototype.error = function () { - return false; - }; - NullLogger.prototype.fatal = function () { - return false; - }; + NullLogger.prototype.information = function () { return false; }; + NullLogger.prototype.debug = function () { return false; }; + NullLogger.prototype.warning = function () { return false; }; + NullLogger.prototype.error = function () { return false; }; + NullLogger.prototype.fatal = function () { return false; }; NullLogger.prototype.log = function (s) { }; return NullLogger; @@ -218,21 +208,11 @@ var TypeScript; this._error = this.logger.error(); this._fatal = this.logger.fatal(); } - LoggerAdapter.prototype.information = function () { - return this._information; - }; - LoggerAdapter.prototype.debug = function () { - return this._debug; - }; - LoggerAdapter.prototype.warning = function () { - return this._warning; - }; - LoggerAdapter.prototype.error = function () { - return this._error; - }; - LoggerAdapter.prototype.fatal = function () { - return this._fatal; - }; + LoggerAdapter.prototype.information = function () { return this._information; }; + LoggerAdapter.prototype.debug = function () { return this._debug; }; + LoggerAdapter.prototype.warning = function () { return this._warning; }; + LoggerAdapter.prototype.error = function () { return this._error; }; + LoggerAdapter.prototype.fatal = function () { return this._fatal; }; LoggerAdapter.prototype.log = function (s) { this.logger.log(s); }; @@ -243,21 +223,11 @@ var TypeScript; function BufferedLogger() { this.logContents = []; } - BufferedLogger.prototype.information = function () { - return false; - }; - BufferedLogger.prototype.debug = function () { - return false; - }; - BufferedLogger.prototype.warning = function () { - return false; - }; - BufferedLogger.prototype.error = function () { - return false; - }; - BufferedLogger.prototype.fatal = function () { - return false; - }; + BufferedLogger.prototype.information = function () { return false; }; + BufferedLogger.prototype.debug = function () { return false; }; + BufferedLogger.prototype.warning = function () { return false; }; + BufferedLogger.prototype.error = function () { return false; }; + BufferedLogger.prototype.fatal = function () { return false; }; BufferedLogger.prototype.log = function (s) { this.logContents.push(s); }; diff --git a/tests/baselines/reference/parserRealSource11.js b/tests/baselines/reference/parserRealSource11.js index 0574c52eaaa..a45eb7580ad 100644 --- a/tests/baselines/reference/parserRealSource11.js +++ b/tests/baselines/reference/parserRealSource11.js @@ -2397,18 +2397,10 @@ var TypeScript; this.postComments = null; this.isParenthesized = false; } - AST.prototype.isExpression = function () { - return false; - }; - AST.prototype.isStatementOrExpression = function () { - return false; - }; - AST.prototype.isCompoundStatement = function () { - return false; - }; - AST.prototype.isLeaf = function () { - return this.isStatementOrExpression() && (!this.isCompoundStatement()); - }; + AST.prototype.isExpression = function () { return false; }; + AST.prototype.isStatementOrExpression = function () { return false; }; + AST.prototype.isCompoundStatement = function () { return false; }; + AST.prototype.isLeaf = function () { return this.isStatementOrExpression() && (!this.isCompoundStatement()); }; AST.prototype.typeCheck = function (typeFlow) { switch (this.nodeType) { case NodeType.Error: @@ -2643,12 +2635,8 @@ var TypeScript; this.text = actualText; } }; - Identifier.prototype.isMissing = function () { - return false; - }; - Identifier.prototype.isLeaf = function () { - return true; - }; + Identifier.prototype.isMissing = function () { return false; }; + Identifier.prototype.isLeaf = function () { return true; }; Identifier.prototype.treeViewLabel = function () { return "id: " + this.actualText; }; @@ -2692,9 +2680,7 @@ var TypeScript; _super.call(this, NodeType.Label); this.id = id; } - Label.prototype.printLabel = function () { - return this.id.actualText + ":"; - }; + Label.prototype.printLabel = function () { return this.id.actualText + ":"; }; Label.prototype.typeCheck = function (typeFlow) { this.type = typeFlow.voidType; return this; @@ -2717,12 +2703,8 @@ var TypeScript; function Expression(nodeType) { _super.call(this, nodeType); } - Expression.prototype.isExpression = function () { - return true; - }; - Expression.prototype.isStatementOrExpression = function () { - return true; - }; + Expression.prototype.isExpression = function () { return true; }; + Expression.prototype.isStatementOrExpression = function () { return true; }; return Expression; })(AST); TypeScript.Expression = Expression; @@ -3183,9 +3165,7 @@ var TypeScript; this.varFlags = VarFlags.None; this.isDynamicImport = false; } - ImportDeclaration.prototype.isStatementOrExpression = function () { - return true; - }; + ImportDeclaration.prototype.isStatementOrExpression = function () { return true; }; ImportDeclaration.prototype.emit = function (emitter, tokenId, startLine) { var mod = this.alias.type; // REVIEW: Only modules may be aliased for now, though there's no real @@ -3246,18 +3226,10 @@ var TypeScript; this.varFlags = VarFlags.None; this.sym = null; } - BoundDecl.prototype.isStatementOrExpression = function () { - return true; - }; - BoundDecl.prototype.isPrivate = function () { - return hasFlag(this.varFlags, VarFlags.Private); - }; - BoundDecl.prototype.isPublic = function () { - return hasFlag(this.varFlags, VarFlags.Public); - }; - BoundDecl.prototype.isProperty = function () { - return hasFlag(this.varFlags, VarFlags.Property); - }; + BoundDecl.prototype.isStatementOrExpression = function () { return true; }; + BoundDecl.prototype.isPrivate = function () { return hasFlag(this.varFlags, VarFlags.Private); }; + BoundDecl.prototype.isPublic = function () { return hasFlag(this.varFlags, VarFlags.Public); }; + BoundDecl.prototype.isProperty = function () { return hasFlag(this.varFlags, VarFlags.Property); }; BoundDecl.prototype.typeCheck = function (typeFlow) { return typeFlow.typeCheckBoundDecl(this); }; @@ -3272,15 +3244,9 @@ var TypeScript; function VarDecl(id, nest) { _super.call(this, id, NodeType.VarDecl, nest); } - VarDecl.prototype.isAmbient = function () { - return hasFlag(this.varFlags, VarFlags.Ambient); - }; - VarDecl.prototype.isExported = function () { - return hasFlag(this.varFlags, VarFlags.Exported); - }; - VarDecl.prototype.isStatic = function () { - return hasFlag(this.varFlags, VarFlags.Static); - }; + VarDecl.prototype.isAmbient = function () { return hasFlag(this.varFlags, VarFlags.Ambient); }; + VarDecl.prototype.isExported = function () { return hasFlag(this.varFlags, VarFlags.Exported); }; + VarDecl.prototype.isStatic = function () { return hasFlag(this.varFlags, VarFlags.Static); }; VarDecl.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitJavascriptVarDecl(this, tokenId); }; @@ -3297,9 +3263,7 @@ var TypeScript; this.isOptional = false; this.parameterPropertySym = null; } - ArgDecl.prototype.isOptionalArg = function () { - return this.isOptional || this.init; - }; + ArgDecl.prototype.isOptionalArg = function () { return this.isOptional || this.init; }; ArgDecl.prototype.treeViewLabel = function () { return "arg: " + this.id.actualText; }; @@ -3360,12 +3324,8 @@ var TypeScript; } return this.internalNameCache; }; - FuncDecl.prototype.hasSelfReference = function () { - return hasFlag(this.fncFlags, FncFlags.HasSelfReference); - }; - FuncDecl.prototype.setHasSelfReference = function () { - this.fncFlags |= FncFlags.HasSelfReference; - }; + FuncDecl.prototype.hasSelfReference = function () { return hasFlag(this.fncFlags, FncFlags.HasSelfReference); }; + FuncDecl.prototype.setHasSelfReference = function () { this.fncFlags |= FncFlags.HasSelfReference; }; FuncDecl.prototype.addCloRef = function (id, sym) { if (this.envids == null) { this.envids = new Identifier[]; @@ -3419,45 +3379,19 @@ var TypeScript; FuncDecl.prototype.isMethod = function () { return (this.fncFlags & FncFlags.Method) != FncFlags.None; }; - FuncDecl.prototype.isCallMember = function () { - return hasFlag(this.fncFlags, FncFlags.CallMember); - }; - FuncDecl.prototype.isConstructMember = function () { - return hasFlag(this.fncFlags, FncFlags.ConstructMember); - }; - FuncDecl.prototype.isIndexerMember = function () { - return hasFlag(this.fncFlags, FncFlags.IndexerMember); - }; - FuncDecl.prototype.isSpecialFn = function () { - return this.isCallMember() || this.isIndexerMember() || this.isConstructMember(); - }; - FuncDecl.prototype.isAnonymousFn = function () { - return this.name === null; - }; - FuncDecl.prototype.isAccessor = function () { - return hasFlag(this.fncFlags, FncFlags.GetAccessor) || hasFlag(this.fncFlags, FncFlags.SetAccessor); - }; - FuncDecl.prototype.isGetAccessor = function () { - return hasFlag(this.fncFlags, FncFlags.GetAccessor); - }; - FuncDecl.prototype.isSetAccessor = function () { - return hasFlag(this.fncFlags, FncFlags.SetAccessor); - }; - FuncDecl.prototype.isAmbient = function () { - return hasFlag(this.fncFlags, FncFlags.Ambient); - }; - FuncDecl.prototype.isExported = function () { - return hasFlag(this.fncFlags, FncFlags.Exported); - }; - FuncDecl.prototype.isPrivate = function () { - return hasFlag(this.fncFlags, FncFlags.Private); - }; - FuncDecl.prototype.isPublic = function () { - return hasFlag(this.fncFlags, FncFlags.Public); - }; - FuncDecl.prototype.isStatic = function () { - return hasFlag(this.fncFlags, FncFlags.Static); - }; + FuncDecl.prototype.isCallMember = function () { return hasFlag(this.fncFlags, FncFlags.CallMember); }; + FuncDecl.prototype.isConstructMember = function () { return hasFlag(this.fncFlags, FncFlags.ConstructMember); }; + FuncDecl.prototype.isIndexerMember = function () { return hasFlag(this.fncFlags, FncFlags.IndexerMember); }; + FuncDecl.prototype.isSpecialFn = function () { return this.isCallMember() || this.isIndexerMember() || this.isConstructMember(); }; + FuncDecl.prototype.isAnonymousFn = function () { return this.name === null; }; + FuncDecl.prototype.isAccessor = function () { return hasFlag(this.fncFlags, FncFlags.GetAccessor) || hasFlag(this.fncFlags, FncFlags.SetAccessor); }; + FuncDecl.prototype.isGetAccessor = function () { return hasFlag(this.fncFlags, FncFlags.GetAccessor); }; + FuncDecl.prototype.isSetAccessor = function () { return hasFlag(this.fncFlags, FncFlags.SetAccessor); }; + FuncDecl.prototype.isAmbient = function () { return hasFlag(this.fncFlags, FncFlags.Ambient); }; + FuncDecl.prototype.isExported = function () { return hasFlag(this.fncFlags, FncFlags.Exported); }; + FuncDecl.prototype.isPrivate = function () { return hasFlag(this.fncFlags, FncFlags.Private); }; + FuncDecl.prototype.isPublic = function () { return hasFlag(this.fncFlags, FncFlags.Public); }; + FuncDecl.prototype.isStatic = function () { return hasFlag(this.fncFlags, FncFlags.Static); }; FuncDecl.prototype.treeViewLabel = function () { if (this.name == null) { return "funcExpr"; @@ -3469,12 +3403,8 @@ var TypeScript; FuncDecl.prototype.ClearFlags = function () { this.fncFlags = FncFlags.None; }; - FuncDecl.prototype.isSignature = function () { - return (this.fncFlags & FncFlags.Signature) != FncFlags.None; - }; - FuncDecl.prototype.hasStaticDeclarations = function () { - return (!this.isConstructor && (this.statics.members.length > 0 || this.innerStaticFuncs.length > 0)); - }; + FuncDecl.prototype.isSignature = function () { return (this.fncFlags & FncFlags.Signature) != FncFlags.None; }; + FuncDecl.prototype.hasStaticDeclarations = function () { return (!this.isConstructor && (this.statics.members.length > 0 || this.innerStaticFuncs.length > 0)); }; return FuncDecl; })(AST); TypeScript.FuncDecl = FuncDecl; @@ -3583,15 +3513,9 @@ var TypeScript; this.scopes = scopes; this.prettyName = this.name.actualText; } - ModuleDeclaration.prototype.isExported = function () { - return hasFlag(this.modFlags, ModuleFlags.Exported); - }; - ModuleDeclaration.prototype.isAmbient = function () { - return hasFlag(this.modFlags, ModuleFlags.Ambient); - }; - ModuleDeclaration.prototype.isEnum = function () { - return hasFlag(this.modFlags, ModuleFlags.IsEnum); - }; + ModuleDeclaration.prototype.isExported = function () { return hasFlag(this.modFlags, ModuleFlags.Exported); }; + ModuleDeclaration.prototype.isAmbient = function () { return hasFlag(this.modFlags, ModuleFlags.Ambient); }; + ModuleDeclaration.prototype.isEnum = function () { return hasFlag(this.modFlags, ModuleFlags.IsEnum); }; ModuleDeclaration.prototype.recordNonInterface = function () { this.modFlags &= ~ModuleFlags.ShouldEmitModuleDecl; }; @@ -3664,15 +3588,9 @@ var TypeScript; _super.call(this, nodeType); this.flags |= ASTFlags.IsStatement; } - Statement.prototype.isLoop = function () { - return false; - }; - Statement.prototype.isStatementOrExpression = function () { - return true; - }; - Statement.prototype.isCompoundStatement = function () { - return this.isLoop(); - }; + Statement.prototype.isLoop = function () { return false; }; + Statement.prototype.isStatementOrExpression = function () { return true; }; + Statement.prototype.isCompoundStatement = function () { return this.isLoop(); }; Statement.prototype.typeCheck = function (typeFlow) { this.type = typeFlow.voidType; return this; @@ -3776,9 +3694,7 @@ var TypeScript; this.target = null; this.resolvedTarget = null; } - Jump.prototype.hasExplicitTarget = function () { - return (this.target); - }; + Jump.prototype.hasExplicitTarget = function () { return (this.target); }; Jump.prototype.setResolvedTarget = function (parser, stmt) { if (stmt.isLoop()) { this.resolvedTarget = stmt; @@ -3829,9 +3745,7 @@ var TypeScript; this.cond = cond; this.body = null; } - WhileStatement.prototype.isLoop = function () { - return true; - }; + WhileStatement.prototype.isLoop = function () { return true; }; WhileStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -3884,9 +3798,7 @@ var TypeScript; this.whileAST = null; this.cond = null; } - DoWhileStatement.prototype.isLoop = function () { - return true; - }; + DoWhileStatement.prototype.isLoop = function () { return true; }; DoWhileStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -3942,9 +3854,7 @@ var TypeScript; this.elseBod = null; this.statement = new ASTSpan(); } - IfStatement.prototype.isCompoundStatement = function () { - return true; - }; + IfStatement.prototype.isCompoundStatement = function () { return true; }; IfStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -4064,9 +3974,7 @@ var TypeScript; this.lval.varFlags |= VarFlags.AutoInit; } } - ForInStatement.prototype.isLoop = function () { - return true; - }; + ForInStatement.prototype.isLoop = function () { return true; }; ForInStatement.prototype.isFiltered = function () { if (this.body) { var singleItem = null; @@ -4173,9 +4081,7 @@ var TypeScript; _super.call(this, NodeType.For); this.init = init; } - ForStatement.prototype.isLoop = function () { - return true; - }; + ForStatement.prototype.isLoop = function () { return true; }; ForStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -4267,9 +4173,7 @@ var TypeScript; this.expr = expr; this.withSym = null; } - WithStatement.prototype.isCompoundStatement = function () { - return true; - }; + WithStatement.prototype.isCompoundStatement = function () { return true; }; WithStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -4296,9 +4200,7 @@ var TypeScript; this.defaultCase = null; this.statement = new ASTSpan(); } - SwitchStatement.prototype.isCompoundStatement = function () { - return true; - }; + SwitchStatement.prototype.isCompoundStatement = function () { return true; }; SwitchStatement.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); @@ -4452,9 +4354,7 @@ var TypeScript; this.tryNode = tryNode; this.finallyNode = finallyNode; } - TryFinally.prototype.isCompoundStatement = function () { - return true; - }; + TryFinally.prototype.isCompoundStatement = function () { return true; }; TryFinally.prototype.emit = function (emitter, tokenId, startLine) { emitter.recordSourceMappingStart(this); emitter.emitJavascript(this.tryNode, TokenID.Try, false); @@ -4499,9 +4399,7 @@ var TypeScript; this.tryNode = tryNode; this.catchNode = catchNode; } - TryCatch.prototype.isCompoundStatement = function () { - return true; - }; + TryCatch.prototype.isCompoundStatement = function () { return true; }; TryCatch.prototype.emit = function (emitter, tokenId, startLine) { emitter.emitParensAndCommentsInPlace(this, true); emitter.recordSourceMappingStart(this); diff --git a/tests/baselines/reference/parserRealSource14.js b/tests/baselines/reference/parserRealSource14.js index 9b9ee2bcf84..b6b7969d136 100644 --- a/tests/baselines/reference/parserRealSource14.js +++ b/tests/baselines/reference/parserRealSource14.js @@ -607,9 +607,7 @@ var TypeScript; }; AstPath.prototype.clone = function () { var clone = new AstPath(); - clone.asts = this.asts.map(function (value) { - return value; - }); + clone.asts = this.asts.map(function (value) { return value; }); clone.top = this.top; return clone; }; diff --git a/tests/baselines/reference/parserRealSource4.js b/tests/baselines/reference/parserRealSource4.js index 1d6ed0aaf13..563e9e92a08 100644 --- a/tests/baselines/reference/parserRealSource4.js +++ b/tests/baselines/reference/parserRealSource4.js @@ -377,9 +377,7 @@ var TypeScript; } return false; }; - StringHashTable.prototype.count = function () { - return this.itemCount; - }; + StringHashTable.prototype.count = function () { return this.itemCount; }; StringHashTable.prototype.lookup = function (key) { var data = this.table[key]; if (data != undefined) { @@ -515,9 +513,7 @@ var TypeScript; } return result; }; - HashTable.prototype.count = function () { - return this.itemCount; - }; + HashTable.prototype.count = function () { return this.itemCount; }; HashTable.prototype.lookup = function (key) { var current; var val = this.hashFn(key); diff --git a/tests/baselines/reference/parserReturnStatement4.js b/tests/baselines/reference/parserReturnStatement4.js index 3a993697cc6..f6800cbb8fd 100644 --- a/tests/baselines/reference/parserReturnStatement4.js +++ b/tests/baselines/reference/parserReturnStatement4.js @@ -2,6 +2,4 @@ var v = { get foo() { return } }; //// [parserReturnStatement4.js] -var v = { get foo() { - return; -} }; +var v = { get foo() { return; } }; diff --git a/tests/baselines/reference/parserharness.js b/tests/baselines/reference/parserharness.js index 7299abf6818..64e8b13ab9d 100644 --- a/tests/baselines/reference/parserharness.js +++ b/tests/baselines/reference/parserharness.js @@ -2694,18 +2694,10 @@ var Harness; this.fileCollection[s] = writer; return writer; }; - EmitterIOHost.prototype.directoryExists = function (s) { - return false; - }; - EmitterIOHost.prototype.fileExists = function (s) { - return typeof this.fileCollection[s] !== 'undefined'; - }; - EmitterIOHost.prototype.resolvePath = function (s) { - return s; - }; - EmitterIOHost.prototype.reset = function () { - this.fileCollection = {}; - }; + EmitterIOHost.prototype.directoryExists = function (s) { return false; }; + EmitterIOHost.prototype.fileExists = function (s) { return typeof this.fileCollection[s] !== 'undefined'; }; + EmitterIOHost.prototype.resolvePath = function (s) { return s; }; + EmitterIOHost.prototype.reset = function () { this.fileCollection = {}; }; EmitterIOHost.prototype.toArray = function () { var result = []; for (var p in this.fileCollection) { @@ -3511,21 +3503,11 @@ var Harness; ////////////////////////////////////////////////////////////////////// // ILogger implementation // - TypeScriptLS.prototype.information = function () { - return false; - }; - TypeScriptLS.prototype.debug = function () { - return true; - }; - TypeScriptLS.prototype.warning = function () { - return true; - }; - TypeScriptLS.prototype.error = function () { - return true; - }; - TypeScriptLS.prototype.fatal = function () { - return true; - }; + TypeScriptLS.prototype.information = function () { return false; }; + TypeScriptLS.prototype.debug = function () { return true; }; + TypeScriptLS.prototype.warning = function () { return true; }; + TypeScriptLS.prototype.error = function () { return true; }; + TypeScriptLS.prototype.fatal = function () { return true; }; TypeScriptLS.prototype.log = function (s) { // For debugging... //IO.printLine("TypeScriptLS:" + s); diff --git a/tests/baselines/reference/plusOperatorWithBooleanType.js b/tests/baselines/reference/plusOperatorWithBooleanType.js index 3de502f5ff6..5af1a8fb903 100644 --- a/tests/baselines/reference/plusOperatorWithBooleanType.js +++ b/tests/baselines/reference/plusOperatorWithBooleanType.js @@ -38,15 +38,11 @@ var ResultIsNumber7 = +A.foo(); //// [plusOperatorWithBooleanType.js] // + operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/plusOperatorWithNumberType.js b/tests/baselines/reference/plusOperatorWithNumberType.js index fa993b80f87..a0adaa5dec2 100644 --- a/tests/baselines/reference/plusOperatorWithNumberType.js +++ b/tests/baselines/reference/plusOperatorWithNumberType.js @@ -45,15 +45,11 @@ var ResultIsNumber11 = +(NUMBER + NUMBER); // + operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -67,9 +63,7 @@ var ResultIsNumber2 = +NUMBER1; // number type literal var ResultIsNumber3 = +1; var ResultIsNumber4 = +{ x: 1, y: 2 }; -var ResultIsNumber5 = +{ x: 1, y: function (n) { - return n; -} }; +var ResultIsNumber5 = +{ x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsNumber6 = +objA.a; var ResultIsNumber7 = +M.n; diff --git a/tests/baselines/reference/plusOperatorWithStringType.js b/tests/baselines/reference/plusOperatorWithStringType.js index 93af186ce8f..ed2c60111b3 100644 --- a/tests/baselines/reference/plusOperatorWithStringType.js +++ b/tests/baselines/reference/plusOperatorWithStringType.js @@ -44,15 +44,11 @@ var ResultIsNumber12 = +STRING.charAt(0); // + operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -66,9 +62,7 @@ var ResultIsNumber2 = +STRING1; // string type literal var ResultIsNumber3 = +""; var ResultIsNumber4 = +{ x: "", y: "" }; -var ResultIsNumber5 = +{ x: "", y: function (s) { - return s; -} }; +var ResultIsNumber5 = +{ x: "", y: function (s) { return s; } }; // string type expressions var ResultIsNumber6 = +objA.a; var ResultIsNumber7 = +M.n; diff --git a/tests/baselines/reference/primitiveMembers.js b/tests/baselines/reference/primitiveMembers.js index f41d2a65bba..bf3f1a17105 100644 --- a/tests/baselines/reference/primitiveMembers.js +++ b/tests/baselines/reference/primitiveMembers.js @@ -65,8 +65,6 @@ var foo = (function (_super) { function foo() { _super.apply(this, arguments); } - foo.prototype.bar = function () { - return undefined; - }; + foo.prototype.bar = function () { return undefined; }; return foo; })(baz); diff --git a/tests/baselines/reference/privateClassPropertyAccessibleWithinClass.js b/tests/baselines/reference/privateClassPropertyAccessibleWithinClass.js index 61d1a44b121..116b255a921 100644 --- a/tests/baselines/reference/privateClassPropertyAccessibleWithinClass.js +++ b/tests/baselines/reference/privateClassPropertyAccessibleWithinClass.js @@ -37,34 +37,20 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.prototype.foo = function () { - return this.foo; - }; + C.prototype.foo = function () { return this.foo; }; Object.defineProperty(C, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.foo = function () { - return this.foo; - }; - C.bar = function () { - this.foo(); - }; + C.foo = function () { return this.foo; }; + C.bar = function () { this.foo(); }; return C; })(); // added level of function nesting @@ -79,9 +65,7 @@ var C2 = (function () { }, set: function (x) { var _this = this; - (function () { - _this.y = _this.x; - }); + (function () { _this.y = _this.x; }); }, enumerable: true, configurable: true @@ -98,9 +82,7 @@ var C2 = (function () { }, set: function (x) { var _this = this; - (function () { - _this.y = _this.x; - }); + (function () { _this.y = _this.x; }); }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/privateInstanceVisibility.js b/tests/baselines/reference/privateInstanceVisibility.js index e1ccb287515..b730a763e1e 100644 --- a/tests/baselines/reference/privateInstanceVisibility.js +++ b/tests/baselines/reference/privateInstanceVisibility.js @@ -57,9 +57,7 @@ var Test; var C = (function () { function C() { } - C.prototype.getX = function () { - return this.x; - }; + C.prototype.getX = function () { return this.x; }; C.prototype.clone = function (other) { this.x = other.x; }; diff --git a/tests/baselines/reference/privateVisibility.js b/tests/baselines/reference/privateVisibility.js index 9565b6fc25d..d70d7b4756f 100644 --- a/tests/baselines/reference/privateVisibility.js +++ b/tests/baselines/reference/privateVisibility.js @@ -32,9 +32,7 @@ var Foo = (function () { this.pubProp = 0; this.privProp = 0; } - Foo.prototype.pubMeth = function () { - this.privMeth(); - }; + Foo.prototype.pubMeth = function () { this.privMeth(); }; Foo.prototype.privMeth = function () { }; return Foo; })(); diff --git a/tests/baselines/reference/privateVisibles.js b/tests/baselines/reference/privateVisibles.js index c9206964f80..b2cb673c681 100644 --- a/tests/baselines/reference/privateVisibles.js +++ b/tests/baselines/reference/privateVisibles.js @@ -15,8 +15,6 @@ var Foo = (function () { this.pvar = 0; var n = this.pvar; } - Foo.prototype.meth = function () { - var q = this.pvar; - }; + Foo.prototype.meth = function () { var q = this.pvar; }; return Foo; })(); diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js index 81cdcec5434..88baee7752e 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints2.js @@ -92,9 +92,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js index eb3770bc0b3..941adc7ab43 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints3.js @@ -67,9 +67,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { diff --git a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js index 3a88ec832f7..fe3c9433796 100644 --- a/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js +++ b/tests/baselines/reference/propertyAccessOnTypeParameterWithConstraints5.js @@ -54,9 +54,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { diff --git a/tests/baselines/reference/propertyOrdering.js b/tests/baselines/reference/propertyOrdering.js index 1dc930f93a1..f0f4644a983 100644 --- a/tests/baselines/reference/propertyOrdering.js +++ b/tests/baselines/reference/propertyOrdering.js @@ -31,9 +31,7 @@ var Foo = (function () { Foo.prototype.foo = function () { return this._store.length; // shouldn't be an error }; - Foo.prototype.bar = function () { - return this.store; - }; // should be an error + Foo.prototype.bar = function () { return this.store; }; // should be an error return Foo; })(); var Bar = (function () { diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js index 992011ee4af..19ec9f50d27 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinClass.js @@ -37,34 +37,20 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.prototype.foo = function () { - return this.foo; - }; + C.prototype.foo = function () { return this.foo; }; Object.defineProperty(C, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.foo = function () { - return this.foo; - }; - C.bar = function () { - this.foo(); - }; + C.foo = function () { return this.foo; }; + C.bar = function () { this.foo(); }; return C; })(); // added level of function nesting @@ -79,9 +65,7 @@ var C2 = (function () { }, set: function (x) { var _this = this; - (function () { - _this.y = _this.x; - }); + (function () { _this.y = _this.x; }); }, enumerable: true, configurable: true @@ -98,9 +82,7 @@ var C2 = (function () { }, set: function (x) { var _this = this; - (function () { - _this.y = _this.x; - }); + (function () { _this.y = _this.x; }); }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js index 381d10f43ea..28a1da5ffec 100644 --- a/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js +++ b/tests/baselines/reference/protectedClassPropertyAccessibleWithinSubclass.js @@ -38,36 +38,20 @@ var C = (function (_super) { _super.apply(this, arguments); } Object.defineProperty(C.prototype, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.prototype.foo = function () { - return this.x; - }; - C.prototype.bar = function () { - return this.foo(); - }; + C.prototype.foo = function () { return this.x; }; + C.prototype.bar = function () { return this.foo(); }; Object.defineProperty(C, "y", { - get: function () { - return this.x; - }, - set: function (x) { - this.y = this.x; - }, + get: function () { return this.x; }, + set: function (x) { this.y = this.x; }, enumerable: true, configurable: true }); - C.foo = function () { - return this.x; - }; - C.bar = function () { - this.foo(); - }; + C.foo = function () { return this.x; }; + C.bar = function () { this.foo(); }; return C; })(B); diff --git a/tests/baselines/reference/qualifiedModuleLocals.js b/tests/baselines/reference/qualifiedModuleLocals.js index 45d61949c63..b7ba5b70e81 100644 --- a/tests/baselines/reference/qualifiedModuleLocals.js +++ b/tests/baselines/reference/qualifiedModuleLocals.js @@ -14,9 +14,7 @@ A.a(); var A; (function (A) { function b() { } - function a() { - A.b(); - } + function a() { A.b(); } A.a = a; // A.b should be an unresolved symbol error })(A || (A = {})); A.a(); diff --git a/tests/baselines/reference/quotedAccessorName1.js b/tests/baselines/reference/quotedAccessorName1.js index 93fd5b8dd6b..69e0fdb2c8e 100644 --- a/tests/baselines/reference/quotedAccessorName1.js +++ b/tests/baselines/reference/quotedAccessorName1.js @@ -8,9 +8,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "foo", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/quotedAccessorName2.js b/tests/baselines/reference/quotedAccessorName2.js index 43041a29bf4..5d2d4861550 100644 --- a/tests/baselines/reference/quotedAccessorName2.js +++ b/tests/baselines/reference/quotedAccessorName2.js @@ -8,9 +8,7 @@ var C = (function () { function C() { } Object.defineProperty(C, "foo", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/rectype.js b/tests/baselines/reference/rectype.js index ed303b6b26e..15c5d9861f4 100644 --- a/tests/baselines/reference/rectype.js +++ b/tests/baselines/reference/rectype.js @@ -16,9 +16,7 @@ module M { //// [rectype.js] var M; (function (M) { - function f(p) { - return f; - } + function f(p) { return f; } M.f = f; ; var i; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js b/tests/baselines/reference/recursiveClassReferenceTest.js index 661ecb3a0e7..89fe29ee2ef 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js +++ b/tests/baselines/reference/recursiveClassReferenceTest.js @@ -122,9 +122,7 @@ var Sample; var StartFindAction = (function () { function StartFindAction() { } - StartFindAction.prototype.getId = function () { - return "yo"; - }; + StartFindAction.prototype.getId = function () { return "yo"; }; StartFindAction.prototype.run = function (Thing) { return true; }; @@ -148,11 +146,9 @@ var Sample; // scenario 1 codeThing.addWidget("addWidget", this); } - FindWidget.prototype.gar = function (runner) { - if (true) { - return runner(this); - } - }; + FindWidget.prototype.gar = function (runner) { if (true) { + return runner(this); + } }; FindWidget.prototype.getDomNode = function () { return domNode; }; @@ -167,9 +163,7 @@ var Sample; var AbstractMode = (function () { function AbstractMode() { } - AbstractMode.prototype.getInitialState = function () { - return null; - }; + AbstractMode.prototype.getInitialState = function () { return null; }; return AbstractMode; })(); var Sample; @@ -190,9 +184,7 @@ var Sample; State.prototype.equals = function (other) { return this === other; }; - State.prototype.getMode = function () { - return mode; - }; + State.prototype.getMode = function () { return mode; }; return State; })(); PlainText.State = State; diff --git a/tests/baselines/reference/recursiveClassReferenceTest.js.map b/tests/baselines/reference/recursiveClassReferenceTest.js.map index d2e66a925a8..a61032b3797 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.js.map +++ b/tests/baselines/reference/recursiveClassReferenceTest.js.map @@ -1,2 +1,2 @@ //// [recursiveClassReferenceTest.js.map] -{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":["Sample","Sample.Actions","Sample.Actions.Thing","Sample.Actions.Thing.Find","Sample.Actions.Thing.Find.StartFindAction","Sample.Actions.Thing.Find.StartFindAction.constructor","Sample.Actions.Thing.Find.StartFindAction.getId","Sample.Actions.Thing.Find.StartFindAction.run","Sample.Thing","Sample.Thing.Widgets","Sample.Thing.Widgets.FindWidget","Sample.Thing.Widgets.FindWidget.constructor","Sample.Thing.Widgets.FindWidget.gar","Sample.Thing.Widgets.FindWidget.getDomNode","Sample.Thing.Widgets.FindWidget.destroy","AbstractMode","AbstractMode.constructor","AbstractMode.getInitialState","Sample.Thing.Languages","Sample.Thing.Languages.PlainText","Sample.Thing.Languages.PlainText.State","Sample.Thing.Languages.PlainText.State.constructor","Sample.Thing.Languages.PlainText.State.clone","Sample.Thing.Languages.PlainText.State.equals","Sample.Thing.Languages.PlainText.State.getMode","Sample.Thing.Languages.PlainText.Mode","Sample.Thing.Languages.PlainText.Mode.constructor","Sample.Thing.Languages.PlainText.Mode.getInitialState"],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;;;;;;;AA8B1E,IAAO,MAAM,CAUZ;AAVD,WAAO,MAAM;IAACA,IAAAA,OAAOA,CAUpBA;IAVaA,WAAAA,OAAOA;QAACC,IAAAA,KAAKA,CAU1BA;QAVqBA,WAAAA,MAAKA;YAACC,IAAAA,IAAIA,CAU/BA;YAV2BA,WAAAA,IAAIA,EAACA,CAACA;gBACjCC,IAAaA,eAAeA;oBAA5BC,SAAaA,eAAeA;oBAQ5BC,CAACA;oBANOD,+BAAKA,GAAZA;wBAAiBE,MAAMA,CAACA,IAAIA,CAACA;oBAACA,CAACA;oBAExBF,6BAAGA,GAAVA,UAAWA,KAA6BA;wBAEvCG,MAAMA,CAACA,IAAIA,CAACA;oBACbA,CAACA;oBACFH,sBAACA;gBAADA,CAACA,AARDD,IAQCA;gBARYA,oBAAeA,GAAfA,eAQZA,CAAAA;YACFA,CAACA,EAV2BD,IAAIA,GAAJA,WAAIA,KAAJA,WAAIA,QAU/BA;QAADA,CAACA,EAVqBD,KAAKA,GAALA,aAAKA,KAALA,aAAKA,QAU1BA;IAADA,CAACA,EAVaD,OAAOA,GAAPA,cAAOA,KAAPA,cAAOA,QAUpBA;AAADA,CAACA,EAVM,MAAM,KAAN,MAAM,QAUZ;AAED,IAAO,MAAM,CAoBZ;AApBD,WAAO,MAAM;IAACA,IAAAA,KAAKA,CAoBlBA;IApBaA,WAAAA,KAAKA;QAACQ,IAAAA,OAAOA,CAoB1BA;QApBmBA,WAAAA,OAAOA,EAACA,CAACA;YAC5BC,IAAaA,UAAUA;gBAKtBC,SALYA,UAAUA,CAKFA,SAAkCA;oBAAlCC,cAASA,GAATA,SAASA,CAAyBA;oBAD9CA,YAAOA,GAAOA,IAAIA,CAACA;oBAGvBA,AADAA,aAAaA;oBACbA,SAASA,CAACA,SAASA,CAACA,WAAWA,EAAEA,IAAIA,CAACA,CAACA;gBAC3CA,CAACA;gBANMD,wBAAGA,GAAVA,UAAWA,MAAyCA;oBAAIE,EAAEA,CAACA,CAACA,IAAIA,CAACA,CAACA,CAACA;wBAAAA,MAAMA,CAACA,MAAMA,CAACA,IAAIA,CAACA,CAACA;oBAAAA,CAACA;gBAAAA,CAACA;gBAQlFF,+BAAUA,GAAjBA;oBACCG,MAAMA,CAACA,OAAOA,CAACA;gBAChBA,CAACA;gBAEMH,4BAAOA,GAAdA;gBAEAI,CAACA;gBAEFJ,iBAACA;YAADA,CAACA,AAlBDD,IAkBCA;YAlBYA,kBAAUA,GAAVA,UAkBZA,CAAAA;QACFA,CAACA,EApBmBD,OAAOA,GAAPA,aAAOA,KAAPA,aAAOA,QAoB1BA;IAADA,CAACA,EApBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAoBlBA;AAADA,CAACA,EApBM,MAAM,KAAN,MAAM,QAoBZ;AAGD,IAAM,YAAY;IAAlBe,SAAMA,YAAYA;IAAqEC,CAACA;IAA3CD,sCAAeA,GAAtBA;QAAmCE,MAAMA,CAACA,IAAIA,CAACA;IAAAA,CAACA;IAACF,mBAACA;AAADA,CAACA,AAAxF,IAAwF;AASxF,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM;IAACf,IAAAA,KAAKA,CAwBlBA;IAxBaA,WAAAA,KAAKA;QAACQ,IAAAA,SAASA,CAwB5BA;QAxBmBA,WAAAA,SAASA;YAACU,IAAAA,SAASA,CAwBtCA;YAxB6BA,WAAAA,SAASA,EAACA,CAACA;gBAExCC,IAAaA,KAAKA;oBACXC,SADMA,KAAKA,CACSA,IAAWA;wBAAXC,SAAIA,GAAJA,IAAIA,CAAOA;oBAAIA,CAACA;oBACnCD,qBAAKA,GAAZA;wBACCE,MAAMA,CAACA,IAAIA,CAACA;oBACbA,CAACA;oBAEMF,sBAAMA,GAAbA,UAAcA,KAAYA;wBACzBG,MAAMA,CAACA,IAAIA,KAAKA,KAAKA,CAACA;oBACvBA,CAACA;oBAEMH,uBAAOA,GAAdA;wBAA0BI,MAAMA,CAACA,IAAIA,CAACA;oBAACA,CAACA;oBACzCJ,YAACA;gBAADA,CAACA,AAXDD,IAWCA;gBAXYA,eAAKA,GAALA,KAWZA,CAAAA;gBAEDA,IAAaA,IAAIA;oBAASM,UAAbA,IAAIA,UAAqBA;oBAAtCA,SAAaA,IAAIA;wBAASC,8BAAYA;oBAQtCA,CAACA;oBANAD,aAAaA;oBACNA,8BAAeA,GAAtBA;wBACCE,MAAMA,CAACA,IAAIA,KAAKA,CAACA,IAAIA,CAACA,CAACA;oBACxBA,CAACA;oBAGFF,WAACA;gBAADA,CAACA,AARDN,EAA0BA,YAAYA,EAQrCA;gBARYA,cAAIA,GAAJA,IAQZA,CAAAA;YACFA,CAACA,EAxB6BD,SAASA,GAATA,mBAASA,KAATA,mBAASA,QAwBtCA;QAADA,CAACA,EAxBmBV,SAASA,GAATA,eAASA,KAATA,eAASA,QAwB5BA;IAADA,CAACA,EAxBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAwBlBA;AAADA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ"} \ No newline at end of file +{"version":3,"file":"recursiveClassReferenceTest.js","sourceRoot":"","sources":["recursiveClassReferenceTest.ts"],"names":["Sample","Sample.Actions","Sample.Actions.Thing","Sample.Actions.Thing.Find","Sample.Actions.Thing.Find.StartFindAction","Sample.Actions.Thing.Find.StartFindAction.constructor","Sample.Actions.Thing.Find.StartFindAction.getId","Sample.Actions.Thing.Find.StartFindAction.run","Sample.Thing","Sample.Thing.Widgets","Sample.Thing.Widgets.FindWidget","Sample.Thing.Widgets.FindWidget.constructor","Sample.Thing.Widgets.FindWidget.gar","Sample.Thing.Widgets.FindWidget.getDomNode","Sample.Thing.Widgets.FindWidget.destroy","AbstractMode","AbstractMode.constructor","AbstractMode.getInitialState","Sample.Thing.Languages","Sample.Thing.Languages.PlainText","Sample.Thing.Languages.PlainText.State","Sample.Thing.Languages.PlainText.State.constructor","Sample.Thing.Languages.PlainText.State.clone","Sample.Thing.Languages.PlainText.State.equals","Sample.Thing.Languages.PlainText.State.getMode","Sample.Thing.Languages.PlainText.Mode","Sample.Thing.Languages.PlainText.Mode.constructor","Sample.Thing.Languages.PlainText.Mode.getInitialState"],"mappings":"AAAA,iEAAiE;AACjE,0EAA0E;;;;;;;AA8B1E,IAAO,MAAM,CAUZ;AAVD,WAAO,MAAM;IAACA,IAAAA,OAAOA,CAUpBA;IAVaA,WAAAA,OAAOA;QAACC,IAAAA,KAAKA,CAU1BA;QAVqBA,WAAAA,MAAKA;YAACC,IAAAA,IAAIA,CAU/BA;YAV2BA,WAAAA,IAAIA,EAACA,CAACA;gBACjCC,IAAaA,eAAeA;oBAA5BC,SAAaA,eAAeA;oBAQ5BC,CAACA;oBANOD,+BAAKA,GAAZA,cAAiBE,MAAMA,CAACA,IAAIA,CAACA,CAACA,CAACA;oBAExBF,6BAAGA,GAAVA,UAAWA,KAA6BA;wBAEvCG,MAAMA,CAACA,IAAIA,CAACA;oBACbA,CAACA;oBACFH,sBAACA;gBAADA,CAACA,AARDD,IAQCA;gBARYA,oBAAeA,GAAfA,eAQZA,CAAAA;YACFA,CAACA,EAV2BD,IAAIA,GAAJA,WAAIA,KAAJA,WAAIA,QAU/BA;QAADA,CAACA,EAVqBD,KAAKA,GAALA,aAAKA,KAALA,aAAKA,QAU1BA;IAADA,CAACA,EAVaD,OAAOA,GAAPA,cAAOA,KAAPA,cAAOA,QAUpBA;AAADA,CAACA,EAVM,MAAM,KAAN,MAAM,QAUZ;AAED,IAAO,MAAM,CAoBZ;AApBD,WAAO,MAAM;IAACA,IAAAA,KAAKA,CAoBlBA;IApBaA,WAAAA,KAAKA;QAACQ,IAAAA,OAAOA,CAoB1BA;QApBmBA,WAAAA,OAAOA,EAACA,CAACA;YAC5BC,IAAaA,UAAUA;gBAKtBC,SALYA,UAAUA,CAKFA,SAAkCA;oBAAlCC,cAASA,GAATA,SAASA,CAAyBA;oBAD9CA,YAAOA,GAAOA,IAAIA,CAACA;oBAGvBA,AADAA,aAAaA;oBACbA,SAASA,CAACA,SAASA,CAACA,WAAWA,EAAEA,IAAIA,CAACA,CAACA;gBAC3CA,CAACA;gBANMD,wBAAGA,GAAVA,UAAWA,MAAyCA,IAAIE,EAAEA,CAACA,CAACA,IAAIA,CAACA,CAACA,CAACA;oBAAAA,MAAMA,CAACA,MAAMA,CAACA,IAAIA,CAACA,CAACA;gBAAAA,CAACA,CAAAA,CAACA;gBAQlFF,+BAAUA,GAAjBA;oBACCG,MAAMA,CAACA,OAAOA,CAACA;gBAChBA,CAACA;gBAEMH,4BAAOA,GAAdA;gBAEAI,CAACA;gBAEFJ,iBAACA;YAADA,CAACA,AAlBDD,IAkBCA;YAlBYA,kBAAUA,GAAVA,UAkBZA,CAAAA;QACFA,CAACA,EApBmBD,OAAOA,GAAPA,aAAOA,KAAPA,aAAOA,QAoB1BA;IAADA,CAACA,EApBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAoBlBA;AAADA,CAACA,EApBM,MAAM,KAAN,MAAM,QAoBZ;AAGD,IAAM,YAAY;IAAlBe,SAAMA,YAAYA;IAAqEC,CAACA;IAA3CD,sCAAeA,GAAtBA,cAAmCE,MAAMA,CAACA,IAAIA,CAACA,CAAAA,CAACA;IAACF,mBAACA;AAADA,CAACA,AAAxF,IAAwF;AASxF,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM;IAACf,IAAAA,KAAKA,CAwBlBA;IAxBaA,WAAAA,KAAKA;QAACQ,IAAAA,SAASA,CAwB5BA;QAxBmBA,WAAAA,SAASA;YAACU,IAAAA,SAASA,CAwBtCA;YAxB6BA,WAAAA,SAASA,EAACA,CAACA;gBAExCC,IAAaA,KAAKA;oBACXC,SADMA,KAAKA,CACSA,IAAWA;wBAAXC,SAAIA,GAAJA,IAAIA,CAAOA;oBAAIA,CAACA;oBACnCD,qBAAKA,GAAZA;wBACCE,MAAMA,CAACA,IAAIA,CAACA;oBACbA,CAACA;oBAEMF,sBAAMA,GAAbA,UAAcA,KAAYA;wBACzBG,MAAMA,CAACA,IAAIA,KAAKA,KAAKA,CAACA;oBACvBA,CAACA;oBAEMH,uBAAOA,GAAdA,cAA0BI,MAAMA,CAACA,IAAIA,CAACA,CAACA,CAACA;oBACzCJ,YAACA;gBAADA,CAACA,AAXDD,IAWCA;gBAXYA,eAAKA,GAALA,KAWZA,CAAAA;gBAEDA,IAAaA,IAAIA;oBAASM,UAAbA,IAAIA,UAAqBA;oBAAtCA,SAAaA,IAAIA;wBAASC,8BAAYA;oBAQtCA,CAACA;oBANAD,aAAaA;oBACNA,8BAAeA,GAAtBA;wBACCE,MAAMA,CAACA,IAAIA,KAAKA,CAACA,IAAIA,CAACA,CAACA;oBACxBA,CAACA;oBAGFF,WAACA;gBAADA,CAACA,AARDN,EAA0BA,YAAYA,EAQrCA;gBARYA,cAAIA,GAAJA,IAQZA,CAAAA;YACFA,CAACA,EAxB6BD,SAASA,GAATA,mBAASA,KAATA,mBAASA,QAwBtCA;QAADA,CAACA,EAxBmBV,SAASA,GAATA,eAASA,KAATA,eAASA,QAwB5BA;IAADA,CAACA,EAxBaR,KAAKA,GAALA,YAAKA,KAALA,YAAKA,QAwBlBA;AAADA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ"} \ No newline at end of file diff --git a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt index d7163bf7760..84ddc2befb3 100644 --- a/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt +++ b/tests/baselines/reference/recursiveClassReferenceTest.sourcemap.txt @@ -240,7 +240,7 @@ sourceFile:recursiveClassReferenceTest.ts >>> } 1 >^^^^^^^^^^^^^^^^^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > implements Sample.Thing.IAction { > > public getId() { return "yo"; } @@ -254,61 +254,56 @@ sourceFile:recursiveClassReferenceTest.ts 1 >Emitted(19, 21) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.constructor) 2 >Emitted(19, 22) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.constructor) --- ->>> StartFindAction.prototype.getId = function () { +>>> StartFindAction.prototype.getId = function () { return "yo"; }; 1->^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^ +10> ^ 1-> 2 > getId 3 > +4 > public getId() { +5 > return +6 > +7 > "yo" +8 > ; +9 > +10> } 1->Emitted(20, 21) Source(35, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) 2 >Emitted(20, 52) Source(35, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) 3 >Emitted(20, 55) Source(35, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) ---- ->>> return "yo"; -1 >^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^ -1 >public getId() { -2 > return -3 > -4 > "yo" -5 > ; -1 >Emitted(21, 25) Source(35, 20) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -2 >Emitted(21, 31) Source(35, 26) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -3 >Emitted(21, 32) Source(35, 27) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -4 >Emitted(21, 36) Source(35, 31) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -5 >Emitted(21, 37) Source(35, 32) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) ---- ->>> }; -1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -1 >Emitted(22, 21) Source(35, 33) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) -2 >Emitted(22, 22) Source(35, 34) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +4 >Emitted(20, 69) Source(35, 20) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +5 >Emitted(20, 75) Source(35, 26) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +6 >Emitted(20, 76) Source(35, 27) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +7 >Emitted(20, 80) Source(35, 31) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +8 >Emitted(20, 81) Source(35, 32) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +9 >Emitted(20, 82) Source(35, 33) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) +10>Emitted(20, 83) Source(35, 34) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.getId) --- >>> StartFindAction.prototype.run = function (Thing) { -1->^^^^^^^^^^^^^^^^^^^^ +1 >^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ 4 > ^^^^^^^^^^ 5 > ^^^^^ -1-> +1 > > > public 2 > run 3 > 4 > public run( 5 > Thing:Sample.Thing.ICodeThing -1->Emitted(23, 21) Source(37, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -2 >Emitted(23, 50) Source(37, 13) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -3 >Emitted(23, 53) Source(37, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -4 >Emitted(23, 63) Source(37, 14) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -5 >Emitted(23, 68) Source(37, 43) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +1 >Emitted(21, 21) Source(37, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +2 >Emitted(21, 50) Source(37, 13) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +3 >Emitted(21, 53) Source(37, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +4 >Emitted(21, 63) Source(37, 14) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +5 >Emitted(21, 68) Source(37, 43) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) --- >>> return true; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -323,11 +318,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > true 5 > ; -1 >Emitted(24, 25) Source(39, 4) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -2 >Emitted(24, 31) Source(39, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -3 >Emitted(24, 32) Source(39, 11) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -4 >Emitted(24, 36) Source(39, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -5 >Emitted(24, 37) Source(39, 16) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +1 >Emitted(22, 25) Source(39, 4) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +2 >Emitted(22, 31) Source(39, 10) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +3 >Emitted(22, 32) Source(39, 11) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +4 >Emitted(22, 36) Source(39, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +5 >Emitted(22, 37) Source(39, 16) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -336,8 +331,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(25, 21) Source(40, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) -2 >Emitted(25, 22) Source(40, 4) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +1 >Emitted(23, 21) Source(40, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) +2 >Emitted(23, 22) Source(40, 4) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction.run) --- >>> return StartFindAction; 1->^^^^^^^^^^^^^^^^^^^^ @@ -345,8 +340,8 @@ sourceFile:recursiveClassReferenceTest.ts 1-> > 2 > } -1->Emitted(26, 21) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -2 >Emitted(26, 43) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +1->Emitted(24, 21) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +2 >Emitted(24, 43) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) --- >>> })(); 1 >^^^^^^^^^^^^^^^^ @@ -366,10 +361,10 @@ sourceFile:recursiveClassReferenceTest.ts > return true; > } > } -1 >Emitted(27, 17) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -2 >Emitted(27, 18) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) -3 >Emitted(27, 18) Source(33, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find) -4 >Emitted(27, 22) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) +1 >Emitted(25, 17) Source(41, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +2 >Emitted(25, 18) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find.StartFindAction) +3 >Emitted(25, 18) Source(33, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find) +4 >Emitted(25, 22) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) --- >>> Find.StartFindAction = StartFindAction; 1->^^^^^^^^^^^^^^^^ @@ -391,11 +386,11 @@ sourceFile:recursiveClassReferenceTest.ts > } > } 5 > -1->Emitted(28, 17) Source(33, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find) -2 >Emitted(28, 37) Source(33, 30) + SourceIndex(0) name (Sample.Actions.Thing.Find) -3 >Emitted(28, 40) Source(33, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find) -4 >Emitted(28, 55) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) -5 >Emitted(28, 56) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) +1->Emitted(26, 17) Source(33, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find) +2 >Emitted(26, 37) Source(33, 30) + SourceIndex(0) name (Sample.Actions.Thing.Find) +3 >Emitted(26, 40) Source(33, 15) + SourceIndex(0) name (Sample.Actions.Thing.Find) +4 >Emitted(26, 55) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) +5 >Emitted(26, 56) Source(41, 3) + SourceIndex(0) name (Sample.Actions.Thing.Find) --- >>> })(Find = _Thing.Find || (_Thing.Find = {})); 1->^^^^^^^^^^^^ @@ -428,15 +423,15 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1->Emitted(29, 13) Source(42, 1) + SourceIndex(0) name (Sample.Actions.Thing.Find) -2 >Emitted(29, 14) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find) -3 >Emitted(29, 16) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) -4 >Emitted(29, 20) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) -5 >Emitted(29, 23) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) -6 >Emitted(29, 34) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) -7 >Emitted(29, 39) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) -8 >Emitted(29, 50) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) -9 >Emitted(29, 58) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing) +1->Emitted(27, 13) Source(42, 1) + SourceIndex(0) name (Sample.Actions.Thing.Find) +2 >Emitted(27, 14) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing.Find) +3 >Emitted(27, 16) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) +4 >Emitted(27, 20) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) +5 >Emitted(27, 23) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) +6 >Emitted(27, 34) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) +7 >Emitted(27, 39) Source(32, 29) + SourceIndex(0) name (Sample.Actions.Thing) +8 >Emitted(27, 50) Source(32, 33) + SourceIndex(0) name (Sample.Actions.Thing) +9 >Emitted(27, 58) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing) --- >>> })(Thing = Actions.Thing || (Actions.Thing = {})); 1->^^^^^^^^ @@ -468,15 +463,15 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1->Emitted(30, 9) Source(42, 1) + SourceIndex(0) name (Sample.Actions.Thing) -2 >Emitted(30, 10) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing) -3 >Emitted(30, 12) Source(32, 23) + SourceIndex(0) name (Sample.Actions) -4 >Emitted(30, 17) Source(32, 28) + SourceIndex(0) name (Sample.Actions) -5 >Emitted(30, 20) Source(32, 23) + SourceIndex(0) name (Sample.Actions) -6 >Emitted(30, 33) Source(32, 28) + SourceIndex(0) name (Sample.Actions) -7 >Emitted(30, 38) Source(32, 23) + SourceIndex(0) name (Sample.Actions) -8 >Emitted(30, 51) Source(32, 28) + SourceIndex(0) name (Sample.Actions) -9 >Emitted(30, 59) Source(42, 2) + SourceIndex(0) name (Sample.Actions) +1->Emitted(28, 9) Source(42, 1) + SourceIndex(0) name (Sample.Actions.Thing) +2 >Emitted(28, 10) Source(42, 2) + SourceIndex(0) name (Sample.Actions.Thing) +3 >Emitted(28, 12) Source(32, 23) + SourceIndex(0) name (Sample.Actions) +4 >Emitted(28, 17) Source(32, 28) + SourceIndex(0) name (Sample.Actions) +5 >Emitted(28, 20) Source(32, 23) + SourceIndex(0) name (Sample.Actions) +6 >Emitted(28, 33) Source(32, 28) + SourceIndex(0) name (Sample.Actions) +7 >Emitted(28, 38) Source(32, 23) + SourceIndex(0) name (Sample.Actions) +8 >Emitted(28, 51) Source(32, 28) + SourceIndex(0) name (Sample.Actions) +9 >Emitted(28, 59) Source(42, 2) + SourceIndex(0) name (Sample.Actions) --- >>> })(Actions = Sample.Actions || (Sample.Actions = {})); 1->^^^^ @@ -507,15 +502,15 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1->Emitted(31, 5) Source(42, 1) + SourceIndex(0) name (Sample.Actions) -2 >Emitted(31, 6) Source(42, 2) + SourceIndex(0) name (Sample.Actions) -3 >Emitted(31, 8) Source(32, 15) + SourceIndex(0) name (Sample) -4 >Emitted(31, 15) Source(32, 22) + SourceIndex(0) name (Sample) -5 >Emitted(31, 18) Source(32, 15) + SourceIndex(0) name (Sample) -6 >Emitted(31, 32) Source(32, 22) + SourceIndex(0) name (Sample) -7 >Emitted(31, 37) Source(32, 15) + SourceIndex(0) name (Sample) -8 >Emitted(31, 51) Source(32, 22) + SourceIndex(0) name (Sample) -9 >Emitted(31, 59) Source(42, 2) + SourceIndex(0) name (Sample) +1->Emitted(29, 5) Source(42, 1) + SourceIndex(0) name (Sample.Actions) +2 >Emitted(29, 6) Source(42, 2) + SourceIndex(0) name (Sample.Actions) +3 >Emitted(29, 8) Source(32, 15) + SourceIndex(0) name (Sample) +4 >Emitted(29, 15) Source(32, 22) + SourceIndex(0) name (Sample) +5 >Emitted(29, 18) Source(32, 15) + SourceIndex(0) name (Sample) +6 >Emitted(29, 32) Source(32, 22) + SourceIndex(0) name (Sample) +7 >Emitted(29, 37) Source(32, 15) + SourceIndex(0) name (Sample) +8 >Emitted(29, 51) Source(32, 22) + SourceIndex(0) name (Sample) +9 >Emitted(29, 59) Source(42, 2) + SourceIndex(0) name (Sample) --- >>>})(Sample || (Sample = {})); 1 > @@ -542,13 +537,13 @@ sourceFile:recursiveClassReferenceTest.ts > } > } > } -1 >Emitted(32, 1) Source(42, 1) + SourceIndex(0) name (Sample) -2 >Emitted(32, 2) Source(42, 2) + SourceIndex(0) name (Sample) -3 >Emitted(32, 4) Source(32, 8) + SourceIndex(0) -4 >Emitted(32, 10) Source(32, 14) + SourceIndex(0) -5 >Emitted(32, 15) Source(32, 8) + SourceIndex(0) -6 >Emitted(32, 21) Source(32, 14) + SourceIndex(0) -7 >Emitted(32, 29) Source(42, 2) + SourceIndex(0) +1 >Emitted(30, 1) Source(42, 1) + SourceIndex(0) name (Sample) +2 >Emitted(30, 2) Source(42, 2) + SourceIndex(0) name (Sample) +3 >Emitted(30, 4) Source(32, 8) + SourceIndex(0) +4 >Emitted(30, 10) Source(32, 14) + SourceIndex(0) +5 >Emitted(30, 15) Source(32, 8) + SourceIndex(0) +6 >Emitted(30, 21) Source(32, 14) + SourceIndex(0) +7 >Emitted(30, 29) Source(42, 2) + SourceIndex(0) --- >>>var Sample; 1 > @@ -582,10 +577,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(33, 1) Source(44, 1) + SourceIndex(0) -2 >Emitted(33, 5) Source(44, 8) + SourceIndex(0) -3 >Emitted(33, 11) Source(44, 14) + SourceIndex(0) -4 >Emitted(33, 12) Source(64, 2) + SourceIndex(0) +1 >Emitted(31, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(31, 5) Source(44, 8) + SourceIndex(0) +3 >Emitted(31, 11) Source(44, 14) + SourceIndex(0) +4 >Emitted(31, 12) Source(64, 2) + SourceIndex(0) --- >>>(function (Sample) { 1-> @@ -594,9 +589,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 >module 3 > Sample -1->Emitted(34, 1) Source(44, 1) + SourceIndex(0) -2 >Emitted(34, 12) Source(44, 8) + SourceIndex(0) -3 >Emitted(34, 18) Source(44, 14) + SourceIndex(0) +1->Emitted(32, 1) Source(44, 1) + SourceIndex(0) +2 >Emitted(32, 12) Source(44, 8) + SourceIndex(0) +3 >Emitted(32, 18) Source(44, 14) + SourceIndex(0) --- >>> var Thing; 1 >^^^^ @@ -628,10 +623,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(35, 5) Source(44, 15) + SourceIndex(0) name (Sample) -2 >Emitted(35, 9) Source(44, 15) + SourceIndex(0) name (Sample) -3 >Emitted(35, 14) Source(44, 20) + SourceIndex(0) name (Sample) -4 >Emitted(35, 15) Source(64, 2) + SourceIndex(0) name (Sample) +1 >Emitted(33, 5) Source(44, 15) + SourceIndex(0) name (Sample) +2 >Emitted(33, 9) Source(44, 15) + SourceIndex(0) name (Sample) +3 >Emitted(33, 14) Source(44, 20) + SourceIndex(0) name (Sample) +4 >Emitted(33, 15) Source(64, 2) + SourceIndex(0) name (Sample) --- >>> (function (Thing) { 1->^^^^ @@ -641,9 +636,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Thing -1->Emitted(36, 5) Source(44, 15) + SourceIndex(0) name (Sample) -2 >Emitted(36, 16) Source(44, 15) + SourceIndex(0) name (Sample) -3 >Emitted(36, 21) Source(44, 20) + SourceIndex(0) name (Sample) +1->Emitted(34, 5) Source(44, 15) + SourceIndex(0) name (Sample) +2 >Emitted(34, 16) Source(44, 15) + SourceIndex(0) name (Sample) +3 >Emitted(34, 21) Source(44, 20) + SourceIndex(0) name (Sample) --- >>> var Widgets; 1->^^^^^^^^ @@ -675,10 +670,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(37, 9) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(37, 13) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(37, 20) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(37, 21) Source(64, 2) + SourceIndex(0) name (Sample.Thing) +1->Emitted(35, 9) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(35, 13) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(35, 20) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(35, 21) Source(64, 2) + SourceIndex(0) name (Sample.Thing) --- >>> (function (Widgets) { 1->^^^^^^^^ @@ -692,11 +687,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > Widgets 4 > 5 > { -1->Emitted(38, 9) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(38, 20) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(38, 27) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(38, 29) Source(44, 29) + SourceIndex(0) name (Sample.Thing) -5 >Emitted(38, 30) Source(44, 30) + SourceIndex(0) name (Sample.Thing) +1->Emitted(36, 9) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(36, 20) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(36, 27) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(36, 29) Source(44, 29) + SourceIndex(0) name (Sample.Thing) +5 >Emitted(36, 30) Source(44, 30) + SourceIndex(0) name (Sample.Thing) --- >>> var FindWidget = (function () { 1->^^^^^^^^^^^^ @@ -707,9 +702,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > export class 3 > FindWidget -1->Emitted(39, 13) Source(45, 2) + SourceIndex(0) name (Sample.Thing.Widgets) -2 >Emitted(39, 17) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) -3 >Emitted(39, 27) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets) +1->Emitted(37, 13) Source(45, 2) + SourceIndex(0) name (Sample.Thing.Widgets) +2 >Emitted(37, 17) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) +3 >Emitted(37, 27) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets) --- >>> function FindWidget(codeThing) { 1->^^^^^^^^^^^^^^^^ @@ -733,11 +728,11 @@ sourceFile:recursiveClassReferenceTest.ts > private domNode:any = null; > constructor(private 5 > codeThing: Sample.Thing.ICodeThing -1->Emitted(40, 17) Source(50, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(40, 26) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(40, 36) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -4 >Emitted(40, 37) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -5 >Emitted(40, 46) Source(50, 57) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +1->Emitted(38, 17) Source(50, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(38, 26) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(38, 36) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +4 >Emitted(38, 37) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +5 >Emitted(38, 46) Source(50, 57) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) --- >>> this.codeThing = codeThing; 1->^^^^^^^^^^^^^^^^^^^^ @@ -750,11 +745,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > codeThing 5 > : Sample.Thing.ICodeThing -1->Emitted(41, 21) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(41, 35) Source(50, 32) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -3 >Emitted(41, 38) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -4 >Emitted(41, 47) Source(50, 32) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -5 >Emitted(41, 48) Source(50, 57) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1->Emitted(39, 21) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(39, 35) Source(50, 32) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +3 >Emitted(39, 38) Source(50, 23) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +4 >Emitted(39, 47) Source(50, 32) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +5 >Emitted(39, 48) Source(50, 57) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- >>> this.domNode = null; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -767,11 +762,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > :any = 4 > null 5 > ; -1 >Emitted(42, 21) Source(49, 11) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(42, 33) Source(49, 18) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -3 >Emitted(42, 36) Source(49, 25) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -4 >Emitted(42, 40) Source(49, 29) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -5 >Emitted(42, 41) Source(49, 30) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1 >Emitted(40, 21) Source(49, 11) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(40, 33) Source(49, 18) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +3 >Emitted(40, 36) Source(49, 25) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +4 >Emitted(40, 40) Source(49, 29) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +5 >Emitted(40, 41) Source(49, 30) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- >>> // scenario 1 1 >^^^^^^^^^^^^^^^^^^^^ @@ -784,9 +779,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > 3 > // scenario 1 -1 >Emitted(43, 21) Source(52, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(43, 21) Source(51, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -3 >Emitted(43, 34) Source(51, 20) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1 >Emitted(41, 21) Source(52, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(41, 21) Source(51, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +3 >Emitted(41, 34) Source(51, 20) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- >>> codeThing.addWidget("addWidget", this); 1->^^^^^^^^^^^^^^^^^^^^ @@ -810,113 +805,108 @@ sourceFile:recursiveClassReferenceTest.ts 8 > this 9 > ) 10> ; -1->Emitted(44, 21) Source(52, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(44, 30) Source(52, 16) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -3 >Emitted(44, 31) Source(52, 17) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -4 >Emitted(44, 40) Source(52, 26) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -5 >Emitted(44, 41) Source(52, 27) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -6 >Emitted(44, 52) Source(52, 38) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -7 >Emitted(44, 54) Source(52, 40) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -8 >Emitted(44, 58) Source(52, 44) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -9 >Emitted(44, 59) Source(52, 45) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -10>Emitted(44, 60) Source(52, 46) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1->Emitted(42, 21) Source(52, 7) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(42, 30) Source(52, 16) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +3 >Emitted(42, 31) Source(52, 17) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +4 >Emitted(42, 40) Source(52, 26) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +5 >Emitted(42, 41) Source(52, 27) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +6 >Emitted(42, 52) Source(52, 38) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +7 >Emitted(42, 54) Source(52, 40) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +8 >Emitted(42, 58) Source(52, 44) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +9 >Emitted(42, 59) Source(52, 45) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +10>Emitted(42, 60) Source(52, 46) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- >>> } 1 >^^^^^^^^^^^^^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 > } -1 >Emitted(45, 17) Source(53, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) -2 >Emitted(45, 18) Source(53, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +1 >Emitted(43, 17) Source(53, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) +2 >Emitted(43, 18) Source(53, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.constructor) --- ->>> FindWidget.prototype.gar = function (runner) { +>>> FindWidget.prototype.gar = function (runner) { if (true) { 1->^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ 4 > ^^^^^^^^^^ 5 > ^^^^^^ +6 > ^^^^ +7 > ^^ +8 > ^ +9 > ^ +10> ^^^^ +11> ^ +12> ^ +13> ^ 1-> 2 > gar 3 > 4 > public gar( 5 > runner:(widget:Sample.Thing.IWidget)=>any -1->Emitted(46, 17) Source(47, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(46, 41) Source(47, 13) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(46, 44) Source(47, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -4 >Emitted(46, 54) Source(47, 14) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -5 >Emitted(46, 60) Source(47, 55) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +6 > ) { +7 > if +8 > +9 > ( +10> true +11> ) +12> +13> { +1->Emitted(44, 17) Source(47, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(44, 41) Source(47, 13) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(44, 44) Source(47, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +4 >Emitted(44, 54) Source(47, 14) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +5 >Emitted(44, 60) Source(47, 55) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +6 >Emitted(44, 64) Source(47, 59) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +7 >Emitted(44, 66) Source(47, 61) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +8 >Emitted(44, 67) Source(47, 62) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +9 >Emitted(44, 68) Source(47, 63) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +10>Emitted(44, 72) Source(47, 67) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +11>Emitted(44, 73) Source(47, 68) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +12>Emitted(44, 74) Source(47, 69) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +13>Emitted(44, 75) Source(47, 70) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) --- ->>> if (true) { +>>> return runner(this); 1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^^ -3 > ^ -4 > ^ -5 > ^^^^ -6 > ^ -7 > ^ -8 > ^ -9 > ^^^^^^^^^^^^^^-> -1 >) { -2 > if -3 > -4 > ( -5 > true -6 > ) -7 > -8 > { -1 >Emitted(47, 21) Source(47, 59) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -2 >Emitted(47, 23) Source(47, 61) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -3 >Emitted(47, 24) Source(47, 62) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -4 >Emitted(47, 25) Source(47, 63) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -5 >Emitted(47, 29) Source(47, 67) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -6 >Emitted(47, 30) Source(47, 68) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -7 >Emitted(47, 31) Source(47, 69) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -8 >Emitted(47, 32) Source(47, 70) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) ---- ->>> return runner(this); -1->^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^^^ -5 > ^ -6 > ^^^^ -7 > ^ -8 > ^ -1-> -2 > return -3 > -4 > runner -5 > ( -6 > this -7 > ) -8 > ; -1->Emitted(48, 25) Source(47, 70) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -2 >Emitted(48, 31) Source(47, 76) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -3 >Emitted(48, 32) Source(47, 77) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -4 >Emitted(48, 38) Source(47, 83) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -5 >Emitted(48, 39) Source(47, 84) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -6 >Emitted(48, 43) Source(47, 88) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -7 >Emitted(48, 44) Source(47, 89) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -8 >Emitted(48, 45) Source(47, 90) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) ---- ->>> } -1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^^^^ +7 > ^ +8 > ^ 1 > -2 > } -1 >Emitted(49, 21) Source(47, 90) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -2 >Emitted(49, 22) Source(47, 91) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +2 > return +3 > +4 > runner +5 > ( +6 > this +7 > ) +8 > ; +1 >Emitted(45, 21) Source(47, 70) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +2 >Emitted(45, 27) Source(47, 76) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +3 >Emitted(45, 28) Source(47, 77) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +4 >Emitted(45, 34) Source(47, 83) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +5 >Emitted(45, 35) Source(47, 84) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +6 >Emitted(45, 39) Source(47, 88) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +7 >Emitted(45, 40) Source(47, 89) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +8 >Emitted(45, 41) Source(47, 90) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) --- ->>> }; +>>> } }; 1 >^^^^^^^^^^^^^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^ +4 > ^ +5 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > 2 > } -1 >Emitted(50, 17) Source(47, 91) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) -2 >Emitted(50, 18) Source(47, 92) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +3 > +4 > } +1 >Emitted(46, 17) Source(47, 90) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +2 >Emitted(46, 18) Source(47, 91) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +3 >Emitted(46, 19) Source(47, 91) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) +4 >Emitted(46, 20) Source(47, 92) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.gar) --- >>> FindWidget.prototype.getDomNode = function () { 1->^^^^^^^^^^^^^^^^ @@ -933,9 +923,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > getDomNode 3 > -1->Emitted(51, 17) Source(55, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(51, 48) Source(55, 20) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(51, 51) Source(55, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +1->Emitted(47, 17) Source(55, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(47, 48) Source(55, 20) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(47, 51) Source(55, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) --- >>> return domNode; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -949,11 +939,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > domNode 5 > ; -1 >Emitted(52, 21) Source(56, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -2 >Emitted(52, 27) Source(56, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -3 >Emitted(52, 28) Source(56, 11) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -4 >Emitted(52, 35) Source(56, 18) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -5 >Emitted(52, 36) Source(56, 19) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +1 >Emitted(48, 21) Source(56, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +2 >Emitted(48, 27) Source(56, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +3 >Emitted(48, 28) Source(56, 11) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +4 >Emitted(48, 35) Source(56, 18) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +5 >Emitted(48, 36) Source(56, 19) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) --- >>> }; 1 >^^^^^^^^^^^^^^^^ @@ -962,8 +952,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(53, 17) Source(57, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) -2 >Emitted(53, 18) Source(57, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +1 >Emitted(49, 17) Source(57, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) +2 >Emitted(49, 18) Source(57, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.getDomNode) --- >>> FindWidget.prototype.destroy = function () { 1->^^^^^^^^^^^^^^^^ @@ -974,9 +964,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > destroy 3 > -1->Emitted(54, 17) Source(59, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(54, 45) Source(59, 17) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(54, 48) Source(59, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +1->Emitted(50, 17) Source(59, 10) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(50, 45) Source(59, 17) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(50, 48) Source(59, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) --- >>> }; 1 >^^^^^^^^^^^^^^^^ @@ -986,8 +976,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1 >Emitted(55, 17) Source(61, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) -2 >Emitted(55, 18) Source(61, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) +1 >Emitted(51, 17) Source(61, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) +2 >Emitted(51, 18) Source(61, 4) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget.destroy) --- >>> return FindWidget; 1->^^^^^^^^^^^^^^^^ @@ -996,8 +986,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1->Emitted(56, 17) Source(63, 2) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(56, 34) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +1->Emitted(52, 17) Source(63, 2) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(52, 34) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) --- >>> })(); 1 >^^^^^^^^^^^^ @@ -1027,10 +1017,10 @@ sourceFile:recursiveClassReferenceTest.ts > } > > } -1 >Emitted(57, 13) Source(63, 2) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -2 >Emitted(57, 14) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) -3 >Emitted(57, 14) Source(45, 2) + SourceIndex(0) name (Sample.Thing.Widgets) -4 >Emitted(57, 18) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) +1 >Emitted(53, 13) Source(63, 2) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +2 >Emitted(53, 14) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets.FindWidget) +3 >Emitted(53, 14) Source(45, 2) + SourceIndex(0) name (Sample.Thing.Widgets) +4 >Emitted(53, 18) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) --- >>> Widgets.FindWidget = FindWidget; 1->^^^^^^^^^^^^ @@ -1062,11 +1052,11 @@ sourceFile:recursiveClassReferenceTest.ts > > } 5 > -1->Emitted(58, 13) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) -2 >Emitted(58, 31) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets) -3 >Emitted(58, 34) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) -4 >Emitted(58, 44) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) -5 >Emitted(58, 45) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) +1->Emitted(54, 13) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) +2 >Emitted(54, 31) Source(45, 25) + SourceIndex(0) name (Sample.Thing.Widgets) +3 >Emitted(54, 34) Source(45, 15) + SourceIndex(0) name (Sample.Thing.Widgets) +4 >Emitted(54, 44) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) +5 >Emitted(54, 45) Source(63, 3) + SourceIndex(0) name (Sample.Thing.Widgets) --- >>> })(Widgets = Thing.Widgets || (Thing.Widgets = {})); 1->^^^^^^^^ @@ -1108,15 +1098,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(59, 9) Source(64, 1) + SourceIndex(0) name (Sample.Thing.Widgets) -2 >Emitted(59, 10) Source(64, 2) + SourceIndex(0) name (Sample.Thing.Widgets) -3 >Emitted(59, 12) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(59, 19) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -5 >Emitted(59, 22) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -6 >Emitted(59, 35) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -7 >Emitted(59, 40) Source(44, 21) + SourceIndex(0) name (Sample.Thing) -8 >Emitted(59, 53) Source(44, 28) + SourceIndex(0) name (Sample.Thing) -9 >Emitted(59, 61) Source(64, 2) + SourceIndex(0) name (Sample.Thing) +1->Emitted(55, 9) Source(64, 1) + SourceIndex(0) name (Sample.Thing.Widgets) +2 >Emitted(55, 10) Source(64, 2) + SourceIndex(0) name (Sample.Thing.Widgets) +3 >Emitted(55, 12) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(55, 19) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +5 >Emitted(55, 22) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +6 >Emitted(55, 35) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +7 >Emitted(55, 40) Source(44, 21) + SourceIndex(0) name (Sample.Thing) +8 >Emitted(55, 53) Source(44, 28) + SourceIndex(0) name (Sample.Thing) +9 >Emitted(55, 61) Source(64, 2) + SourceIndex(0) name (Sample.Thing) --- >>> })(Thing = Sample.Thing || (Sample.Thing = {})); 1 >^^^^ @@ -1157,15 +1147,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(60, 5) Source(64, 1) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(60, 6) Source(64, 2) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(60, 8) Source(44, 15) + SourceIndex(0) name (Sample) -4 >Emitted(60, 13) Source(44, 20) + SourceIndex(0) name (Sample) -5 >Emitted(60, 16) Source(44, 15) + SourceIndex(0) name (Sample) -6 >Emitted(60, 28) Source(44, 20) + SourceIndex(0) name (Sample) -7 >Emitted(60, 33) Source(44, 15) + SourceIndex(0) name (Sample) -8 >Emitted(60, 45) Source(44, 20) + SourceIndex(0) name (Sample) -9 >Emitted(60, 53) Source(64, 2) + SourceIndex(0) name (Sample) +1 >Emitted(56, 5) Source(64, 1) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(56, 6) Source(64, 2) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(56, 8) Source(44, 15) + SourceIndex(0) name (Sample) +4 >Emitted(56, 13) Source(44, 20) + SourceIndex(0) name (Sample) +5 >Emitted(56, 16) Source(44, 15) + SourceIndex(0) name (Sample) +6 >Emitted(56, 28) Source(44, 20) + SourceIndex(0) name (Sample) +7 >Emitted(56, 33) Source(44, 15) + SourceIndex(0) name (Sample) +8 >Emitted(56, 45) Source(44, 20) + SourceIndex(0) name (Sample) +9 >Emitted(56, 53) Source(64, 2) + SourceIndex(0) name (Sample) --- >>>})(Sample || (Sample = {})); 1 > @@ -1203,13 +1193,13 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(61, 1) Source(64, 1) + SourceIndex(0) name (Sample) -2 >Emitted(61, 2) Source(64, 2) + SourceIndex(0) name (Sample) -3 >Emitted(61, 4) Source(44, 8) + SourceIndex(0) -4 >Emitted(61, 10) Source(44, 14) + SourceIndex(0) -5 >Emitted(61, 15) Source(44, 8) + SourceIndex(0) -6 >Emitted(61, 21) Source(44, 14) + SourceIndex(0) -7 >Emitted(61, 29) Source(64, 2) + SourceIndex(0) +1 >Emitted(57, 1) Source(64, 1) + SourceIndex(0) name (Sample) +2 >Emitted(57, 2) Source(64, 2) + SourceIndex(0) name (Sample) +3 >Emitted(57, 4) Source(44, 8) + SourceIndex(0) +4 >Emitted(57, 10) Source(44, 14) + SourceIndex(0) +5 >Emitted(57, 15) Source(44, 8) + SourceIndex(0) +6 >Emitted(57, 21) Source(44, 14) + SourceIndex(0) +7 >Emitted(57, 29) Source(64, 2) + SourceIndex(0) --- >>>var AbstractMode = (function () { 1-> @@ -1222,9 +1212,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 >class 3 > AbstractMode -1->Emitted(62, 1) Source(67, 1) + SourceIndex(0) -2 >Emitted(62, 5) Source(67, 7) + SourceIndex(0) -3 >Emitted(62, 17) Source(67, 19) + SourceIndex(0) +1->Emitted(58, 1) Source(67, 1) + SourceIndex(0) +2 >Emitted(58, 5) Source(67, 7) + SourceIndex(0) +3 >Emitted(58, 17) Source(67, 19) + SourceIndex(0) --- >>> function AbstractMode() { 1->^^^^ @@ -1233,63 +1223,58 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > class 3 > AbstractMode -1->Emitted(63, 5) Source(67, 1) + SourceIndex(0) name (AbstractMode) -2 >Emitted(63, 14) Source(67, 7) + SourceIndex(0) name (AbstractMode) -3 >Emitted(63, 26) Source(67, 19) + SourceIndex(0) name (AbstractMode) +1->Emitted(59, 5) Source(67, 1) + SourceIndex(0) name (AbstractMode) +2 >Emitted(59, 14) Source(67, 7) + SourceIndex(0) name (AbstractMode) +3 >Emitted(59, 26) Source(67, 19) + SourceIndex(0) name (AbstractMode) --- >>> } 1 >^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > implements IMode { public getInitialState(): IState { return null;} 2 > } -1 >Emitted(64, 5) Source(67, 88) + SourceIndex(0) name (AbstractMode.constructor) -2 >Emitted(64, 6) Source(67, 89) + SourceIndex(0) name (AbstractMode.constructor) +1 >Emitted(60, 5) Source(67, 88) + SourceIndex(0) name (AbstractMode.constructor) +2 >Emitted(60, 6) Source(67, 89) + SourceIndex(0) name (AbstractMode.constructor) --- ->>> AbstractMode.prototype.getInitialState = function () { +>>> AbstractMode.prototype.getInitialState = function () { return null; }; 1->^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^ +10> ^ 1-> 2 > getInitialState 3 > -1->Emitted(65, 5) Source(67, 46) + SourceIndex(0) name (AbstractMode) -2 >Emitted(65, 43) Source(67, 61) + SourceIndex(0) name (AbstractMode) -3 >Emitted(65, 46) Source(67, 39) + SourceIndex(0) name (AbstractMode) ---- ->>> return null; -1 >^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^ -1 >public getInitialState(): IState { -2 > return -3 > -4 > null -5 > ; -1 >Emitted(66, 9) Source(67, 74) + SourceIndex(0) name (AbstractMode.getInitialState) -2 >Emitted(66, 15) Source(67, 80) + SourceIndex(0) name (AbstractMode.getInitialState) -3 >Emitted(66, 16) Source(67, 81) + SourceIndex(0) name (AbstractMode.getInitialState) -4 >Emitted(66, 20) Source(67, 85) + SourceIndex(0) name (AbstractMode.getInitialState) -5 >Emitted(66, 21) Source(67, 86) + SourceIndex(0) name (AbstractMode.getInitialState) ---- ->>> }; -1 >^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^-> -1 > -2 > } -1 >Emitted(67, 5) Source(67, 86) + SourceIndex(0) name (AbstractMode.getInitialState) -2 >Emitted(67, 6) Source(67, 87) + SourceIndex(0) name (AbstractMode.getInitialState) +4 > public getInitialState(): IState { +5 > return +6 > +7 > null +8 > ; +9 > +10> } +1->Emitted(61, 5) Source(67, 46) + SourceIndex(0) name (AbstractMode) +2 >Emitted(61, 43) Source(67, 61) + SourceIndex(0) name (AbstractMode) +3 >Emitted(61, 46) Source(67, 39) + SourceIndex(0) name (AbstractMode) +4 >Emitted(61, 60) Source(67, 74) + SourceIndex(0) name (AbstractMode.getInitialState) +5 >Emitted(61, 66) Source(67, 80) + SourceIndex(0) name (AbstractMode.getInitialState) +6 >Emitted(61, 67) Source(67, 81) + SourceIndex(0) name (AbstractMode.getInitialState) +7 >Emitted(61, 71) Source(67, 85) + SourceIndex(0) name (AbstractMode.getInitialState) +8 >Emitted(61, 72) Source(67, 86) + SourceIndex(0) name (AbstractMode.getInitialState) +9 >Emitted(61, 73) Source(67, 86) + SourceIndex(0) name (AbstractMode.getInitialState) +10>Emitted(61, 74) Source(67, 87) + SourceIndex(0) name (AbstractMode.getInitialState) --- >>> return AbstractMode; -1->^^^^ +1 >^^^^ 2 > ^^^^^^^^^^^^^^^^^^^ -1-> +1 > 2 > } -1->Emitted(68, 5) Source(67, 88) + SourceIndex(0) name (AbstractMode) -2 >Emitted(68, 24) Source(67, 89) + SourceIndex(0) name (AbstractMode) +1 >Emitted(62, 5) Source(67, 88) + SourceIndex(0) name (AbstractMode) +2 >Emitted(62, 24) Source(67, 89) + SourceIndex(0) name (AbstractMode) --- >>>})(); 1 > @@ -1301,10 +1286,10 @@ sourceFile:recursiveClassReferenceTest.ts 2 >} 3 > 4 > class AbstractMode implements IMode { public getInitialState(): IState { return null;} } -1 >Emitted(69, 1) Source(67, 88) + SourceIndex(0) name (AbstractMode) -2 >Emitted(69, 2) Source(67, 89) + SourceIndex(0) name (AbstractMode) -3 >Emitted(69, 2) Source(67, 1) + SourceIndex(0) -4 >Emitted(69, 6) Source(67, 89) + SourceIndex(0) +1 >Emitted(63, 1) Source(67, 88) + SourceIndex(0) name (AbstractMode) +2 >Emitted(63, 2) Source(67, 89) + SourceIndex(0) name (AbstractMode) +3 >Emitted(63, 2) Source(67, 1) + SourceIndex(0) +4 >Emitted(63, 6) Source(67, 89) + SourceIndex(0) --- >>>var Sample; 1-> @@ -1349,10 +1334,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(70, 1) Source(76, 1) + SourceIndex(0) -2 >Emitted(70, 5) Source(76, 8) + SourceIndex(0) -3 >Emitted(70, 11) Source(76, 14) + SourceIndex(0) -4 >Emitted(70, 12) Source(100, 2) + SourceIndex(0) +1->Emitted(64, 1) Source(76, 1) + SourceIndex(0) +2 >Emitted(64, 5) Source(76, 8) + SourceIndex(0) +3 >Emitted(64, 11) Source(76, 14) + SourceIndex(0) +4 >Emitted(64, 12) Source(100, 2) + SourceIndex(0) --- >>>(function (Sample) { 1-> @@ -1361,9 +1346,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 >module 3 > Sample -1->Emitted(71, 1) Source(76, 1) + SourceIndex(0) -2 >Emitted(71, 12) Source(76, 8) + SourceIndex(0) -3 >Emitted(71, 18) Source(76, 14) + SourceIndex(0) +1->Emitted(65, 1) Source(76, 1) + SourceIndex(0) +2 >Emitted(65, 12) Source(76, 8) + SourceIndex(0) +3 >Emitted(65, 18) Source(76, 14) + SourceIndex(0) --- >>> var Thing; 1 >^^^^ @@ -1399,10 +1384,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(72, 5) Source(76, 15) + SourceIndex(0) name (Sample) -2 >Emitted(72, 9) Source(76, 15) + SourceIndex(0) name (Sample) -3 >Emitted(72, 14) Source(76, 20) + SourceIndex(0) name (Sample) -4 >Emitted(72, 15) Source(100, 2) + SourceIndex(0) name (Sample) +1 >Emitted(66, 5) Source(76, 15) + SourceIndex(0) name (Sample) +2 >Emitted(66, 9) Source(76, 15) + SourceIndex(0) name (Sample) +3 >Emitted(66, 14) Source(76, 20) + SourceIndex(0) name (Sample) +4 >Emitted(66, 15) Source(100, 2) + SourceIndex(0) name (Sample) --- >>> (function (Thing) { 1->^^^^ @@ -1412,9 +1397,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Thing -1->Emitted(73, 5) Source(76, 15) + SourceIndex(0) name (Sample) -2 >Emitted(73, 16) Source(76, 15) + SourceIndex(0) name (Sample) -3 >Emitted(73, 21) Source(76, 20) + SourceIndex(0) name (Sample) +1->Emitted(67, 5) Source(76, 15) + SourceIndex(0) name (Sample) +2 >Emitted(67, 16) Source(76, 15) + SourceIndex(0) name (Sample) +3 >Emitted(67, 21) Source(76, 20) + SourceIndex(0) name (Sample) --- >>> var Languages; 1->^^^^^^^^ @@ -1450,10 +1435,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(74, 9) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(74, 13) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(74, 22) Source(76, 30) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(74, 23) Source(100, 2) + SourceIndex(0) name (Sample.Thing) +1->Emitted(68, 9) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(68, 13) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(68, 22) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(68, 23) Source(100, 2) + SourceIndex(0) name (Sample.Thing) --- >>> (function (Languages) { 1->^^^^^^^^ @@ -1462,9 +1447,9 @@ sourceFile:recursiveClassReferenceTest.ts 1-> 2 > 3 > Languages -1->Emitted(75, 9) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(75, 20) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(75, 29) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +1->Emitted(69, 9) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(69, 20) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(69, 29) Source(76, 30) + SourceIndex(0) name (Sample.Thing) --- >>> var PlainText; 1 >^^^^^^^^^^^^ @@ -1500,10 +1485,10 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(76, 13) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -2 >Emitted(76, 17) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -3 >Emitted(76, 26) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -4 >Emitted(76, 27) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) +1 >Emitted(70, 13) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +2 >Emitted(70, 17) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +3 >Emitted(70, 26) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +4 >Emitted(70, 27) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) --- >>> (function (PlainText) { 1->^^^^^^^^^^^^ @@ -1517,11 +1502,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > PlainText 4 > 5 > { -1->Emitted(77, 13) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -2 >Emitted(77, 24) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -3 >Emitted(77, 33) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -4 >Emitted(77, 35) Source(76, 41) + SourceIndex(0) name (Sample.Thing.Languages) -5 >Emitted(77, 36) Source(76, 42) + SourceIndex(0) name (Sample.Thing.Languages) +1->Emitted(71, 13) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +2 >Emitted(71, 24) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +3 >Emitted(71, 33) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +4 >Emitted(71, 35) Source(76, 41) + SourceIndex(0) name (Sample.Thing.Languages) +5 >Emitted(71, 36) Source(76, 42) + SourceIndex(0) name (Sample.Thing.Languages) --- >>> var State = (function () { 1->^^^^^^^^^^^^^^^^ @@ -1533,9 +1518,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > export class 3 > State -1->Emitted(78, 17) Source(78, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(78, 21) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(78, 26) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(72, 17) Source(78, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(72, 21) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(72, 26) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> function State(mode) { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1551,11 +1536,11 @@ sourceFile:recursiveClassReferenceTest.ts 4 > implements IState { > constructor(private 5 > mode: IMode -1->Emitted(79, 21) Source(79, 9) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(79, 30) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(79, 35) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -4 >Emitted(79, 36) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -5 >Emitted(79, 40) Source(79, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +1->Emitted(73, 21) Source(79, 9) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(73, 30) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(73, 35) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +4 >Emitted(73, 36) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +5 >Emitted(73, 40) Source(79, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) --- >>> this.mode = mode; 1->^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1568,11 +1553,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > mode 5 > : IMode -1->Emitted(80, 25) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -2 >Emitted(80, 34) Source(79, 33) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -3 >Emitted(80, 37) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -4 >Emitted(80, 41) Source(79, 33) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -5 >Emitted(80, 42) Source(79, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +1->Emitted(74, 25) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +2 >Emitted(74, 34) Source(79, 33) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +3 >Emitted(74, 37) Source(79, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +4 >Emitted(74, 41) Source(79, 33) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +5 >Emitted(74, 42) Source(79, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) --- >>> } 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1580,8 +1565,8 @@ sourceFile:recursiveClassReferenceTest.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 >) { 2 > } -1 >Emitted(81, 21) Source(79, 44) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) -2 >Emitted(81, 22) Source(79, 45) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +1 >Emitted(75, 21) Source(79, 44) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) +2 >Emitted(75, 22) Source(79, 45) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.constructor) --- >>> State.prototype.clone = function () { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1591,9 +1576,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > clone 3 > -1->Emitted(82, 21) Source(80, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(82, 42) Source(80, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(82, 45) Source(80, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +1->Emitted(76, 21) Source(80, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(76, 42) Source(80, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(76, 45) Source(80, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) --- >>> return this; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1607,11 +1592,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > this 5 > ; -1 >Emitted(83, 25) Source(81, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -2 >Emitted(83, 31) Source(81, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -3 >Emitted(83, 32) Source(81, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -4 >Emitted(83, 36) Source(81, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -5 >Emitted(83, 37) Source(81, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +1 >Emitted(77, 25) Source(81, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +2 >Emitted(77, 31) Source(81, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +3 >Emitted(77, 32) Source(81, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +4 >Emitted(77, 36) Source(81, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +5 >Emitted(77, 37) Source(81, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1620,8 +1605,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(84, 21) Source(82, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) -2 >Emitted(84, 22) Source(82, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +1 >Emitted(78, 21) Source(82, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) +2 >Emitted(78, 22) Source(82, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.clone) --- >>> State.prototype.equals = function (other) { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1636,11 +1621,11 @@ sourceFile:recursiveClassReferenceTest.ts 3 > 4 > public equals( 5 > other:IState -1->Emitted(85, 21) Source(84, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(85, 43) Source(84, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(85, 46) Source(84, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -4 >Emitted(85, 56) Source(84, 17) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -5 >Emitted(85, 61) Source(84, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +1->Emitted(79, 21) Source(84, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(79, 43) Source(84, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(79, 46) Source(84, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +4 >Emitted(79, 56) Source(84, 17) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +5 >Emitted(79, 61) Source(84, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) --- >>> return this === other; 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1658,71 +1643,66 @@ sourceFile:recursiveClassReferenceTest.ts 5 > === 6 > other 7 > ; -1 >Emitted(86, 25) Source(85, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -2 >Emitted(86, 31) Source(85, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -3 >Emitted(86, 32) Source(85, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -4 >Emitted(86, 36) Source(85, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -5 >Emitted(86, 41) Source(85, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -6 >Emitted(86, 46) Source(85, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -7 >Emitted(86, 47) Source(85, 26) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +1 >Emitted(80, 25) Source(85, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +2 >Emitted(80, 31) Source(85, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +3 >Emitted(80, 32) Source(85, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +4 >Emitted(80, 36) Source(85, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +5 >Emitted(80, 41) Source(85, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +6 >Emitted(80, 46) Source(85, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +7 >Emitted(80, 47) Source(85, 26) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ 2 > ^ -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1 > > 2 > } -1 >Emitted(87, 21) Source(86, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) -2 >Emitted(87, 22) Source(86, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +1 >Emitted(81, 21) Source(86, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) +2 >Emitted(81, 22) Source(86, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.equals) --- ->>> State.prototype.getMode = function () { +>>> State.prototype.getMode = function () { return mode; }; 1->^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^ +10> ^ 1-> > > public 2 > getMode 3 > -1->Emitted(88, 21) Source(88, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(88, 44) Source(88, 17) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(88, 47) Source(88, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) ---- ->>> return mode; -1 >^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^ -1 >public getMode(): IMode { -2 > return -3 > -4 > mode -5 > ; -1 >Emitted(89, 25) Source(88, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -2 >Emitted(89, 31) Source(88, 35) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -3 >Emitted(89, 32) Source(88, 36) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -4 >Emitted(89, 36) Source(88, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -5 >Emitted(89, 37) Source(88, 41) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) ---- ->>> }; -1 >^^^^^^^^^^^^^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^-> -1 > -2 > } -1 >Emitted(90, 21) Source(88, 42) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) -2 >Emitted(90, 22) Source(88, 43) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +4 > public getMode(): IMode { +5 > return +6 > +7 > mode +8 > ; +9 > +10> } +1->Emitted(82, 21) Source(88, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(82, 44) Source(88, 17) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(82, 47) Source(88, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +4 >Emitted(82, 61) Source(88, 29) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +5 >Emitted(82, 67) Source(88, 35) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +6 >Emitted(82, 68) Source(88, 36) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +7 >Emitted(82, 72) Source(88, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +8 >Emitted(82, 73) Source(88, 41) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +9 >Emitted(82, 74) Source(88, 42) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) +10>Emitted(82, 75) Source(88, 43) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State.getMode) --- >>> return State; -1->^^^^^^^^^^^^^^^^^^^^ +1 >^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^ -1-> +1 > > 2 > } -1->Emitted(91, 21) Source(89, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(91, 33) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +1 >Emitted(83, 21) Source(89, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(83, 33) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) --- >>> })(); 1 >^^^^^^^^^^^^^^^^ @@ -1745,10 +1725,10 @@ sourceFile:recursiveClassReferenceTest.ts > > public getMode(): IMode { return mode; } > } -1 >Emitted(92, 17) Source(89, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -2 >Emitted(92, 18) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) -3 >Emitted(92, 18) Source(78, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -4 >Emitted(92, 22) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1 >Emitted(84, 17) Source(89, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +2 >Emitted(84, 18) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.State) +3 >Emitted(84, 18) Source(78, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +4 >Emitted(84, 22) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> PlainText.State = State; 1->^^^^^^^^^^^^^^^^ @@ -1773,11 +1753,11 @@ sourceFile:recursiveClassReferenceTest.ts > public getMode(): IMode { return mode; } > } 5 > -1->Emitted(93, 17) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(93, 32) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(93, 35) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -4 >Emitted(93, 40) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -5 >Emitted(93, 41) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(85, 17) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(85, 32) Source(78, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(85, 35) Source(78, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +4 >Emitted(85, 40) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +5 >Emitted(85, 41) Source(89, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> var Mode = (function (_super) { 1->^^^^^^^^^^^^^^^^ @@ -1789,9 +1769,9 @@ sourceFile:recursiveClassReferenceTest.ts > 2 > export class 3 > Mode -1->Emitted(94, 17) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(94, 21) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(94, 25) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(86, 17) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(86, 21) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(86, 25) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> __extends(Mode, _super); 1->^^^^^^^^^^^^^^^^^^^^ @@ -1802,10 +1782,10 @@ sourceFile:recursiveClassReferenceTest.ts 2 > 3 > Mode 4 > extends AbstractMode -1->Emitted(95, 21) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(95, 31) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -3 >Emitted(95, 35) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -4 >Emitted(95, 45) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1->Emitted(87, 21) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(87, 31) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +3 >Emitted(87, 35) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +4 >Emitted(87, 45) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> function Mode() { 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1815,17 +1795,17 @@ sourceFile:recursiveClassReferenceTest.ts 1 > 2 > export class 3 > Mode -1 >Emitted(96, 21) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(96, 30) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -3 >Emitted(96, 34) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1 >Emitted(88, 21) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(88, 30) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +3 >Emitted(88, 34) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> _super.apply(this, arguments); 1->^^^^^^^^^^^^^^^^^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1-> extends 2 > AbstractMode -1->Emitted(97, 25) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) -2 >Emitted(97, 55) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) +1->Emitted(89, 25) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) +2 >Emitted(89, 55) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) --- >>> } 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1841,8 +1821,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1 >Emitted(98, 21) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) -2 >Emitted(98, 22) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) +1 >Emitted(90, 21) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) +2 >Emitted(90, 22) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.constructor) --- >>> // scenario 2 1->^^^^^^^^^^^^^^^^^^^^ @@ -1850,8 +1830,8 @@ sourceFile:recursiveClassReferenceTest.ts 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> 2 > // scenario 2 -1->Emitted(99, 21) Source(93, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(99, 34) Source(93, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1->Emitted(91, 21) Source(93, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(91, 34) Source(93, 16) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> Mode.prototype.getInitialState = function () { 1->^^^^^^^^^^^^^^^^^^^^ @@ -1861,9 +1841,9 @@ sourceFile:recursiveClassReferenceTest.ts > public 2 > getInitialState 3 > -1->Emitted(100, 21) Source(94, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(100, 51) Source(94, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -3 >Emitted(100, 54) Source(94, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1->Emitted(92, 21) Source(94, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(92, 51) Source(94, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +3 >Emitted(92, 54) Source(94, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> return new State(self); 1 >^^^^^^^^^^^^^^^^^^^^^^^^ @@ -1885,15 +1865,15 @@ sourceFile:recursiveClassReferenceTest.ts 7 > self 8 > ) 9 > ; -1 >Emitted(101, 25) Source(95, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -2 >Emitted(101, 31) Source(95, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -3 >Emitted(101, 32) Source(95, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -4 >Emitted(101, 36) Source(95, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -5 >Emitted(101, 41) Source(95, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -6 >Emitted(101, 42) Source(95, 21) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -7 >Emitted(101, 46) Source(95, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -8 >Emitted(101, 47) Source(95, 26) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -9 >Emitted(101, 48) Source(95, 27) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +1 >Emitted(93, 25) Source(95, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +2 >Emitted(93, 31) Source(95, 10) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +3 >Emitted(93, 32) Source(95, 11) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +4 >Emitted(93, 36) Source(95, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +5 >Emitted(93, 41) Source(95, 20) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +6 >Emitted(93, 42) Source(95, 21) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +7 >Emitted(93, 46) Source(95, 25) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +8 >Emitted(93, 47) Source(95, 26) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +9 >Emitted(93, 48) Source(95, 27) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) --- >>> }; 1 >^^^^^^^^^^^^^^^^^^^^ @@ -1902,8 +1882,8 @@ sourceFile:recursiveClassReferenceTest.ts 1 > > 2 > } -1 >Emitted(102, 21) Source(96, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) -2 >Emitted(102, 22) Source(96, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +1 >Emitted(94, 21) Source(96, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) +2 >Emitted(94, 22) Source(96, 4) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode.getInitialState) --- >>> return Mode; 1->^^^^^^^^^^^^^^^^^^^^ @@ -1914,8 +1894,8 @@ sourceFile:recursiveClassReferenceTest.ts > > 2 > } -1->Emitted(103, 21) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(103, 32) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +1->Emitted(95, 21) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(95, 32) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) --- >>> })(AbstractMode); 1->^^^^^^^^^^^^^^^^ @@ -1939,12 +1919,12 @@ sourceFile:recursiveClassReferenceTest.ts > > > } -1->Emitted(104, 17) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -2 >Emitted(104, 18) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) -3 >Emitted(104, 18) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -4 >Emitted(104, 20) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -5 >Emitted(104, 32) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -6 >Emitted(104, 34) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(96, 17) Source(99, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +2 >Emitted(96, 18) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText.Mode) +3 >Emitted(96, 18) Source(91, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +4 >Emitted(96, 20) Source(91, 28) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +5 >Emitted(96, 32) Source(91, 40) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +6 >Emitted(96, 34) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> PlainText.Mode = Mode; 1->^^^^^^^^^^^^^^^^ @@ -1966,11 +1946,11 @@ sourceFile:recursiveClassReferenceTest.ts > > } 5 > -1->Emitted(105, 17) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(105, 31) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(105, 34) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -4 >Emitted(105, 38) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -5 >Emitted(105, 39) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +1->Emitted(97, 17) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(97, 31) Source(91, 19) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(97, 34) Source(91, 15) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +4 >Emitted(97, 38) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +5 >Emitted(97, 39) Source(99, 3) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) --- >>> })(PlainText = Languages.PlainText || (Languages.PlainText = {})); 1->^^^^^^^^^^^^ @@ -2016,15 +1996,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1->Emitted(106, 13) Source(100, 1) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -2 >Emitted(106, 14) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) -3 >Emitted(106, 16) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -4 >Emitted(106, 25) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -5 >Emitted(106, 28) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -6 >Emitted(106, 47) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -7 >Emitted(106, 52) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) -8 >Emitted(106, 71) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) -9 >Emitted(106, 79) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) +1->Emitted(98, 13) Source(100, 1) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +2 >Emitted(98, 14) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages.PlainText) +3 >Emitted(98, 16) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +4 >Emitted(98, 25) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +5 >Emitted(98, 28) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +6 >Emitted(98, 47) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +7 >Emitted(98, 52) Source(76, 31) + SourceIndex(0) name (Sample.Thing.Languages) +8 >Emitted(98, 71) Source(76, 40) + SourceIndex(0) name (Sample.Thing.Languages) +9 >Emitted(98, 79) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) --- >>> })(Languages = Thing.Languages || (Thing.Languages = {})); 1 >^^^^^^^^ @@ -2069,15 +2049,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(107, 9) Source(100, 1) + SourceIndex(0) name (Sample.Thing.Languages) -2 >Emitted(107, 10) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) -3 >Emitted(107, 12) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -4 >Emitted(107, 21) Source(76, 30) + SourceIndex(0) name (Sample.Thing) -5 >Emitted(107, 24) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -6 >Emitted(107, 39) Source(76, 30) + SourceIndex(0) name (Sample.Thing) -7 >Emitted(107, 44) Source(76, 21) + SourceIndex(0) name (Sample.Thing) -8 >Emitted(107, 59) Source(76, 30) + SourceIndex(0) name (Sample.Thing) -9 >Emitted(107, 67) Source(100, 2) + SourceIndex(0) name (Sample.Thing) +1 >Emitted(99, 9) Source(100, 1) + SourceIndex(0) name (Sample.Thing.Languages) +2 >Emitted(99, 10) Source(100, 2) + SourceIndex(0) name (Sample.Thing.Languages) +3 >Emitted(99, 12) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +4 >Emitted(99, 21) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +5 >Emitted(99, 24) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +6 >Emitted(99, 39) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +7 >Emitted(99, 44) Source(76, 21) + SourceIndex(0) name (Sample.Thing) +8 >Emitted(99, 59) Source(76, 30) + SourceIndex(0) name (Sample.Thing) +9 >Emitted(99, 67) Source(100, 2) + SourceIndex(0) name (Sample.Thing) --- >>> })(Thing = Sample.Thing || (Sample.Thing = {})); 1 >^^^^ @@ -2122,15 +2102,15 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(108, 5) Source(100, 1) + SourceIndex(0) name (Sample.Thing) -2 >Emitted(108, 6) Source(100, 2) + SourceIndex(0) name (Sample.Thing) -3 >Emitted(108, 8) Source(76, 15) + SourceIndex(0) name (Sample) -4 >Emitted(108, 13) Source(76, 20) + SourceIndex(0) name (Sample) -5 >Emitted(108, 16) Source(76, 15) + SourceIndex(0) name (Sample) -6 >Emitted(108, 28) Source(76, 20) + SourceIndex(0) name (Sample) -7 >Emitted(108, 33) Source(76, 15) + SourceIndex(0) name (Sample) -8 >Emitted(108, 45) Source(76, 20) + SourceIndex(0) name (Sample) -9 >Emitted(108, 53) Source(100, 2) + SourceIndex(0) name (Sample) +1 >Emitted(100, 5) Source(100, 1) + SourceIndex(0) name (Sample.Thing) +2 >Emitted(100, 6) Source(100, 2) + SourceIndex(0) name (Sample.Thing) +3 >Emitted(100, 8) Source(76, 15) + SourceIndex(0) name (Sample) +4 >Emitted(100, 13) Source(76, 20) + SourceIndex(0) name (Sample) +5 >Emitted(100, 16) Source(76, 15) + SourceIndex(0) name (Sample) +6 >Emitted(100, 28) Source(76, 20) + SourceIndex(0) name (Sample) +7 >Emitted(100, 33) Source(76, 15) + SourceIndex(0) name (Sample) +8 >Emitted(100, 45) Source(76, 20) + SourceIndex(0) name (Sample) +9 >Emitted(100, 53) Source(100, 2) + SourceIndex(0) name (Sample) --- >>>})(Sample || (Sample = {})); 1 > @@ -2172,12 +2152,12 @@ sourceFile:recursiveClassReferenceTest.ts > > } > } -1 >Emitted(109, 1) Source(100, 1) + SourceIndex(0) name (Sample) -2 >Emitted(109, 2) Source(100, 2) + SourceIndex(0) name (Sample) -3 >Emitted(109, 4) Source(76, 8) + SourceIndex(0) -4 >Emitted(109, 10) Source(76, 14) + SourceIndex(0) -5 >Emitted(109, 15) Source(76, 8) + SourceIndex(0) -6 >Emitted(109, 21) Source(76, 14) + SourceIndex(0) -7 >Emitted(109, 29) Source(100, 2) + SourceIndex(0) +1 >Emitted(101, 1) Source(100, 1) + SourceIndex(0) name (Sample) +2 >Emitted(101, 2) Source(100, 2) + SourceIndex(0) name (Sample) +3 >Emitted(101, 4) Source(76, 8) + SourceIndex(0) +4 >Emitted(101, 10) Source(76, 14) + SourceIndex(0) +5 >Emitted(101, 15) Source(76, 8) + SourceIndex(0) +6 >Emitted(101, 21) Source(76, 14) + SourceIndex(0) +7 >Emitted(101, 29) Source(100, 2) + SourceIndex(0) --- >>>//# sourceMappingURL=recursiveClassReferenceTest.js.map \ No newline at end of file diff --git a/tests/baselines/reference/recursiveFunctionTypes.js b/tests/baselines/reference/recursiveFunctionTypes.js index 1158fb539d0..040c323066d 100644 --- a/tests/baselines/reference/recursiveFunctionTypes.js +++ b/tests/baselines/reference/recursiveFunctionTypes.js @@ -45,9 +45,7 @@ f7(""); // ok (function takes an any param) f7(); // ok //// [recursiveFunctionTypes.js] -function fn() { - return 1; -} +function fn() { return 1; } var x = fn; // error var y = fn; // ok var f; @@ -55,9 +53,7 @@ var g; function f1(d) { } function f2() { } function g2() { } -function f3() { - return f3; -} +function f3() { return f3; } var a = f3; // error var C = (function () { function C() { @@ -68,12 +64,8 @@ var C = (function () { C.g(3); // error var f4; f4 = 3; // error -function f5() { - return f5; -} -function f6(a) { - return f6; -} +function f5() { return f5; } +function f6(a) { return f6; } f6("", 3); // error (arity mismatch) f6(""); // ok (function takes an any param) f6(); // ok diff --git a/tests/baselines/reference/recursiveGetterAccess.js b/tests/baselines/reference/recursiveGetterAccess.js index cf042c2c1a0..1dea2e02d3a 100644 --- a/tests/baselines/reference/recursiveGetterAccess.js +++ b/tests/baselines/reference/recursiveGetterAccess.js @@ -10,9 +10,7 @@ var MyClass = (function () { function MyClass() { } Object.defineProperty(MyClass.prototype, "testProp", { - get: function () { - return this.testProp; - }, + get: function () { return this.testProp; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/recursiveIdenticalOverloadResolution.js b/tests/baselines/reference/recursiveIdenticalOverloadResolution.js index e1ea203ac5b..3c53c2b2a0a 100644 --- a/tests/baselines/reference/recursiveIdenticalOverloadResolution.js +++ b/tests/baselines/reference/recursiveIdenticalOverloadResolution.js @@ -20,9 +20,7 @@ module M { //// [recursiveIdenticalOverloadResolution.js] var M; (function (M) { - function f(p) { - return f; - } + function f(p) { return f; } ; var i; f(i); diff --git a/tests/baselines/reference/recursiveInference1.js b/tests/baselines/reference/recursiveInference1.js index 839e13130f2..3a26ead542d 100644 --- a/tests/baselines/reference/recursiveInference1.js +++ b/tests/baselines/reference/recursiveInference1.js @@ -3,7 +3,5 @@ function fib(x:number) { return x <= 1 ? x : fib(x - 1) + fib(x - 2); } var result = fib(5); //// [recursiveInference1.js] -function fib(x) { - return x <= 1 ? x : fib(x - 1) + fib(x - 2); -} +function fib(x) { return x <= 1 ? x : fib(x - 1) + fib(x - 2); } var result = fib(5); diff --git a/tests/baselines/reference/recursiveInferenceBug.js b/tests/baselines/reference/recursiveInferenceBug.js index ff9b1c31434..5b4d4f0c0a1 100644 --- a/tests/baselines/reference/recursiveInferenceBug.js +++ b/tests/baselines/reference/recursiveInferenceBug.js @@ -18,7 +18,5 @@ function f(x) { } var zz = { g: function () { }, - get f() { - return "abc"; - } + get f() { return "abc"; } }; diff --git a/tests/baselines/reference/recursiveInheritance3.js b/tests/baselines/reference/recursiveInheritance3.js index 710b691fa94..bc9fb6cb4f9 100644 --- a/tests/baselines/reference/recursiveInheritance3.js +++ b/tests/baselines/reference/recursiveInheritance3.js @@ -13,8 +13,6 @@ var C = (function () { function C() { this.x = 1; } - C.prototype.foo = function (x) { - return x; - }; + C.prototype.foo = function (x) { return x; }; return C; })(); diff --git a/tests/baselines/reference/recursiveProperties.js b/tests/baselines/reference/recursiveProperties.js index 63644484956..84d9ebcd27c 100644 --- a/tests/baselines/reference/recursiveProperties.js +++ b/tests/baselines/reference/recursiveProperties.js @@ -12,9 +12,7 @@ var A = (function () { function A() { } Object.defineProperty(A.prototype, "testProp", { - get: function () { - return this.testProp; - }, + get: function () { return this.testProp; }, enumerable: true, configurable: true }); @@ -24,9 +22,7 @@ var B = (function () { function B() { } Object.defineProperty(B.prototype, "testProp", { - set: function (value) { - this.testProp = value; - }, + set: function (value) { this.testProp = value; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/recursiveReturns.js b/tests/baselines/reference/recursiveReturns.js index d01825f8cbf..18c9ed4dd7c 100644 --- a/tests/baselines/reference/recursiveReturns.js +++ b/tests/baselines/reference/recursiveReturns.js @@ -20,9 +20,7 @@ function R1() { R1(); return; } -function R2() { - R2(); -} +function R2() { R2(); } function R3(n) { if (n == 0) { } diff --git a/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.js b/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.js index 0d972d3e86c..0cef9be47ab 100644 --- a/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.js +++ b/tests/baselines/reference/recursiveTypesUsedAsFunctionParameters.js @@ -61,9 +61,7 @@ function foo2(x) { function other() { function foo3(x) { } function foo4(x) { } - function foo5(x) { - return null; - } + function foo5(x) { return null; } var list; var myList; var r = foo5(list); diff --git a/tests/baselines/reference/redefineArray.js b/tests/baselines/reference/redefineArray.js index 93494232436..080d2b1a2d2 100644 --- a/tests/baselines/reference/redefineArray.js +++ b/tests/baselines/reference/redefineArray.js @@ -2,6 +2,4 @@ Array = function (n:number, s:string) {return n;}; //// [redefineArray.js] -Array = function (n, s) { - return n; -}; +Array = function (n, s) { return n; }; diff --git a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js index 608090e8722..24f0e7f1bcb 100644 --- a/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js +++ b/tests/baselines/reference/resolvingClassDeclarationWhenInBaseTypeResolution.js @@ -1036,41 +1036,31 @@ var rionegrensis; caniventer.prototype.salomonseni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; caniventer.prototype.uchidai = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; caniventer.prototype.raffrayana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; caniventer.prototype.Uranium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; caniventer.prototype.nayaur = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return caniventer; @@ -1084,41 +1074,31 @@ var rionegrensis; veraecrucis.prototype.naso = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; veraecrucis.prototype.vancouverensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; veraecrucis.prototype.africana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; veraecrucis.prototype.palliolata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; veraecrucis.prototype.nivicola = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return veraecrucis; @@ -1139,41 +1119,31 @@ var julianae; nudicaudus.prototype.brandtii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nudicaudus.prototype.maxwellii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nudicaudus.prototype.endoi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nudicaudus.prototype.venezuelae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nudicaudus.prototype.zamicrus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return nudicaudus; @@ -1185,57 +1155,43 @@ var julianae; galapagoensis.prototype.isabellae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.rueppellii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.peregusna = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.gliroides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.banakrisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.rozendaali = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; galapagoensis.prototype.stuhlmanni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return galapagoensis; @@ -1247,57 +1203,43 @@ var julianae; albidens.prototype.mattheyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.Astatine = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.vincenti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.hirta = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.virginianus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.macrophyllum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; albidens.prototype.porcellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return albidens; @@ -1311,105 +1253,79 @@ var julianae; oralis.prototype.cepapi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.porteri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.bindi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.puda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.mindorensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.ignitus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.rufus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.monax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.unalascensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.wuchihensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.leucippe = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.ordii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oralis.prototype.eisentrauti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return oralis; @@ -1423,57 +1339,43 @@ var julianae; sumatrana.prototype.wolffsohni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.geata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.awashensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.sturdeei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.pachyurus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.lyelli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sumatrana.prototype.neohibernicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return sumatrana; @@ -1485,89 +1387,67 @@ var julianae; gerbillus.prototype.pundti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.tristrami = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.swarthi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.horsfieldii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.diazi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.rennelli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.maulinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.muscina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.pelengensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.abramus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gerbillus.prototype.reevesi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return gerbillus; @@ -1579,97 +1459,73 @@ var julianae; acariensis.prototype.levicula = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.minous = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.cinereiventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.longicaudatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.baeodon = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.soricoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.datae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.spixii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.anakuma = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.kihaulei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.gymnura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; acariensis.prototype.olchonensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return acariensis; @@ -1683,25 +1539,19 @@ var julianae; durangae.prototype.Californium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; durangae.prototype.Flerovium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; durangae.prototype.phrudus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return durangae; @@ -1716,17 +1566,13 @@ var ruatanica; hector.prototype.humulis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; hector.prototype.eurycerus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return hector; @@ -1741,25 +1587,19 @@ var Lanthanum; suillus.prototype.spilosoma = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; suillus.prototype.tumbalensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; suillus.prototype.anatolicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return suillus; @@ -1773,81 +1613,61 @@ var Lanthanum; nitidus.prototype.granatensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.negligens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.lewisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.arge = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.dominicensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.taurus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.tonganus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.silvatica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.midas = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; nitidus.prototype.bicornis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return nitidus; @@ -1861,65 +1681,49 @@ var Lanthanum; megalonyx.prototype.phillipsii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.melanogaster = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.elaphus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.elater = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.ourebi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.caraccioli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.parva = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megalonyx.prototype.albipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return megalonyx; @@ -1931,113 +1735,85 @@ var Lanthanum; jugularis.prototype.torrei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.revoili = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.macrobullatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.compactus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.talpinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.stramineus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.dartmouthi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.ogilbyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.incomtus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.surdaster = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.melanorhinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.picticaudata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.pomona = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; jugularis.prototype.ileile = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return jugularis; @@ -2054,113 +1830,85 @@ var rendalli; zuluensis.prototype.telfairi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.keyensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.occasius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.damarensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.Neptunium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.griseoflavus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.thar = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.alborufus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.fusicaudus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.gordonorum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.ruber = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.desmarestianus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.lutillus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; zuluensis.prototype.salocco = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return zuluensis; @@ -2172,81 +1920,61 @@ var rendalli; moojeni.prototype.floweri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.montosa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.miletus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.heaneyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.marchei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.budini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.maggietaylorae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.poliocephalus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.zibethicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; moojeni.prototype.biacensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return moojeni; @@ -2260,25 +1988,19 @@ var rendalli; crenulata.prototype.salvanius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; crenulata.prototype.maritimus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; crenulata.prototype.edax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return crenulata; @@ -2293,65 +2015,49 @@ var trivirgatus; tumidifrons.prototype.nivalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.vestitus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.aequatorius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.scherman = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.improvisum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.cervinipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.audax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; tumidifrons.prototype.vallinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return tumidifrons; @@ -2365,57 +2071,43 @@ var trivirgatus; mixtus.prototype.ochrogaster = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.bryophilus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.liechtensteini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.crawfordi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.hypsibia = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.matacus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mixtus.prototype.demidoff = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return mixtus; @@ -2427,17 +2119,13 @@ var trivirgatus; lotor.prototype.balensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lotor.prototype.pullata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return lotor; @@ -2449,57 +2137,43 @@ var trivirgatus; falconeri.prototype.cabrali = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.gouldi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.fuscicollis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.martiensseni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.gaoligongensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.shawi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; falconeri.prototype.gmelini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return falconeri; @@ -2511,113 +2185,85 @@ var trivirgatus; oconnelli.prototype.youngsoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.terrestris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.chrysopus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.fuscomurina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.hellwaldii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.aenea = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.perrini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.entellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.krebsii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.cephalotes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.molossinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.luisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.ceylonicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oconnelli.prototype.ralli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return oconnelli; @@ -2632,33 +2278,25 @@ var quasiater; bobrinskoi.prototype.crassicaudatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; bobrinskoi.prototype.mulatta = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; bobrinskoi.prototype.ansorgei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; bobrinskoi.prototype.Copper = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return bobrinskoi; @@ -2675,33 +2313,25 @@ var ruatanica; americanus.prototype.nasoloi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; americanus.prototype.mystacalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; americanus.prototype.fardoulisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; americanus.prototype.tumidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return americanus; @@ -2718,105 +2348,79 @@ var lavali; wilsoni.prototype.setiger = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.lorentzii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.antisensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.blossevillii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.bontanus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.caligata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.franqueti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.roberti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.degelidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.amoenus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.kob = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.csorbai = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wilsoni.prototype.dorsata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return wilsoni; @@ -2836,105 +2440,79 @@ var lavali; otion.prototype.bonaerensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.dussumieri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.osvaldoreigi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.grevyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.hirtula = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.cristatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.darlingtoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.fontanierii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.umbrosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.chiriquinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.orarius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.ilaeus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; otion.prototype.musschenbroekii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return otion; @@ -2946,97 +2524,73 @@ var lavali; xanthognathus.prototype.nanulus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.albigena = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.onca = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.gunnii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.apeco = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.variegates = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.goudotii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.pohlei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.ineptus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.euryotis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.maurisca = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; xanthognathus.prototype.coyhaiquensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return xanthognathus; @@ -3050,65 +2604,49 @@ var lavali; thaeleri.prototype.coromandra = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.parvipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.sponsorius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.vates = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.roosmalenorum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.rubicola = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.ikonnikovi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thaeleri.prototype.paramicrus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return thaeleri; @@ -3122,17 +2660,13 @@ var lavali; lepturus.prototype.ferrumequinum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lepturus.prototype.aequalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return lepturus; @@ -3149,73 +2683,55 @@ var dogramacii; robustulus.prototype.fossor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.humboldti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.mexicana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.martini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.beatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.leporina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.pearsonii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.keaysi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; robustulus.prototype.hindei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return robustulus; @@ -3227,9 +2743,7 @@ var dogramacii; koepckeae.prototype.culturatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return koepckeae; @@ -3241,105 +2755,79 @@ var dogramacii; kaiseri.prototype.bedfordiae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.paramorum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.rubidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.juninensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.marginata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.Meitnerium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.pinetorum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.hoolock = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.poeyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.Thulium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.patrius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.quadraticauda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; kaiseri.prototype.ater = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return kaiseri; @@ -3351,65 +2839,49 @@ var dogramacii; aurata.prototype.grunniens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.howensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.karlkoopmani = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.mirapitanga = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.ophiodon = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.landeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.sonomae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; aurata.prototype.erythromos = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return aurata; @@ -3426,113 +2898,85 @@ var lutreolus; schlegeli.prototype.mittendorfi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.blicki = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.culionensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.scrofa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.fernandoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.Tin = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.marmorata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.tavaratra = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.peregrina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.frontalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.cuniculus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.magdalenae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.andamanensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; schlegeli.prototype.dispar = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return schlegeli; @@ -3547,89 +2991,67 @@ var argurus; dauricus.prototype.chinensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.duodecimcostatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.foxi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.macleayii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.darienensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.hardwickii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.albifrons = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.jacobitus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.guentheri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.mahomet = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dauricus.prototype.misionensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return dauricus; @@ -3644,65 +3066,49 @@ var nigra; dolichurus.prototype.solomonis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.alfredi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.morrisi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.lekaguli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.dimissus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.phaeotis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.ustus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; dolichurus.prototype.sagei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return dolichurus; @@ -3719,49 +3125,37 @@ var panglima; amphibius.prototype.bottegi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.jerdoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.camtschatica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.spadix = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.luismanueli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amphibius.prototype.aceramarcae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return amphibius; @@ -3775,25 +3169,19 @@ var panglima; fundatus.prototype.crassulus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fundatus.prototype.flamarioni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fundatus.prototype.mirabilis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return fundatus; @@ -3807,41 +3195,31 @@ var panglima; abidi.prototype.greyii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; abidi.prototype.macedonicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; abidi.prototype.galili = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; abidi.prototype.thierryi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; abidi.prototype.ega = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return abidi; @@ -3856,57 +3234,43 @@ var quasiater; carolinensis.prototype.concinna = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.aeneus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.aloysiisabaudiae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.tenellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.andium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.persephone = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; carolinensis.prototype.patrizii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return carolinensis; @@ -3923,97 +3287,73 @@ var minutus; himalayana.prototype.simoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.lobata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.rusticus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.latona = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.famulus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.flaviceps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.paradoxolophus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.Osmium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.vulgaris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.betsileoensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.vespuccii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; himalayana.prototype.olympus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return himalayana; @@ -4030,65 +3370,49 @@ var caurinus; mahaganus.prototype.martiniquensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.devius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.masalai = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.kathleenae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.simulus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.nigrovittatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.senegalensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; mahaganus.prototype.acticola = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return mahaganus; @@ -4103,9 +3427,7 @@ var macrorhinos; marmosurus.prototype.tansaniana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return marmosurus; @@ -4122,9 +3444,7 @@ var howi; angulatus.prototype.pennatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return angulatus; @@ -4148,65 +3468,49 @@ var nigra; thalia.prototype.dichotomus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.arnuxii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.verheyeni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.dauuricus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.tristriatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.lasiura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.gangetica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; thalia.prototype.brucei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return thalia; @@ -4223,9 +3527,7 @@ var sagitta; walkeri.prototype.maracajuensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return walkeri; @@ -4242,9 +3544,7 @@ var minutus; inez.prototype.vexillaris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return inez; @@ -4272,73 +3572,55 @@ var panamensis; linulus.prototype.goslingi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.taki = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.fumosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.rufinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.lami = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.regina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.nanilla = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.enganus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; linulus.prototype.gomantongensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return linulus; @@ -4353,105 +3635,79 @@ var nigra; gracilis.prototype.weddellii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.echinothrix = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.garridoi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.rouxii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.aurita = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.geoffrensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.theresa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.melanocarpus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.dubiaquercus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.pectoralis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.apoensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.grisescens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gracilis.prototype.ramirohitra = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return gracilis; @@ -4468,105 +3724,79 @@ var samarensis; pelurus.prototype.Palladium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.castanea = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.chamek = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.nigriceps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.lunatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.madurae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.chinchilla = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.eliasi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.proditor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.gambianus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.petteri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.nusatenggara = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pelurus.prototype.olitor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return pelurus; @@ -4580,113 +3810,85 @@ var samarensis; fuscus.prototype.planifrons = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.badia = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.prymnolopha = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.natalensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.hunteri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.sapiens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.macrocercus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.nimbae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.suricatta = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.jagorii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.beecrofti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.imaizumii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.colocolo = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; fuscus.prototype.wolfi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return fuscus; @@ -4698,33 +3900,25 @@ var samarensis; pallidus.prototype.oblativa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pallidus.prototype.watersi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pallidus.prototype.glacialis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pallidus.prototype.viaria = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return pallidus; @@ -4736,41 +3930,31 @@ var samarensis; cahirinus.prototype.alashanicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cahirinus.prototype.flaviventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cahirinus.prototype.bottai = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cahirinus.prototype.pinetis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cahirinus.prototype.saussurei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return cahirinus; @@ -4787,41 +3971,31 @@ var sagitta; leptoceros.prototype.victus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; leptoceros.prototype.hoplomyoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; leptoceros.prototype.gratiosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; leptoceros.prototype.rex = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; leptoceros.prototype.bolami = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return leptoceros; @@ -4838,9 +4012,7 @@ var daubentonii; nigricans.prototype.woosnami = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return nigricans; @@ -4866,25 +4038,19 @@ var argurus; pygmaea.prototype.pajeros = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pygmaea.prototype.capucinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; pygmaea.prototype.cuvieri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return pygmaea; @@ -4901,57 +4067,43 @@ var chrysaeolus; sarasinorum.prototype.belzebul = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.hinpoon = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.kandti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.cynosuros = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.Germanium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.Ununoctium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sarasinorum.prototype.princeps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return sarasinorum; @@ -4966,57 +4118,43 @@ var argurus; wetmorei.prototype.leucoptera = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.ochraventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.tephromelas = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.cracens = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.jamaicensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.gymnocaudus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wetmorei.prototype.mayori = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return wetmorei; @@ -5033,65 +4171,49 @@ var argurus; oreas.prototype.salamonis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.paniscus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.fagani = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.papuanus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.timidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.nghetinhensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.barbei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; oreas.prototype.univittatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return oreas; @@ -5106,97 +4228,73 @@ var daubentonii; arboreus.prototype.capreolus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.moreni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.hypoleucos = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.paedulcus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.pucheranii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.stella = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.brasiliensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.brevicaudata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.vitticollis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.huangensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.cameroni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; arboreus.prototype.tianshanica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return arboreus; @@ -5211,105 +4309,79 @@ var patas; uralensis.prototype.cartilagonodus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.pyrrhinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.insulans = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.nigricauda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.muricauda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.albicaudus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.fallax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.attenuata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.megalura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.neblina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.citellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.tanezumi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; uralensis.prototype.albiventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return uralensis; @@ -5326,17 +4398,13 @@ var provocax; melanoleuca.prototype.Neodymium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanoleuca.prototype.baeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return melanoleuca; @@ -5351,17 +4419,13 @@ var sagitta; sicarius.prototype.Chlorine = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sicarius.prototype.simulator = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return sicarius; @@ -5378,113 +4442,85 @@ var howi; marcanoi.prototype.formosae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.dudui = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.leander = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.martinsi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.beatrix = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.griseoventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.zerda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.yucatanicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.nigrita = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.jouvenetae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.indefessus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.vuquangensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.Zirconium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; marcanoi.prototype.hyaena = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return marcanoi; @@ -5499,97 +4535,73 @@ var argurus; gilbertii.prototype.nasutus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.poecilops = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.sondaicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.auriventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.cherriei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.lindberghi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.pipistrellus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.paranus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.dubosti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.opossum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.oreopolus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; gilbertii.prototype.amurensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return gilbertii; @@ -5613,105 +4625,79 @@ var lutreolus; punicus.prototype.strandi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.lar = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.erica = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.trichura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.lemniscatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.aspalax = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.marshalli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.Zinc = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.monochromos = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.purinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.ischyrus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.tenuis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; punicus.prototype.Helium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return punicus; @@ -5726,49 +4712,37 @@ var macrorhinos; daphaenodon.prototype.bredanensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.othus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.hammondi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.aureocollaris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.flavipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; daphaenodon.prototype.callosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return daphaenodon; @@ -5783,97 +4757,73 @@ var sagitta; cinereus.prototype.zunigae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.microps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.guaporensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.tonkeana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.montensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.sphinx = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.glis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.dorsalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.fimbriatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.sara = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.epimelas = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cinereus.prototype.pittieri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return cinereus; @@ -5905,81 +4855,61 @@ var gabriellae; amicus.prototype.pirrensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.phaeura = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.voratus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.satarae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.hooperi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.perrensi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.ridei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.audeberti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.Lutetium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; amicus.prototype.atrox = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return amicus; @@ -5991,9 +4921,7 @@ var gabriellae; echinatus.prototype.tenuipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return echinatus; @@ -6008,49 +4936,37 @@ var imperfecta; lasiurus.prototype.marisae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.fulvus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.paranaensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.didactylus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.schreibersii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; lasiurus.prototype.orii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return lasiurus; @@ -6062,89 +4978,67 @@ var imperfecta; subspinosus.prototype.monticularis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.Gadolinium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.oasicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.paterculus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.punctata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.invictus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.stangeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.siskiyou = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.welwitschii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.Polonium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; subspinosus.prototype.harpia = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return subspinosus; @@ -6158,25 +5052,19 @@ var imperfecta; ciliolabrum.prototype.leschenaultii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; ciliolabrum.prototype.ludia = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; ciliolabrum.prototype.sinicus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return ciliolabrum; @@ -6191,33 +5079,25 @@ var quasiater; wattsi.prototype.lagotis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wattsi.prototype.hussoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wattsi.prototype.bilarni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; wattsi.prototype.cabrerae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return wattsi; @@ -6234,73 +5114,55 @@ var petrophilus; sodyi.prototype.saundersiae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.imberbis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.cansdalei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.Lawrencium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.catta = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.breviceps = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.transitionalis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.heptneri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; sodyi.prototype.bairdii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return sodyi; @@ -6317,65 +5179,49 @@ var caurinus; megaphyllus.prototype.montana = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.amatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.bucculentus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.lepida = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.graecus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.forsteri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.perotensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; megaphyllus.prototype.cirrhosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return megaphyllus; @@ -6390,25 +5236,19 @@ var minutus; portoricensis.prototype.relictus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; portoricensis.prototype.aequatorianus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; portoricensis.prototype.rhinogradoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return portoricensis; @@ -6423,105 +5263,79 @@ var lutreolus; foina.prototype.tarfayensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.Promethium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.salinae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.kerri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.scotti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.camerunensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.affinis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.siebersi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.maquassiensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.layardi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.bishopi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.apodemoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; foina.prototype.argentiventer = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return foina; @@ -6538,81 +5352,61 @@ var lutreolus; cor.prototype.antinorii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.voi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.mussoi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.truncatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.achates = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.praedatrix = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.mzabi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.xanthinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.tapoatafa = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; cor.prototype.castroviejoi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return cor; @@ -6627,17 +5421,13 @@ var howi; coludo.prototype.bernhardi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; coludo.prototype.isseli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return coludo; @@ -6654,17 +5444,13 @@ var argurus; germaini.prototype.sharpei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; germaini.prototype.palmarum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return germaini; @@ -6679,89 +5465,67 @@ var sagitta; stolzmanni.prototype.riparius = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.dhofarensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.tricolor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.gardneri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.walleri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.talpoides = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.pallipes = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.lagurus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.hipposideros = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.griselda = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; stolzmanni.prototype.florium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return stolzmanni; @@ -6778,105 +5542,79 @@ var dammermani; melanops.prototype.blarina = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.harwoodi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.ashaninka = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.wiedii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.godmani = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.condorensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.xerophila = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.laminatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.archeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.hidalgo = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.unicolor = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.philippii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; melanops.prototype.bocagei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return melanops; @@ -6893,65 +5631,49 @@ var argurus; peninsulae.prototype.aitkeni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.novaeangliae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.olallae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.anselli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.timminsi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.sordidus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.telfordi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; peninsulae.prototype.cavernarum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return peninsulae; @@ -6966,105 +5688,79 @@ var argurus; netscheri.prototype.gravis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.ruschii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.tricuspidatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.fernandezi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.colletti = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.microbullatus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.eburneae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.tatei = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.millardi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.pruinosus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.delator = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.nyikae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; netscheri.prototype.ruemmleri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return netscheri; @@ -7081,105 +5777,79 @@ var ruatanica; Praseodymium.prototype.clara = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.spectabilis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.kamensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.ruddi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.bartelsii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.yerbabuenae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.davidi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.pilirostris = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.catherinae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.frontata = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.Terbium = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.thomensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; Praseodymium.prototype.soricinus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return Praseodymium; @@ -7196,9 +5866,7 @@ var caurinus; johorensis.prototype.maini = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return johorensis; @@ -7213,9 +5881,7 @@ var argurus; luctuosa.prototype.loriae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return luctuosa; @@ -7230,65 +5896,49 @@ var panamensis; setulosus.prototype.duthieae = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.guereza = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.buselaphus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.nuttalli = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.pelii = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.tunneyi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.lamula = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; setulosus.prototype.vampyrus = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return setulosus; @@ -7303,41 +5953,31 @@ var petrophilus; rosalia.prototype.palmeri = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; rosalia.prototype.baeops = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; rosalia.prototype.ozensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; rosalia.prototype.creaghi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; rosalia.prototype.montivaga = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return rosalia; @@ -7354,49 +5994,37 @@ var caurinus; psilurus.prototype.socialis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.lundi = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.araeum = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.calamianensis = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.petersoni = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; psilurus.prototype.nitela = function () { var _this = this; var x; - (function () { - var y = _this; - }); + (function () { var y = _this; }); return x; }; return psilurus; diff --git a/tests/baselines/reference/returnStatements.js b/tests/baselines/reference/returnStatements.js index 59a91566043..77b6ae1f774 100644 --- a/tests/baselines/reference/returnStatements.js +++ b/tests/baselines/reference/returnStatements.js @@ -32,30 +32,14 @@ var __extends = this.__extends || function (d, b) { d.prototype = new __(); }; // all the following should be valid -function fn1() { - return 1; -} -function fn2() { - return ''; -} -function fn3() { - return undefined; -} -function fn4() { - return; -} -function fn5() { - return true; -} -function fn6() { - return new Date(12); -} -function fn7() { - return null; -} -function fn8() { - return; -} // OK, eq. to 'return undefined' +function fn1() { return 1; } +function fn2() { return ''; } +function fn3() { return undefined; } +function fn4() { return; } +function fn5() { return true; } +function fn6() { return new Date(12); } +function fn7() { return null; } +function fn8() { return; } // OK, eq. to 'return undefined' var C = (function () { function C() { } @@ -69,15 +53,7 @@ var D = (function (_super) { } return D; })(C); -function fn10() { - return { id: 12 }; -} -function fn11() { - return new C(); -} -function fn12() { - return new D(); -} -function fn13() { - return null; -} +function fn10() { return { id: 12 }; } +function fn11() { return new C(); } +function fn12() { return new D(); } +function fn13() { return null; } diff --git a/tests/baselines/reference/returnTypeParameter.js b/tests/baselines/reference/returnTypeParameter.js index 75e8a998942..d5f46cba776 100644 --- a/tests/baselines/reference/returnTypeParameter.js +++ b/tests/baselines/reference/returnTypeParameter.js @@ -4,6 +4,4 @@ function f2(a: T): T { return T; } // bug was that this satisfied the return //// [returnTypeParameter.js] function f(a) { } // error, no return statement -function f2(a) { - return T; -} // bug was that this satisfied the return statement requirement +function f2(a) { return T; } // bug was that this satisfied the return statement requirement diff --git a/tests/baselines/reference/returnTypeParameterWithModules.js b/tests/baselines/reference/returnTypeParameterWithModules.js index 2894774de01..4790fe1341b 100644 --- a/tests/baselines/reference/returnTypeParameterWithModules.js +++ b/tests/baselines/reference/returnTypeParameterWithModules.js @@ -33,9 +33,7 @@ var M2; M2.compose = compose; ; function compose2(g, f) { - return function (x) { - return g(f(x)); - }; + return function (x) { return g(f(x)); }; } M2.compose2 = compose2; ; diff --git a/tests/baselines/reference/returnTypeTypeArguments.js b/tests/baselines/reference/returnTypeTypeArguments.js index 5be549d2f34..b374cb1c581 100644 --- a/tests/baselines/reference/returnTypeTypeArguments.js +++ b/tests/baselines/reference/returnTypeTypeArguments.js @@ -92,65 +92,31 @@ var Three = (function () { } return Three; })(); -function A1() { - return null; -} -function A2() { - return null; -} -function A3() { - return null; -} -function B1() { - return null; -} -function B2() { - return null; -} -function B3() { - return null; -} +function A1() { return null; } +function A2() { return null; } +function A3() { return null; } +function B1() { return null; } +function B2() { return null; } +function B3() { return null; } var C = (function () { function C() { } - C.prototype.A1 = function () { - return null; - }; - C.prototype.A2 = function () { - return null; - }; - C.prototype.A3 = function () { - return null; - }; - C.prototype.B1 = function () { - return null; - }; - C.prototype.B2 = function () { - return null; - }; - C.prototype.B3 = function () { - return null; - }; + C.prototype.A1 = function () { return null; }; + C.prototype.A2 = function () { return null; }; + C.prototype.A3 = function () { return null; }; + C.prototype.B1 = function () { return null; }; + C.prototype.B2 = function () { return null; }; + C.prototype.B3 = function () { return null; }; return C; })(); var D = (function () { function D() { } - D.prototype.A2 = function () { - return null; - }; - D.prototype.A3 = function () { - return null; - }; - D.prototype.B1 = function () { - return null; - }; - D.prototype.B2 = function () { - return null; - }; - D.prototype.B3 = function () { - return null; - }; + D.prototype.A2 = function () { return null; }; + D.prototype.A3 = function () { return null; }; + D.prototype.B1 = function () { return null; }; + D.prototype.B2 = function () { return null; }; + D.prototype.B3 = function () { return null; }; return D; })(); var Y = (function () { diff --git a/tests/baselines/reference/reverseInferenceInContextualInstantiation.js b/tests/baselines/reference/reverseInferenceInContextualInstantiation.js index 7108029ac54..f9c3242e1ea 100644 --- a/tests/baselines/reference/reverseInferenceInContextualInstantiation.js +++ b/tests/baselines/reference/reverseInferenceInContextualInstantiation.js @@ -5,8 +5,6 @@ x.sort(compare); // Error, but shouldn't be //// [reverseInferenceInContextualInstantiation.js] -function compare(a, b) { - return 0; -} +function compare(a, b) { return 0; } var x; x.sort(compare); // Error, but shouldn't be diff --git a/tests/baselines/reference/selfInCallback.js b/tests/baselines/reference/selfInCallback.js index 85f16390f96..25228b03187 100644 --- a/tests/baselines/reference/selfInCallback.js +++ b/tests/baselines/reference/selfInCallback.js @@ -12,14 +12,10 @@ var C = (function () { function C() { this.p1 = 0; } - C.prototype.callback = function (cb) { - cb(); - }; + C.prototype.callback = function (cb) { cb(); }; C.prototype.doit = function () { var _this = this; - this.callback(function () { - _this.p1 + 1; - }); + this.callback(function () { _this.p1 + 1; }); }; return C; })(); diff --git a/tests/baselines/reference/sourceMap-FileWithComments.js b/tests/baselines/reference/sourceMap-FileWithComments.js index 6143ff95fb8..e9755f6c048 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.js +++ b/tests/baselines/reference/sourceMap-FileWithComments.js @@ -48,9 +48,7 @@ var Shapes; this.y = y; } // Instance member - Point.prototype.getDist = function () { - return Math.sqrt(this.x * this.x + this.y * this.y); - }; + Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; // Static member Point.origin = new Point(0, 0); return Point; diff --git a/tests/baselines/reference/sourceMap-FileWithComments.js.map b/tests/baselines/reference/sourceMap-FileWithComments.js.map index 7405d21eb85..28d4566efc7 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.js.map +++ b/tests/baselines/reference/sourceMap-FileWithComments.js.map @@ -1,2 +1,2 @@ //// [sourceMap-FileWithComments.js.map] -{"version":3,"file":"sourceMap-FileWithComments.js","sourceRoot":"","sources":["sourceMap-FileWithComments.ts"],"names":["Shapes","Shapes.Point","Shapes.Point.constructor","Shapes.Point.getDist","Shapes.foo"],"mappings":"AAOA,AADA,SAAS;AACT,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM,EAAC,CAAC;IAGXA,AADAA,QAAQA;QACKA,KAAKA;QACdC,cAAcA;QACdA,SAFSA,KAAKA,CAEKA,CAASA,EAASA,CAASA;YAA3BC,MAACA,GAADA,CAACA,CAAQA;YAASA,MAACA,GAADA,CAACA,CAAQA;QAAIA,CAACA;QAEnDD,kBAAkBA;QAClBA,uBAAOA,GAAPA;YAAYE,MAAMA,CAACA,IAAIA,CAACA,IAAIA,CAACA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,CAACA,CAACA;QAACA,CAACA;QAElEF,gBAAgBA;QACTA,YAAMA,GAAGA,IAAIA,KAAKA,CAACA,CAACA,EAAEA,CAACA,CAACA,CAACA;QACpCA,YAACA;IAADA,CAACA,AATDD,IASCA;IATYA,YAAKA,GAALA,KASZA,CAAAA;IAGDA,AADAA,+BAA+BA;QAC3BA,CAACA,GAAGA,EAAEA,CAACA;IAEXA,SAAgBA,GAAGA;IACnBI,CAACA;IADeJ,UAAGA,GAAHA,GACfA,CAAAA;IAKDA,AAHAA;;MAEEA;QACEA,CAACA,GAAGA,EAAEA,CAACA;AACfA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ;AAGD,AADA,qBAAqB;IACjB,CAAC,GAAW,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,IAAI,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC"} \ No newline at end of file +{"version":3,"file":"sourceMap-FileWithComments.js","sourceRoot":"","sources":["sourceMap-FileWithComments.ts"],"names":["Shapes","Shapes.Point","Shapes.Point.constructor","Shapes.Point.getDist","Shapes.foo"],"mappings":"AAOA,AADA,SAAS;AACT,IAAO,MAAM,CAwBZ;AAxBD,WAAO,MAAM,EAAC,CAAC;IAGXA,AADAA,QAAQA;QACKA,KAAKA;QACdC,cAAcA;QACdA,SAFSA,KAAKA,CAEKA,CAASA,EAASA,CAASA;YAA3BC,MAACA,GAADA,CAACA,CAAQA;YAASA,MAACA,GAADA,CAACA,CAAQA;QAAIA,CAACA;QAEnDD,kBAAkBA;QAClBA,uBAAOA,GAAPA,cAAYE,MAAMA,CAACA,IAAIA,CAACA,IAAIA,CAACA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,GAAGA,IAAIA,CAACA,CAACA,CAACA,CAACA,CAACA,CAACA;QAElEF,gBAAgBA;QACTA,YAAMA,GAAGA,IAAIA,KAAKA,CAACA,CAACA,EAAEA,CAACA,CAACA,CAACA;QACpCA,YAACA;IAADA,CAACA,AATDD,IASCA;IATYA,YAAKA,GAALA,KASZA,CAAAA;IAGDA,AADAA,+BAA+BA;QAC3BA,CAACA,GAAGA,EAAEA,CAACA;IAEXA,SAAgBA,GAAGA;IACnBI,CAACA;IADeJ,UAAGA,GAAHA,GACfA,CAAAA;IAKDA,AAHAA;;MAEEA;QACEA,CAACA,GAAGA,EAAEA,CAACA;AACfA,CAACA,EAxBM,MAAM,KAAN,MAAM,QAwBZ;AAGD,AADA,qBAAqB;IACjB,CAAC,GAAW,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACvC,IAAI,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC"} \ No newline at end of file diff --git a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt index 8dc11688ab0..c0e46430688 100644 --- a/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt +++ b/tests/baselines/reference/sourceMap-FileWithComments.sourcemap.txt @@ -192,7 +192,7 @@ sourceFile:sourceMap-FileWithComments.ts >>> // Instance member 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^ -3 > ^^^^^^^^^^^^^^^^^^^^^^-> +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1-> > > @@ -200,112 +200,106 @@ sourceFile:sourceMap-FileWithComments.ts 1->Emitted(11, 9) Source(15, 9) + SourceIndex(0) name (Shapes.Point) 2 >Emitted(11, 27) Source(15, 27) + SourceIndex(0) name (Shapes.Point) --- ->>> Point.prototype.getDist = function () { +>>> Point.prototype.getDist = function () { return Math.sqrt(this.x * this.x + this.y * this.y); }; 1->^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^^^^^^^^ 3 > ^^^ -4 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +4 > ^^^^^^^^^^^^^^ +5 > ^^^^^^ +6 > ^ +7 > ^^^^ +8 > ^ +9 > ^^^^ +10> ^ +11> ^^^^ +12> ^ +13> ^ +14> ^^^ +15> ^^^^ +16> ^ +17> ^ +18> ^^^ +19> ^^^^ +20> ^ +21> ^ +22> ^^^ +23> ^^^^ +24> ^ +25> ^ +26> ^ +27> ^ +28> ^ +29> ^ 1-> > 2 > getDist 3 > +4 > getDist() { +5 > return +6 > +7 > Math +8 > . +9 > sqrt +10> ( +11> this +12> . +13> x +14> * +15> this +16> . +17> x +18> + +19> this +20> . +21> y +22> * +23> this +24> . +25> y +26> ) +27> ; +28> +29> } 1->Emitted(12, 9) Source(16, 9) + SourceIndex(0) name (Shapes.Point) 2 >Emitted(12, 32) Source(16, 16) + SourceIndex(0) name (Shapes.Point) 3 >Emitted(12, 35) Source(16, 9) + SourceIndex(0) name (Shapes.Point) ---- ->>> return Math.sqrt(this.x * this.x + this.y * this.y); -1->^^^^^^^^^^^^ -2 > ^^^^^^ -3 > ^ -4 > ^^^^ -5 > ^ -6 > ^^^^ -7 > ^ -8 > ^^^^ -9 > ^ -10> ^ -11> ^^^ -12> ^^^^ -13> ^ -14> ^ -15> ^^^ -16> ^^^^ -17> ^ -18> ^ -19> ^^^ -20> ^^^^ -21> ^ -22> ^ -23> ^ -24> ^ -1->getDist() { -2 > return -3 > -4 > Math -5 > . -6 > sqrt -7 > ( -8 > this -9 > . -10> x -11> * -12> this -13> . -14> x -15> + -16> this -17> . -18> y -19> * -20> this -21> . -22> y -23> ) -24> ; -1->Emitted(13, 13) Source(16, 21) + SourceIndex(0) name (Shapes.Point.getDist) -2 >Emitted(13, 19) Source(16, 27) + SourceIndex(0) name (Shapes.Point.getDist) -3 >Emitted(13, 20) Source(16, 28) + SourceIndex(0) name (Shapes.Point.getDist) -4 >Emitted(13, 24) Source(16, 32) + SourceIndex(0) name (Shapes.Point.getDist) -5 >Emitted(13, 25) Source(16, 33) + SourceIndex(0) name (Shapes.Point.getDist) -6 >Emitted(13, 29) Source(16, 37) + SourceIndex(0) name (Shapes.Point.getDist) -7 >Emitted(13, 30) Source(16, 38) + SourceIndex(0) name (Shapes.Point.getDist) -8 >Emitted(13, 34) Source(16, 42) + SourceIndex(0) name (Shapes.Point.getDist) -9 >Emitted(13, 35) Source(16, 43) + SourceIndex(0) name (Shapes.Point.getDist) -10>Emitted(13, 36) Source(16, 44) + SourceIndex(0) name (Shapes.Point.getDist) -11>Emitted(13, 39) Source(16, 47) + SourceIndex(0) name (Shapes.Point.getDist) -12>Emitted(13, 43) Source(16, 51) + SourceIndex(0) name (Shapes.Point.getDist) -13>Emitted(13, 44) Source(16, 52) + SourceIndex(0) name (Shapes.Point.getDist) -14>Emitted(13, 45) Source(16, 53) + SourceIndex(0) name (Shapes.Point.getDist) -15>Emitted(13, 48) Source(16, 56) + SourceIndex(0) name (Shapes.Point.getDist) -16>Emitted(13, 52) Source(16, 60) + SourceIndex(0) name (Shapes.Point.getDist) -17>Emitted(13, 53) Source(16, 61) + SourceIndex(0) name (Shapes.Point.getDist) -18>Emitted(13, 54) Source(16, 62) + SourceIndex(0) name (Shapes.Point.getDist) -19>Emitted(13, 57) Source(16, 65) + SourceIndex(0) name (Shapes.Point.getDist) -20>Emitted(13, 61) Source(16, 69) + SourceIndex(0) name (Shapes.Point.getDist) -21>Emitted(13, 62) Source(16, 70) + SourceIndex(0) name (Shapes.Point.getDist) -22>Emitted(13, 63) Source(16, 71) + SourceIndex(0) name (Shapes.Point.getDist) -23>Emitted(13, 64) Source(16, 72) + SourceIndex(0) name (Shapes.Point.getDist) -24>Emitted(13, 65) Source(16, 73) + SourceIndex(0) name (Shapes.Point.getDist) ---- ->>> }; -1 >^^^^^^^^ -2 > ^ -3 > ^^^^^^^^^^^^^^^^-> -1 > -2 > } -1 >Emitted(14, 9) Source(16, 74) + SourceIndex(0) name (Shapes.Point.getDist) -2 >Emitted(14, 10) Source(16, 75) + SourceIndex(0) name (Shapes.Point.getDist) +4 >Emitted(12, 49) Source(16, 21) + SourceIndex(0) name (Shapes.Point.getDist) +5 >Emitted(12, 55) Source(16, 27) + SourceIndex(0) name (Shapes.Point.getDist) +6 >Emitted(12, 56) Source(16, 28) + SourceIndex(0) name (Shapes.Point.getDist) +7 >Emitted(12, 60) Source(16, 32) + SourceIndex(0) name (Shapes.Point.getDist) +8 >Emitted(12, 61) Source(16, 33) + SourceIndex(0) name (Shapes.Point.getDist) +9 >Emitted(12, 65) Source(16, 37) + SourceIndex(0) name (Shapes.Point.getDist) +10>Emitted(12, 66) Source(16, 38) + SourceIndex(0) name (Shapes.Point.getDist) +11>Emitted(12, 70) Source(16, 42) + SourceIndex(0) name (Shapes.Point.getDist) +12>Emitted(12, 71) Source(16, 43) + SourceIndex(0) name (Shapes.Point.getDist) +13>Emitted(12, 72) Source(16, 44) + SourceIndex(0) name (Shapes.Point.getDist) +14>Emitted(12, 75) Source(16, 47) + SourceIndex(0) name (Shapes.Point.getDist) +15>Emitted(12, 79) Source(16, 51) + SourceIndex(0) name (Shapes.Point.getDist) +16>Emitted(12, 80) Source(16, 52) + SourceIndex(0) name (Shapes.Point.getDist) +17>Emitted(12, 81) Source(16, 53) + SourceIndex(0) name (Shapes.Point.getDist) +18>Emitted(12, 84) Source(16, 56) + SourceIndex(0) name (Shapes.Point.getDist) +19>Emitted(12, 88) Source(16, 60) + SourceIndex(0) name (Shapes.Point.getDist) +20>Emitted(12, 89) Source(16, 61) + SourceIndex(0) name (Shapes.Point.getDist) +21>Emitted(12, 90) Source(16, 62) + SourceIndex(0) name (Shapes.Point.getDist) +22>Emitted(12, 93) Source(16, 65) + SourceIndex(0) name (Shapes.Point.getDist) +23>Emitted(12, 97) Source(16, 69) + SourceIndex(0) name (Shapes.Point.getDist) +24>Emitted(12, 98) Source(16, 70) + SourceIndex(0) name (Shapes.Point.getDist) +25>Emitted(12, 99) Source(16, 71) + SourceIndex(0) name (Shapes.Point.getDist) +26>Emitted(12, 100) Source(16, 72) + SourceIndex(0) name (Shapes.Point.getDist) +27>Emitted(12, 101) Source(16, 73) + SourceIndex(0) name (Shapes.Point.getDist) +28>Emitted(12, 102) Source(16, 74) + SourceIndex(0) name (Shapes.Point.getDist) +29>Emitted(12, 103) Source(16, 75) + SourceIndex(0) name (Shapes.Point.getDist) --- >>> // Static member -1->^^^^^^^^ +1 >^^^^^^^^ 2 > ^^^^^^^^^^^^^^^^ 3 > ^^^^^^^^^^^^^^^^-> -1-> +1 > > > 2 > // Static member -1->Emitted(15, 9) Source(18, 9) + SourceIndex(0) name (Shapes.Point) -2 >Emitted(15, 25) Source(18, 25) + SourceIndex(0) name (Shapes.Point) +1 >Emitted(13, 9) Source(18, 9) + SourceIndex(0) name (Shapes.Point) +2 >Emitted(13, 25) Source(18, 25) + SourceIndex(0) name (Shapes.Point) --- >>> Point.origin = new Point(0, 0); 1->^^^^^^^^ @@ -331,17 +325,17 @@ sourceFile:sourceMap-FileWithComments.ts 9 > 0 10> ) 11> ; -1->Emitted(16, 9) Source(19, 16) + SourceIndex(0) name (Shapes.Point) -2 >Emitted(16, 21) Source(19, 22) + SourceIndex(0) name (Shapes.Point) -3 >Emitted(16, 24) Source(19, 25) + SourceIndex(0) name (Shapes.Point) -4 >Emitted(16, 28) Source(19, 29) + SourceIndex(0) name (Shapes.Point) -5 >Emitted(16, 33) Source(19, 34) + SourceIndex(0) name (Shapes.Point) -6 >Emitted(16, 34) Source(19, 35) + SourceIndex(0) name (Shapes.Point) -7 >Emitted(16, 35) Source(19, 36) + SourceIndex(0) name (Shapes.Point) -8 >Emitted(16, 37) Source(19, 38) + SourceIndex(0) name (Shapes.Point) -9 >Emitted(16, 38) Source(19, 39) + SourceIndex(0) name (Shapes.Point) -10>Emitted(16, 39) Source(19, 40) + SourceIndex(0) name (Shapes.Point) -11>Emitted(16, 40) Source(19, 41) + SourceIndex(0) name (Shapes.Point) +1->Emitted(14, 9) Source(19, 16) + SourceIndex(0) name (Shapes.Point) +2 >Emitted(14, 21) Source(19, 22) + SourceIndex(0) name (Shapes.Point) +3 >Emitted(14, 24) Source(19, 25) + SourceIndex(0) name (Shapes.Point) +4 >Emitted(14, 28) Source(19, 29) + SourceIndex(0) name (Shapes.Point) +5 >Emitted(14, 33) Source(19, 34) + SourceIndex(0) name (Shapes.Point) +6 >Emitted(14, 34) Source(19, 35) + SourceIndex(0) name (Shapes.Point) +7 >Emitted(14, 35) Source(19, 36) + SourceIndex(0) name (Shapes.Point) +8 >Emitted(14, 37) Source(19, 38) + SourceIndex(0) name (Shapes.Point) +9 >Emitted(14, 38) Source(19, 39) + SourceIndex(0) name (Shapes.Point) +10>Emitted(14, 39) Source(19, 40) + SourceIndex(0) name (Shapes.Point) +11>Emitted(14, 40) Source(19, 41) + SourceIndex(0) name (Shapes.Point) --- >>> return Point; 1 >^^^^^^^^ @@ -349,8 +343,8 @@ sourceFile:sourceMap-FileWithComments.ts 1 > > 2 > } -1 >Emitted(17, 9) Source(20, 5) + SourceIndex(0) name (Shapes.Point) -2 >Emitted(17, 21) Source(20, 6) + SourceIndex(0) name (Shapes.Point) +1 >Emitted(15, 9) Source(20, 5) + SourceIndex(0) name (Shapes.Point) +2 >Emitted(15, 21) Source(20, 6) + SourceIndex(0) name (Shapes.Point) --- >>> })(); 1 >^^^^ @@ -371,10 +365,10 @@ sourceFile:sourceMap-FileWithComments.ts > // Static member > static origin = new Point(0, 0); > } -1 >Emitted(18, 5) Source(20, 5) + SourceIndex(0) name (Shapes.Point) -2 >Emitted(18, 6) Source(20, 6) + SourceIndex(0) name (Shapes.Point) -3 >Emitted(18, 6) Source(11, 5) + SourceIndex(0) name (Shapes) -4 >Emitted(18, 10) Source(20, 6) + SourceIndex(0) name (Shapes) +1 >Emitted(16, 5) Source(20, 5) + SourceIndex(0) name (Shapes.Point) +2 >Emitted(16, 6) Source(20, 6) + SourceIndex(0) name (Shapes.Point) +3 >Emitted(16, 6) Source(11, 5) + SourceIndex(0) name (Shapes) +4 >Emitted(16, 10) Source(20, 6) + SourceIndex(0) name (Shapes) --- >>> Shapes.Point = Point; 1->^^^^ @@ -397,11 +391,11 @@ sourceFile:sourceMap-FileWithComments.ts > static origin = new Point(0, 0); > } 5 > -1->Emitted(19, 5) Source(11, 18) + SourceIndex(0) name (Shapes) -2 >Emitted(19, 17) Source(11, 23) + SourceIndex(0) name (Shapes) -3 >Emitted(19, 20) Source(11, 18) + SourceIndex(0) name (Shapes) -4 >Emitted(19, 25) Source(20, 6) + SourceIndex(0) name (Shapes) -5 >Emitted(19, 26) Source(20, 6) + SourceIndex(0) name (Shapes) +1->Emitted(17, 5) Source(11, 18) + SourceIndex(0) name (Shapes) +2 >Emitted(17, 17) Source(11, 23) + SourceIndex(0) name (Shapes) +3 >Emitted(17, 20) Source(11, 18) + SourceIndex(0) name (Shapes) +4 >Emitted(17, 25) Source(20, 6) + SourceIndex(0) name (Shapes) +5 >Emitted(17, 26) Source(20, 6) + SourceIndex(0) name (Shapes) --- >>> // Variable comment after class 1->^^^^ @@ -413,9 +407,9 @@ sourceFile:sourceMap-FileWithComments.ts > 2 > 3 > // Variable comment after class -1->Emitted(20, 5) Source(23, 5) + SourceIndex(0) name (Shapes) -2 >Emitted(20, 5) Source(22, 5) + SourceIndex(0) name (Shapes) -3 >Emitted(20, 36) Source(22, 36) + SourceIndex(0) name (Shapes) +1->Emitted(18, 5) Source(23, 5) + SourceIndex(0) name (Shapes) +2 >Emitted(18, 5) Source(22, 5) + SourceIndex(0) name (Shapes) +3 >Emitted(18, 36) Source(22, 36) + SourceIndex(0) name (Shapes) --- >>> var a = 10; 1 >^^^^^^^^ @@ -430,11 +424,11 @@ sourceFile:sourceMap-FileWithComments.ts 3 > = 4 > 10 5 > ; -1 >Emitted(21, 9) Source(23, 9) + SourceIndex(0) name (Shapes) -2 >Emitted(21, 10) Source(23, 10) + SourceIndex(0) name (Shapes) -3 >Emitted(21, 13) Source(23, 13) + SourceIndex(0) name (Shapes) -4 >Emitted(21, 15) Source(23, 15) + SourceIndex(0) name (Shapes) -5 >Emitted(21, 16) Source(23, 16) + SourceIndex(0) name (Shapes) +1 >Emitted(19, 9) Source(23, 9) + SourceIndex(0) name (Shapes) +2 >Emitted(19, 10) Source(23, 10) + SourceIndex(0) name (Shapes) +3 >Emitted(19, 13) Source(23, 13) + SourceIndex(0) name (Shapes) +4 >Emitted(19, 15) Source(23, 15) + SourceIndex(0) name (Shapes) +5 >Emitted(19, 16) Source(23, 16) + SourceIndex(0) name (Shapes) --- >>> function foo() { 1->^^^^ @@ -445,9 +439,9 @@ sourceFile:sourceMap-FileWithComments.ts > 2 > export function 3 > foo -1->Emitted(22, 5) Source(25, 5) + SourceIndex(0) name (Shapes) -2 >Emitted(22, 14) Source(25, 21) + SourceIndex(0) name (Shapes) -3 >Emitted(22, 17) Source(25, 24) + SourceIndex(0) name (Shapes) +1->Emitted(20, 5) Source(25, 5) + SourceIndex(0) name (Shapes) +2 >Emitted(20, 14) Source(25, 21) + SourceIndex(0) name (Shapes) +3 >Emitted(20, 17) Source(25, 24) + SourceIndex(0) name (Shapes) --- >>> } 1 >^^^^ @@ -456,8 +450,8 @@ sourceFile:sourceMap-FileWithComments.ts 1 >() { > 2 > } -1 >Emitted(23, 5) Source(26, 5) + SourceIndex(0) name (Shapes.foo) -2 >Emitted(23, 6) Source(26, 6) + SourceIndex(0) name (Shapes.foo) +1 >Emitted(21, 5) Source(26, 5) + SourceIndex(0) name (Shapes.foo) +2 >Emitted(21, 6) Source(26, 6) + SourceIndex(0) name (Shapes.foo) --- >>> Shapes.foo = foo; 1->^^^^ @@ -472,11 +466,11 @@ sourceFile:sourceMap-FileWithComments.ts 4 > foo() { > } 5 > -1->Emitted(24, 5) Source(25, 21) + SourceIndex(0) name (Shapes) -2 >Emitted(24, 15) Source(25, 24) + SourceIndex(0) name (Shapes) -3 >Emitted(24, 18) Source(25, 21) + SourceIndex(0) name (Shapes) -4 >Emitted(24, 21) Source(26, 6) + SourceIndex(0) name (Shapes) -5 >Emitted(24, 22) Source(26, 6) + SourceIndex(0) name (Shapes) +1->Emitted(22, 5) Source(25, 21) + SourceIndex(0) name (Shapes) +2 >Emitted(22, 15) Source(25, 24) + SourceIndex(0) name (Shapes) +3 >Emitted(22, 18) Source(25, 21) + SourceIndex(0) name (Shapes) +4 >Emitted(22, 21) Source(26, 6) + SourceIndex(0) name (Shapes) +5 >Emitted(22, 22) Source(26, 6) + SourceIndex(0) name (Shapes) --- >>> /** comment after function 1->^^^^ @@ -489,8 +483,8 @@ sourceFile:sourceMap-FileWithComments.ts > */ > 2 > -1->Emitted(25, 5) Source(31, 5) + SourceIndex(0) name (Shapes) -2 >Emitted(25, 5) Source(28, 5) + SourceIndex(0) name (Shapes) +1->Emitted(23, 5) Source(31, 5) + SourceIndex(0) name (Shapes) +2 >Emitted(23, 5) Source(28, 5) + SourceIndex(0) name (Shapes) --- >>> * this is another comment >>> */ @@ -499,7 +493,7 @@ sourceFile:sourceMap-FileWithComments.ts 1->/** comment after function > * this is another comment > */ -1->Emitted(27, 7) Source(30, 7) + SourceIndex(0) name (Shapes) +1->Emitted(25, 7) Source(30, 7) + SourceIndex(0) name (Shapes) --- >>> var b = 10; 1->^^^^^^^^ @@ -514,11 +508,11 @@ sourceFile:sourceMap-FileWithComments.ts 3 > = 4 > 10 5 > ; -1->Emitted(28, 9) Source(31, 9) + SourceIndex(0) name (Shapes) -2 >Emitted(28, 10) Source(31, 10) + SourceIndex(0) name (Shapes) -3 >Emitted(28, 13) Source(31, 13) + SourceIndex(0) name (Shapes) -4 >Emitted(28, 15) Source(31, 15) + SourceIndex(0) name (Shapes) -5 >Emitted(28, 16) Source(31, 16) + SourceIndex(0) name (Shapes) +1->Emitted(26, 9) Source(31, 9) + SourceIndex(0) name (Shapes) +2 >Emitted(26, 10) Source(31, 10) + SourceIndex(0) name (Shapes) +3 >Emitted(26, 13) Source(31, 13) + SourceIndex(0) name (Shapes) +4 >Emitted(26, 15) Source(31, 15) + SourceIndex(0) name (Shapes) +5 >Emitted(26, 16) Source(31, 16) + SourceIndex(0) name (Shapes) --- >>>})(Shapes || (Shapes = {})); 1-> @@ -560,13 +554,13 @@ sourceFile:sourceMap-FileWithComments.ts > */ > var b = 10; > } -1->Emitted(29, 1) Source(32, 1) + SourceIndex(0) name (Shapes) -2 >Emitted(29, 2) Source(32, 2) + SourceIndex(0) name (Shapes) -3 >Emitted(29, 4) Source(8, 8) + SourceIndex(0) -4 >Emitted(29, 10) Source(8, 14) + SourceIndex(0) -5 >Emitted(29, 15) Source(8, 8) + SourceIndex(0) -6 >Emitted(29, 21) Source(8, 14) + SourceIndex(0) -7 >Emitted(29, 29) Source(32, 2) + SourceIndex(0) +1->Emitted(27, 1) Source(32, 1) + SourceIndex(0) name (Shapes) +2 >Emitted(27, 2) Source(32, 2) + SourceIndex(0) name (Shapes) +3 >Emitted(27, 4) Source(8, 8) + SourceIndex(0) +4 >Emitted(27, 10) Source(8, 14) + SourceIndex(0) +5 >Emitted(27, 15) Source(8, 8) + SourceIndex(0) +6 >Emitted(27, 21) Source(8, 14) + SourceIndex(0) +7 >Emitted(27, 29) Source(32, 2) + SourceIndex(0) --- >>>/** Local Variable */ 1 > @@ -579,9 +573,9 @@ sourceFile:sourceMap-FileWithComments.ts > 2 > 3 >/** Local Variable */ -1 >Emitted(30, 1) Source(35, 1) + SourceIndex(0) -2 >Emitted(30, 1) Source(34, 1) + SourceIndex(0) -3 >Emitted(30, 22) Source(34, 22) + SourceIndex(0) +1 >Emitted(28, 1) Source(35, 1) + SourceIndex(0) +2 >Emitted(28, 1) Source(34, 1) + SourceIndex(0) +3 >Emitted(28, 22) Source(34, 22) + SourceIndex(0) --- >>>var p = new Shapes.Point(3, 4); 1->^^^^ @@ -611,19 +605,19 @@ sourceFile:sourceMap-FileWithComments.ts 11> 4 12> ) 13> ; -1->Emitted(31, 5) Source(35, 5) + SourceIndex(0) -2 >Emitted(31, 6) Source(35, 6) + SourceIndex(0) -3 >Emitted(31, 9) Source(35, 17) + SourceIndex(0) -4 >Emitted(31, 13) Source(35, 21) + SourceIndex(0) -5 >Emitted(31, 19) Source(35, 27) + SourceIndex(0) -6 >Emitted(31, 20) Source(35, 28) + SourceIndex(0) -7 >Emitted(31, 25) Source(35, 33) + SourceIndex(0) -8 >Emitted(31, 26) Source(35, 34) + SourceIndex(0) -9 >Emitted(31, 27) Source(35, 35) + SourceIndex(0) -10>Emitted(31, 29) Source(35, 37) + SourceIndex(0) -11>Emitted(31, 30) Source(35, 38) + SourceIndex(0) -12>Emitted(31, 31) Source(35, 39) + SourceIndex(0) -13>Emitted(31, 32) Source(35, 40) + SourceIndex(0) +1->Emitted(29, 5) Source(35, 5) + SourceIndex(0) +2 >Emitted(29, 6) Source(35, 6) + SourceIndex(0) +3 >Emitted(29, 9) Source(35, 17) + SourceIndex(0) +4 >Emitted(29, 13) Source(35, 21) + SourceIndex(0) +5 >Emitted(29, 19) Source(35, 27) + SourceIndex(0) +6 >Emitted(29, 20) Source(35, 28) + SourceIndex(0) +7 >Emitted(29, 25) Source(35, 33) + SourceIndex(0) +8 >Emitted(29, 26) Source(35, 34) + SourceIndex(0) +9 >Emitted(29, 27) Source(35, 35) + SourceIndex(0) +10>Emitted(29, 29) Source(35, 37) + SourceIndex(0) +11>Emitted(29, 30) Source(35, 38) + SourceIndex(0) +12>Emitted(29, 31) Source(35, 39) + SourceIndex(0) +13>Emitted(29, 32) Source(35, 40) + SourceIndex(0) --- >>>var dist = p.getDist(); 1 > @@ -646,14 +640,14 @@ sourceFile:sourceMap-FileWithComments.ts 7 > getDist 8 > () 9 > ; -1 >Emitted(32, 1) Source(36, 1) + SourceIndex(0) -2 >Emitted(32, 5) Source(36, 5) + SourceIndex(0) -3 >Emitted(32, 9) Source(36, 9) + SourceIndex(0) -4 >Emitted(32, 12) Source(36, 12) + SourceIndex(0) -5 >Emitted(32, 13) Source(36, 13) + SourceIndex(0) -6 >Emitted(32, 14) Source(36, 14) + SourceIndex(0) -7 >Emitted(32, 21) Source(36, 21) + SourceIndex(0) -8 >Emitted(32, 23) Source(36, 23) + SourceIndex(0) -9 >Emitted(32, 24) Source(36, 24) + SourceIndex(0) +1 >Emitted(30, 1) Source(36, 1) + SourceIndex(0) +2 >Emitted(30, 5) Source(36, 5) + SourceIndex(0) +3 >Emitted(30, 9) Source(36, 9) + SourceIndex(0) +4 >Emitted(30, 12) Source(36, 12) + SourceIndex(0) +5 >Emitted(30, 13) Source(36, 13) + SourceIndex(0) +6 >Emitted(30, 14) Source(36, 14) + SourceIndex(0) +7 >Emitted(30, 21) Source(36, 21) + SourceIndex(0) +8 >Emitted(30, 23) Source(36, 23) + SourceIndex(0) +9 >Emitted(30, 24) Source(36, 24) + SourceIndex(0) --- >>>//# sourceMappingURL=sourceMap-FileWithComments.js.map \ No newline at end of file diff --git a/tests/baselines/reference/specializationsShouldNotAffectEachOther.js b/tests/baselines/reference/specializationsShouldNotAffectEachOther.js index d56e0938684..3116571166f 100644 --- a/tests/baselines/reference/specializationsShouldNotAffectEachOther.js +++ b/tests/baselines/reference/specializationsShouldNotAffectEachOther.js @@ -28,6 +28,4 @@ function foo() { series2.map(seriesExtent); return null; } -var keyExtent2 = series.data.map(function (d) { - return d; -}); +var keyExtent2 = series.data.map(function (d) { return d; }); diff --git a/tests/baselines/reference/specializeVarArgs1.js b/tests/baselines/reference/specializeVarArgs1.js index 3eac6daa61f..cc09df1daa6 100644 --- a/tests/baselines/reference/specializeVarArgs1.js +++ b/tests/baselines/reference/specializeVarArgs1.js @@ -23,8 +23,6 @@ a.push('Some Value'); //// [specializeVarArgs1.js] -function observableArray() { - return null; -} +function observableArray() { return null; } var a = observableArray(); a.push('Some Value'); diff --git a/tests/baselines/reference/staticFactory1.js b/tests/baselines/reference/staticFactory1.js index af5780d96cf..529cc230d73 100644 --- a/tests/baselines/reference/staticFactory1.js +++ b/tests/baselines/reference/staticFactory1.js @@ -23,9 +23,7 @@ var __extends = this.__extends || function (d, b) { var Base = (function () { function Base() { } - Base.prototype.foo = function () { - return 1; - }; + Base.prototype.foo = function () { return 1; }; Base.create = function () { return new this(); }; @@ -36,9 +34,7 @@ var Derived = (function (_super) { function Derived() { _super.apply(this, arguments); } - Derived.prototype.foo = function () { - return 2; - }; + Derived.prototype.foo = function () { return 2; }; return Derived; })(Base); var d = Derived.create(); diff --git a/tests/baselines/reference/staticGetterAndSetter.js b/tests/baselines/reference/staticGetterAndSetter.js index 64fcc134ad9..5c61af0b7cc 100644 --- a/tests/baselines/reference/staticGetterAndSetter.js +++ b/tests/baselines/reference/staticGetterAndSetter.js @@ -10,9 +10,7 @@ var Foo = (function () { function Foo() { } Object.defineProperty(Foo, "Foo", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (n) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/staticMemberExportAccess.js b/tests/baselines/reference/staticMemberExportAccess.js index 5de5a76ca7a..37799356708 100644 --- a/tests/baselines/reference/staticMemberExportAccess.js +++ b/tests/baselines/reference/staticMemberExportAccess.js @@ -24,9 +24,7 @@ Sammy.bar(); var Sammy = (function () { function Sammy() { } - Sammy.prototype.foo = function () { - return "hi"; - }; + Sammy.prototype.foo = function () { return "hi"; }; Sammy.bar = function () { return -1; }; diff --git a/tests/baselines/reference/staticMethodsReferencingClassTypeParameters.js b/tests/baselines/reference/staticMethodsReferencingClassTypeParameters.js index 499e16ec581..76fa7d6249e 100644 --- a/tests/baselines/reference/staticMethodsReferencingClassTypeParameters.js +++ b/tests/baselines/reference/staticMethodsReferencingClassTypeParameters.js @@ -7,8 +7,6 @@ class C { var C = (function () { function C() { } - C.s = function (p) { - return p; - }; + C.s = function (p) { return p; }; return C; })(); diff --git a/tests/baselines/reference/staticPropertyNotInClassType.js b/tests/baselines/reference/staticPropertyNotInClassType.js index 3a00c80e033..e9df2b2158d 100644 --- a/tests/baselines/reference/staticPropertyNotInClassType.js +++ b/tests/baselines/reference/staticPropertyNotInClassType.js @@ -47,13 +47,9 @@ var NonGeneric; this.a = a; this.b = b; } - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; Object.defineProperty(C, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true @@ -77,13 +73,9 @@ var Generic; this.a = a; this.b = b; } - C.prototype.fn = function () { - return this; - }; + C.prototype.fn = function () { return this; }; Object.defineProperty(C, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, set: function (v) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/staticVisibility.js b/tests/baselines/reference/staticVisibility.js index 0da2e3dbe2c..7dbf49a2baa 100644 --- a/tests/baselines/reference/staticVisibility.js +++ b/tests/baselines/reference/staticVisibility.js @@ -58,13 +58,9 @@ var C2 = (function () { this.barback = ""; } Object.defineProperty(C2, "Bar", { - get: function () { - return "bar"; - } // ok + get: function () { return "bar"; } // ok , - set: function (bar) { - barback = bar; - } // not ok + set: function (bar) { barback = bar; } // not ok , enumerable: true, configurable: true diff --git a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js index b9195403b20..c9278c40446 100644 --- a/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js +++ b/tests/baselines/reference/stringIndexerConstrainsPropertyDeclarations2.js @@ -50,9 +50,7 @@ var __extends = this.__extends || function (d, b) { var A = (function () { function A() { } - A.prototype.foo = function () { - return ''; - }; + A.prototype.foo = function () { return ''; }; return A; })(); var B = (function (_super) { @@ -60,9 +58,7 @@ var B = (function (_super) { function B() { _super.apply(this, arguments); } - B.prototype.bar = function () { - return ''; - }; + B.prototype.bar = function () { return ''; }; return B; })(A); var Foo = (function () { diff --git a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js index 3a6280b15ba..6260493dea0 100644 --- a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js +++ b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js @@ -113,15 +113,9 @@ function f9(x) { } var C = (function () { function C() { } - C.prototype.toString = function () { - return null; - }; - C.prototype.charAt = function (pos) { - return null; - }; - C.prototype.charCodeAt = function (index) { - return null; - }; + C.prototype.toString = function () { return null; }; + C.prototype.charAt = function (pos) { return null; }; + C.prototype.charCodeAt = function (index) { return null; }; C.prototype.concat = function () { var strings = []; for (var _i = 0; _i < arguments.length; _i++) { @@ -129,51 +123,21 @@ var C = (function () { } return null; }; - C.prototype.indexOf = function (searchString, position) { - return null; - }; - C.prototype.lastIndexOf = function (searchString, position) { - return null; - }; - C.prototype.localeCompare = function (that) { - return null; - }; - C.prototype.match = function (regexp) { - return null; - }; - C.prototype.replace = function (searchValue, replaceValue) { - return null; - }; - C.prototype.search = function (regexp) { - return null; - }; - C.prototype.slice = function (start, end) { - return null; - }; - C.prototype.split = function (separator, limit) { - return null; - }; - C.prototype.substring = function (start, end) { - return null; - }; - C.prototype.toLowerCase = function () { - return null; - }; - C.prototype.toLocaleLowerCase = function () { - return null; - }; - C.prototype.toUpperCase = function () { - return null; - }; - C.prototype.toLocaleUpperCase = function () { - return null; - }; - C.prototype.trim = function () { - return null; - }; - C.prototype.substr = function (from, length) { - return null; - }; + C.prototype.indexOf = function (searchString, position) { return null; }; + C.prototype.lastIndexOf = function (searchString, position) { return null; }; + C.prototype.localeCompare = function (that) { return null; }; + C.prototype.match = function (regexp) { return null; }; + C.prototype.replace = function (searchValue, replaceValue) { return null; }; + C.prototype.search = function (regexp) { return null; }; + C.prototype.slice = function (start, end) { return null; }; + C.prototype.split = function (separator, limit) { return null; }; + C.prototype.substring = function (start, end) { return null; }; + C.prototype.toLowerCase = function () { return null; }; + C.prototype.toLocaleLowerCase = function () { return null; }; + C.prototype.toUpperCase = function () { return null; }; + C.prototype.toLocaleUpperCase = function () { return null; }; + C.prototype.trim = function () { return null; }; + C.prototype.substr = function (from, length) { return null; }; return C; })(); function f10(x) { } diff --git a/tests/baselines/reference/subtypesOfTypeParameter.js b/tests/baselines/reference/subtypesOfTypeParameter.js index 5a5a02733ba..7d739132a77 100644 --- a/tests/baselines/reference/subtypesOfTypeParameter.js +++ b/tests/baselines/reference/subtypesOfTypeParameter.js @@ -178,12 +178,8 @@ function f2(x, y) { var r6 = true ? x : { foo: 1 }; var r7 = true ? function () { } : x; var r7 = true ? x : function () { }; - var r8 = true ? function (x) { - return x; - } : x; - var r8b = true ? x : function (x) { - return x; - }; // type parameters not identical across declarations + var r8 = true ? function (x) { return x; } : x; + var r8b = true ? x : function (x) { return x; }; // type parameters not identical across declarations var i1; var r9 = true ? i1 : x; var r9 = true ? x : i1; diff --git a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js index 0687a434ae6..df4511fb7ad 100644 --- a/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js +++ b/tests/baselines/reference/subtypesOfTypeParameterWithConstraints2.js @@ -249,12 +249,8 @@ function f11(x) { var r7 = true ? x : function () { }; // ok } function f12(x) { - var r8 = true ? function (x) { - return x; - } : x; // ok - var r8b = true ? x : function (x) { - return x; - }; // ok, type parameters not identical across declarations + var r8 = true ? function (x) { return x; } : x; // ok + var r8b = true ? x : function (x) { return x; }; // ok, type parameters not identical across declarations } function f13(x) { var i1; diff --git a/tests/baselines/reference/superCallInNonStaticMethod.js b/tests/baselines/reference/superCallInNonStaticMethod.js index cf29ac3b1a4..7ef1ce1c62a 100644 --- a/tests/baselines/reference/superCallInNonStaticMethod.js +++ b/tests/baselines/reference/superCallInNonStaticMethod.js @@ -70,9 +70,7 @@ var Other = (function (_super) { var _this = this; _super.call(this); this.propertyInitializer = _super.prototype.instanceMethod.call(this); - this.functionProperty = function () { - _super.prototype.instanceMethod.call(_this); - }; + this.functionProperty = function () { _super.prototype.instanceMethod.call(_this); }; _super.prototype.instanceMethod.call(this); } // in instance method diff --git a/tests/baselines/reference/superErrors.js b/tests/baselines/reference/superErrors.js index 418aeed61ed..ce49da10687 100644 --- a/tests/baselines/reference/superErrors.js +++ b/tests/baselines/reference/superErrors.js @@ -87,9 +87,7 @@ var RegisteredUser = (function (_super) { var x = function () { return super.sayHello.call(this); }; } // super call in a lambda in a function expression in a constructor - (function () { - return function () { return super.; }; - })(); + (function () { return function () { return super.; }; })(); } RegisteredUser.prototype.sayHello = function () { // super call in a method @@ -99,9 +97,7 @@ var RegisteredUser = (function (_super) { var x = function () { return super.sayHello.call(this); }; } // super call in a lambda in a function expression in a constructor - (function () { - return function () { return super.; }; - })(); + (function () { return function () { return super.; }; })(); }; RegisteredUser.staticFunction = function () { var _this = this; diff --git a/tests/baselines/reference/superPropertyAccess.js b/tests/baselines/reference/superPropertyAccess.js index 13dfe1ee3a7..a5419aaf36e 100644 --- a/tests/baselines/reference/superPropertyAccess.js +++ b/tests/baselines/reference/superPropertyAccess.js @@ -49,14 +49,10 @@ var MyBase = (function () { this.d1 = 42; this.d2 = 42; } - MyBase.prototype.m1 = function (a) { - return a; - }; + MyBase.prototype.m1 = function (a) { return a; }; MyBase.prototype.p1 = function () { }; Object.defineProperty(MyBase.prototype, "value", { - get: function () { - return 0; - }, + get: function () { return 0; }, set: function (v) { }, enumerable: true, configurable: true @@ -76,9 +72,7 @@ var MyDerived = (function (_super) { _super.prototype.p1.call(this); // Should error, private not public instance member function var l1 = _super.prototype.d1; // Should error, instance data property not a public instance member function var l1 = _super.prototype.d2; // Should error, instance data property not a public instance member function - _super.prototype.m1 = function (a) { - return ""; - }; // Should be allowed, we will not restrict assignment + _super.prototype.m1 = function (a) { return ""; }; // Should be allowed, we will not restrict assignment _super.prototype.value = 0; // Should error, instance data property not a public instance member function var z = _super.prototype.value; // Should error, instance data property not a public instance member function }; diff --git a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js index 48ae609cdc6..7fd55d221ab 100644 --- a/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js +++ b/tests/baselines/reference/super_inside-object-literal-getters-and-setters.js @@ -52,9 +52,7 @@ var ObjectLiteral; var F = (function () { function F() { } - F.prototype.test = function () { - return ""; - }; + F.prototype.test = function () { return ""; }; return F; })(); var SuperObjectTest = (function (_super) { diff --git a/tests/baselines/reference/taggedTemplateContextualTyping1.js b/tests/baselines/reference/taggedTemplateContextualTyping1.js index 173d0f56bb7..17618b50e8b 100644 --- a/tests/baselines/reference/taggedTemplateContextualTyping1.js +++ b/tests/baselines/reference/taggedTemplateContextualTyping1.js @@ -26,28 +26,7 @@ function tempTag1(...rest) { // Otherwise, the arrow functions' parameters will be typed as 'any', // and it is an error to invoke an any-typed value with type arguments, // so this test will error. -tempTag1 `${x => { - x(undefined); - return x; -}}${10}`; -tempTag1 `${x => { - x(undefined); - return x; -}}${y => { - y(undefined); - return y; -}}${10}`; -tempTag1 `${x => { - x(undefined); - return x; -}}${(y) => { - y(undefined); - return y; -}}${undefined}`; -tempTag1 `${(x) => { - x(undefined); - return x; -}}${y => { - y(undefined); - return y; -}}${undefined}`; +tempTag1 `${x => { x(undefined); return x; }}${10}`; +tempTag1 `${x => { x(undefined); return x; }}${y => { y(undefined); return y; }}${10}`; +tempTag1 `${x => { x(undefined); return x; }}${(y) => { y(undefined); return y; }}${undefined}`; +tempTag1 `${(x) => { x(undefined); return x; }}${y => { y(undefined); return y; }}${undefined}`; diff --git a/tests/baselines/reference/taggedTemplateContextualTyping2.js b/tests/baselines/reference/taggedTemplateContextualTyping2.js index 1eed600da4c..8adea53f470 100644 --- a/tests/baselines/reference/taggedTemplateContextualTyping2.js +++ b/tests/baselines/reference/taggedTemplateContextualTyping2.js @@ -25,18 +25,6 @@ function tempTag2(...rest) { // Otherwise, the arrow functions' parameters will be typed as 'any', // and it is an error to invoke an any-typed value with type arguments, // so this test will error. -tempTag2 `${x => { - x(undefined); - return x; -}}${0}`; -tempTag2 `${x => { - x(undefined); - return x; -}}${y => { - y(null); - return y; -}}${"hello"}`; -tempTag2 `${x => { - x(undefined); - return x; -}}${undefined}${"hello"}`; +tempTag2 `${x => { x(undefined); return x; }}${0}`; +tempTag2 `${x => { x(undefined); return x; }}${y => { y(null); return y; }}${"hello"}`; +tempTag2 `${x => { x(undefined); return x; }}${undefined}${"hello"}`; diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js index 14a7015f803..bbcd6637964 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInference.js @@ -136,9 +136,7 @@ someGenerics7 "" + function (n) { return n; } + function (n) { return n; } + fun someGenerics7 "" + function (n) { return n; } + function (n) { return n; } + function (n) { return n; }; someGenerics7 "" + function (n) { return n; } + function (n) { return n; } + function (n) { return n; }; // Generic tag with argument of generic function type -function someGenerics8(strs, n) { - return n; -} +function someGenerics8(strs, n) { return n; } var x = someGenerics8 "" + someGenerics7; x "" + null + null + null; // Generic tag with multiple parameters of generic type passed arguments with no best common type diff --git a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js index 25203c40d91..3f1817c6419 100644 --- a/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js +++ b/tests/baselines/reference/taggedTemplateStringsTypeArgumentInferenceES6.js @@ -135,9 +135,7 @@ someGenerics7 `${n => { return n; }}${n => { return n; }}${n => { return n; }}`; someGenerics7 `${n => { return n; }}${n => { return n; }}${n => { return n; }}`; someGenerics7 `${(n) => { return n; }}${(n) => { return n; }}${(n) => { return n; }}`; // Generic tag with argument of generic function type -function someGenerics8(strs, n) { - return n; -} +function someGenerics8(strs, n) { return n; } var x = someGenerics8 `${someGenerics7}`; x `${null}${null}${null}`; // Generic tag with multiple parameters of generic type passed arguments with no best common type diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js index a28e0103a7e..c6abf11419a 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3.js @@ -74,15 +74,11 @@ fn5 `${ (n) => n.substr(0) }`; //// [taggedTemplateStringsWithOverloadResolution3.js] -function fn1() { - return null; -} +function fn1() { return null; } var s = fn1 "" + undefined; // No candidate overloads found fn1 "" + {}; // Error -function fn2() { - return undefined; -} +function fn2() { return undefined; } var d1 = fn2 "" + 0 + undefined; // contextually typed var d2 = fn2 "" + 0 + undefined; // any d1.foo(); // error @@ -91,9 +87,7 @@ d2(); // no error (typed as any) fn2 "" + 0 + ''; // OK // Generic and non-generic overload where non-generic overload is the only candidate fn2 "" + '' + 0; // OK -function fn3() { - return null; -} +function fn3() { return null; } var s = fn3 "" + 3; var s = fn3 "" + '' + 3 + ''; var n = fn3 "" + 5 + 5 + 5; @@ -115,8 +109,6 @@ fn4 "" + null + null; // Error // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4 "" + true + null; fn4 "" + null + true; -function fn5() { - return undefined; -} +function fn5() { return undefined; } fn5 "" + function (n) { return n.toFixed(); }; // will error; 'n' should have type 'string'. fn5 "" + function (n) { return n.substr(0); }; diff --git a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js index 75a01df6af6..8bcc426627d 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js +++ b/tests/baselines/reference/taggedTemplateStringsWithOverloadResolution3_ES6.js @@ -73,15 +73,11 @@ fn5 `${ (n) => n.substr(0) }`; //// [taggedTemplateStringsWithOverloadResolution3_ES6.js] -function fn1() { - return null; -} +function fn1() { return null; } var s = fn1 `${undefined}`; // No candidate overloads found fn1 `${{}}`; // Error -function fn2() { - return undefined; -} +function fn2() { return undefined; } var d1 = fn2 `${0}${undefined}`; // contextually typed var d2 = fn2 `${0}${undefined}`; // any d1.foo(); // error @@ -90,9 +86,7 @@ d2(); // no error (typed as any) fn2 `${0}${''}`; // OK // Generic and non-generic overload where non-generic overload is the only candidate fn2 `${''}${0}`; // OK -function fn3() { - return null; -} +function fn3() { return null; } var s = fn3 `${3}`; var s = fn3 `${''}${3}${''}`; var n = fn3 `${5}${5}${5}`; @@ -114,8 +108,6 @@ fn4 `${null}${null}`; // Error // Generic overloads with constraints called without type arguments but with types that do not satisfy the constraints fn4 `${true}${null}`; fn4 `${null}${true}`; -function fn5() { - return undefined; -} +function fn5() { return undefined; } fn5 `${(n) => { return n.toFixed(); }}`; // will error; 'n' should have type 'string'. fn5 `${(n) => { return n.substr(0); }}`; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js index eb46f4b603f..a4dd1619642 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js @@ -13,6 +13,4 @@ function foo() { rest[_i - 0] = arguments[_i]; } } -foo "" + function (x) { - x = "bad"; -}; +foo "" + function (x) { x = "bad"; }; diff --git a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js index bc18a600458..7691b83b3bc 100644 --- a/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js +++ b/tests/baselines/reference/taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js @@ -8,6 +8,4 @@ foo `${function (x: number) { x = "bad"; } }`; //// [taggedTemplateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js] function foo(...rest) { } -foo `${function (x) { - x = "bad"; -}}`; +foo `${function (x) { x = "bad"; }}`; diff --git a/tests/baselines/reference/targetTypeArgs.js b/tests/baselines/reference/targetTypeArgs.js index 1a05a6d6f31..18dff375abe 100644 --- a/tests/baselines/reference/targetTypeArgs.js +++ b/tests/baselines/reference/targetTypeArgs.js @@ -18,24 +18,10 @@ foo(function(x) { x }); function foo(callback) { callback("hello"); } -foo(function (x) { - x; -}); -[1].forEach(function (v, i, a) { - v; -}); -["hello"].every(function (v, i, a) { - return true; -}); -[1].every(function (v, i, a) { - return true; -}); -[1].every(function (v, i, a) { - return true; -}); -["s"].every(function (v, i, a) { - return true; -}); -["s"].forEach(function (v, i, a) { - v; -}); +foo(function (x) { x; }); +[1].forEach(function (v, i, a) { v; }); +["hello"].every(function (v, i, a) { return true; }); +[1].every(function (v, i, a) { return true; }); +[1].every(function (v, i, a) { return true; }); +["s"].every(function (v, i, a) { return true; }); +["s"].forEach(function (v, i, a) { v; }); diff --git a/tests/baselines/reference/targetTypeBaseCalls.js b/tests/baselines/reference/targetTypeBaseCalls.js index b09d4960d01..c886183bacf 100644 --- a/tests/baselines/reference/targetTypeBaseCalls.js +++ b/tests/baselines/reference/targetTypeBaseCalls.js @@ -31,18 +31,12 @@ var Foo = (function () { } return Foo; })(); -foo(function (s) { - s = 5; -}); // Error, can’t assign number to string -new Foo(function (s) { - s = 5; -}); // error, if types are applied correctly +foo(function (s) { s = 5; }); // Error, can’t assign number to string +new Foo(function (s) { s = 5; }); // error, if types are applied correctly var Bar = (function (_super) { __extends(Bar, _super); function Bar() { - _super.call(this, function (s) { - s = 5; - }); + _super.call(this, function (s) { s = 5; }); } return Bar; })(Foo); // error, if types are applied correctly diff --git a/tests/baselines/reference/targetTypeCalls.js b/tests/baselines/reference/targetTypeCalls.js index 302419a2693..168195216ca 100644 --- a/tests/baselines/reference/targetTypeCalls.js +++ b/tests/baselines/reference/targetTypeCalls.js @@ -6,27 +6,7 @@ var fra3: (v:any)=>string = function() { return function() { return function(v) var fra4: (v:any)=>void = function() { return function() { return function(v) {return v;};}(); }() // should work //// [targetTypeCalls.js] -var fra1 = function () { - return function (v) { - return v; - }; -}(); // should work -var fra2 = function () { - return function () { - return 0; - }; -}(); // should work -var fra3 = function () { - return function () { - return function (v) { - return v; - }; - }(); -}(); // should work -var fra4 = function () { - return function () { - return function (v) { - return v; - }; - }(); -}(); // should work +var fra1 = function () { return function (v) { return v; }; }(); // should work +var fra2 = function () { return function () { return 0; }; }(); // should work +var fra3 = function () { return function () { return function (v) { return v; }; }(); }(); // should work +var fra4 = function () { return function () { return function (v) { return v; }; }(); }(); // should work diff --git a/tests/baselines/reference/targetTypeCastTest.js b/tests/baselines/reference/targetTypeCastTest.js index c9a30c6d685..053aced7305 100644 --- a/tests/baselines/reference/targetTypeCastTest.js +++ b/tests/baselines/reference/targetTypeCastTest.js @@ -28,12 +28,8 @@ function Point(x, y) { this.x = x; this.y = y; } -var add = function (x, y) { - return x + y; -}; +var add = function (x, y) { return x + y; }; var add2 = function (x, y) { return 0; }; -function add3(x, y) { - x; -} +function add3(x, y) { x; } diff --git a/tests/baselines/reference/targetTypeTest1.js b/tests/baselines/reference/targetTypeTest1.js index 94af7579fbb..1507fcf2a1b 100644 --- a/tests/baselines/reference/targetTypeTest1.js +++ b/tests/baselines/reference/targetTypeTest1.js @@ -80,9 +80,7 @@ function Point(x, y) { this.x = x; this.y = y; } -function EF1(a, b) { - return a + b; -} +function EF1(a, b) { return a + b; } var x = EF1(1, 2); // Point.origin declared as type Point Point.origin = new Point(0, 0); diff --git a/tests/baselines/reference/targetTypeTest2.js b/tests/baselines/reference/targetTypeTest2.js index c6f940572ef..0ba82bc9cce 100644 --- a/tests/baselines/reference/targetTypeTest2.js +++ b/tests/baselines/reference/targetTypeTest2.js @@ -14,9 +14,7 @@ function func2(stuff1:string, stuff2:number, stuff3:number) { //// [targetTypeTest2.js] // Test target typing for array literals and call expressions var a = [1, 2, "3"]; -function func1(stuff) { - return stuff; -} +function func1(stuff) { return stuff; } function func2(stuff1, stuff2, stuff3) { return func1([stuff1, stuff2, stuff3]); } diff --git a/tests/baselines/reference/targetTypeTest3.js b/tests/baselines/reference/targetTypeTest3.js index 53e5691ab49..13972478582 100644 --- a/tests/baselines/reference/targetTypeTest3.js +++ b/tests/baselines/reference/targetTypeTest3.js @@ -14,9 +14,7 @@ function func2(stuff1:string, stuff2:number, stuff3:number) { //// [targetTypeTest3.js] // Test target typing for array literals and call expressions var a = [1, 2, "3"]; // should produce an error -function func1(stuff) { - return stuff; -} +function func1(stuff) { return stuff; } function func2(stuff1, stuff2, stuff3) { return func1([stuff1, stuff2, stuff3]); } diff --git a/tests/baselines/reference/targetTypeVoidFunc.js b/tests/baselines/reference/targetTypeVoidFunc.js index 9913b4bd491..dba2086b0e1 100644 --- a/tests/baselines/reference/targetTypeVoidFunc.js +++ b/tests/baselines/reference/targetTypeVoidFunc.js @@ -9,9 +9,7 @@ var z = new (f1())(); //// [targetTypeVoidFunc.js] function f1() { - return function () { - return; - }; + return function () { return; }; } ; var x = f1(); diff --git a/tests/baselines/reference/targetTypingOnFunctions.js b/tests/baselines/reference/targetTypingOnFunctions.js index 5b11a34ff4d..fad75a4bf6d 100644 --- a/tests/baselines/reference/targetTypingOnFunctions.js +++ b/tests/baselines/reference/targetTypingOnFunctions.js @@ -4,9 +4,5 @@ var fu: (s: string) => string = function (s) { return s.toLowerCase() }; var zu = fu = function (s) { return s.toLowerCase() }; //// [targetTypingOnFunctions.js] -var fu = function (s) { - return s.toLowerCase(); -}; -var zu = fu = function (s) { - return s.toLowerCase(); -}; +var fu = function (s) { return s.toLowerCase(); }; +var zu = fu = function (s) { return s.toLowerCase(); }; diff --git a/tests/baselines/reference/templateStringWithEmbeddedFunctionExpression.js b/tests/baselines/reference/templateStringWithEmbeddedFunctionExpression.js index 3447ff87ac3..88a8349d1a4 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedFunctionExpression.js +++ b/tests/baselines/reference/templateStringWithEmbeddedFunctionExpression.js @@ -2,6 +2,4 @@ var x = `abc${ function y() { return y; } }def`; //// [templateStringWithEmbeddedFunctionExpression.js] -var x = "abc" + function y() { - return y; -} + "def"; +var x = "abc" + function y() { return y; } + "def"; diff --git a/tests/baselines/reference/templateStringWithEmbeddedFunctionExpressionES6.js b/tests/baselines/reference/templateStringWithEmbeddedFunctionExpressionES6.js index 46e37c0ac18..f0e2f749cfd 100644 --- a/tests/baselines/reference/templateStringWithEmbeddedFunctionExpressionES6.js +++ b/tests/baselines/reference/templateStringWithEmbeddedFunctionExpressionES6.js @@ -2,6 +2,4 @@ var x = `abc${ function y() { return y; } }def`; //// [templateStringWithEmbeddedFunctionExpressionES6.js] -var x = `abc${function y() { - return y; -}}def`; +var x = `abc${function y() { return y; }}def`; diff --git a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js index ef113312060..72d0fd8c8db 100644 --- a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js +++ b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js @@ -4,6 +4,4 @@ `${function (x: number) { x = "bad"; } }`; //// [templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.js] -"" + function (x) { - x = "bad"; -}; +"" + function (x) { x = "bad"; }; diff --git a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js index 9ce47348dc1..18fae66c78a 100644 --- a/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js +++ b/tests/baselines/reference/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js @@ -3,6 +3,4 @@ `${function (x: number) { x = "bad"; } }`; //// [templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpressionES6.js] -`${function (x) { - x = "bad"; -}}`; +`${function (x) { x = "bad"; }}`; diff --git a/tests/baselines/reference/thisBinding2.js b/tests/baselines/reference/thisBinding2.js index ced47c0bc7b..76b99797e16 100644 --- a/tests/baselines/reference/thisBinding2.js +++ b/tests/baselines/reference/thisBinding2.js @@ -40,8 +40,6 @@ var messenger = { message: "Hello World", start: function () { var _this = this; - return setTimeout(function () { - var x = _this.message; - }, 3000); + return setTimeout(function () { var x = _this.message; }, 3000); } }; diff --git a/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.js b/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.js index fb917edf753..78b06d30dd2 100644 --- a/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.js +++ b/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.js @@ -10,9 +10,7 @@ var C = (function () { } C.prototype.foo = function () { var _this = this; - [1, 2, 3].map(function (x) { - return _this; - }); + [1, 2, 3].map(function (x) { return _this; }); }; return C; })(); diff --git a/tests/baselines/reference/thisInPropertyBoundDeclarations.js b/tests/baselines/reference/thisInPropertyBoundDeclarations.js index 36ee45b1110..d14ca9d9455 100644 --- a/tests/baselines/reference/thisInPropertyBoundDeclarations.js +++ b/tests/baselines/reference/thisInPropertyBoundDeclarations.js @@ -100,15 +100,11 @@ var A = (function () { } }; this.prop4 = { - a: function () { - return this; - } + a: function () { return this; } }; this.prop5 = function () { return { - a: function () { - return this; - } + a: function () { return this; } }; }; } @@ -123,15 +119,11 @@ var B = (function () { this.prop4 = ' ' + function () { } + ' ' + (function () { return function () { return function () { return _this; }; }; }); this.prop5 = { - a: function () { - return _this; - } + a: function () { return _this; } }; this.prop6 = function () { return { - a: function () { - return _this; - } + a: function () { return _this; } }; }; } diff --git a/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js b/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js index 77fdc507887..99341af9f86 100644 --- a/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js +++ b/tests/baselines/reference/thisReferencedInFunctionInsideArrowFunction1.js @@ -11,8 +11,6 @@ function test() var foo = function (dummy) { }; function test() { foo(function () { - return function () { - return this; - }; + return function () { return this; }; }); } diff --git a/tests/baselines/reference/throwInEnclosingStatements.js b/tests/baselines/reference/throwInEnclosingStatements.js index b52926e651e..0b072434f33 100644 --- a/tests/baselines/reference/throwInEnclosingStatements.js +++ b/tests/baselines/reference/throwInEnclosingStatements.js @@ -50,9 +50,7 @@ var aa = { function fn(x) { throw x; } -(function (x) { - throw x; -}); +(function (x) { throw x; }); var y; switch (y) { case 'a': diff --git a/tests/baselines/reference/throwStatements.js b/tests/baselines/reference/throwStatements.js index 146d1232792..83663d08cc4 100644 --- a/tests/baselines/reference/throwStatements.js +++ b/tests/baselines/reference/throwStatements.js @@ -97,9 +97,7 @@ var D = (function () { } return D; })(); -function F(x) { - return 42; -} +function F(x) { return 42; } var M; (function (M) { var A = (function () { @@ -108,9 +106,7 @@ var M; return A; })(); M.A = A; - function F2(x) { - return x.toString(); - } + function F2(x) { return x.toString(); } M.F2 = F2; })(M || (M = {})); var aNumber = 9.9; @@ -155,9 +151,7 @@ throw false; throw null; throw undefined; throw 'a string'; -throw function () { - return 'a string'; -}; +throw function () { return 'a string'; }; throw function (x) { return 42; }; throw { x: 12, y: 13 }; throw []; diff --git a/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.js b/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.js index 8aa23c82469..4b00c5fd0f2 100644 --- a/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.js +++ b/tests/baselines/reference/tooFewArgumentsInGenericFunctionTypedArgument.js @@ -19,10 +19,6 @@ var r1b = _.map(c2, rf1); //// [tooFewArgumentsInGenericFunctionTypedArgument.js] var c2; var _; -var r1a = _.map(c2, function (x) { - return x.toFixed(); -}); -var rf1 = function (x) { - return x.toFixed(); -}; +var r1a = _.map(c2, function (x) { return x.toFixed(); }); +var rf1 = function (x) { return x.toFixed(); }; var r1b = _.map(c2, rf1); diff --git a/tests/baselines/reference/topLevelExports.js b/tests/baselines/reference/topLevelExports.js index 0f539310b15..91e28b6a976 100644 --- a/tests/baselines/reference/topLevelExports.js +++ b/tests/baselines/reference/topLevelExports.js @@ -8,8 +8,6 @@ void log(foo).toString(); //// [topLevelExports.js] define(["require", "exports"], function (require, exports) { exports.foo = 3; - function log(n) { - return n; - } + function log(n) { return n; } void log(exports.foo).toString(); }); diff --git a/tests/baselines/reference/topLevelLambda.js b/tests/baselines/reference/topLevelLambda.js index 756a42b4340..3c4f1a3bc84 100644 --- a/tests/baselines/reference/topLevelLambda.js +++ b/tests/baselines/reference/topLevelLambda.js @@ -8,7 +8,5 @@ module M { var M; (function (M) { var _this = this; - var f = function () { - _this.window; - }; + var f = function () { _this.window; }; })(M || (M = {})); diff --git a/tests/baselines/reference/topLevelLambda3.js b/tests/baselines/reference/topLevelLambda3.js index 1505e38956a..0314b356b0f 100644 --- a/tests/baselines/reference/topLevelLambda3.js +++ b/tests/baselines/reference/topLevelLambda3.js @@ -3,6 +3,4 @@ var f = () => {this.window;} //// [topLevelLambda3.js] var _this = this; -var f = function () { - _this.window; -}; +var f = function () { _this.window; }; diff --git a/tests/baselines/reference/twoAccessorsWithSameName.js b/tests/baselines/reference/twoAccessorsWithSameName.js index 2d15bf6a02a..1e447ea1205 100644 --- a/tests/baselines/reference/twoAccessorsWithSameName.js +++ b/tests/baselines/reference/twoAccessorsWithSameName.js @@ -39,9 +39,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/twoAccessorsWithSameName2.js b/tests/baselines/reference/twoAccessorsWithSameName2.js index b6ef280156d..847f83e6a70 100644 --- a/tests/baselines/reference/twoAccessorsWithSameName2.js +++ b/tests/baselines/reference/twoAccessorsWithSameName2.js @@ -21,9 +21,7 @@ var C = (function () { function C() { } Object.defineProperty(C, "x", { - get: function () { - return 1; - }, + get: function () { return 1; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/typeArgumentConstraintResolution1.js b/tests/baselines/reference/typeArgumentConstraintResolution1.js index 64b1bfe5b6c..fd661dd812c 100644 --- a/tests/baselines/reference/typeArgumentConstraintResolution1.js +++ b/tests/baselines/reference/typeArgumentConstraintResolution1.js @@ -15,7 +15,5 @@ foo2(""); // Type Date does not satisfy the constraint 'Number' for type p //// [typeArgumentConstraintResolution1.js] function foo1(test) { } foo1(""); // should error -function foo2(test) { - return null; -} +function foo2(test) { return null; } foo2(""); // Type Date does not satisfy the constraint 'Number' for type parameter 'T extends Number' diff --git a/tests/baselines/reference/typeArgumentInference.js b/tests/baselines/reference/typeArgumentInference.js index 65de6ea071f..1d10562ac7c 100644 --- a/tests/baselines/reference/typeArgumentInference.js +++ b/tests/baselines/reference/typeArgumentInference.js @@ -150,9 +150,7 @@ someGenerics7(function (n) { return n; }, function (n) { return n; }, function ( someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); // Generic call with argument of generic function type -function someGenerics8(n) { - return n; -} +function someGenerics8(n) { return n; } var x = someGenerics8(someGenerics7); x(null, null, null); // Generic call with multiple parameters of generic type passed arguments with no best common type diff --git a/tests/baselines/reference/typeArgumentInferenceOrdering.js b/tests/baselines/reference/typeArgumentInferenceOrdering.js index 53917844f66..96978bfd489 100644 --- a/tests/baselines/reference/typeArgumentInferenceOrdering.js +++ b/tests/baselines/reference/typeArgumentInferenceOrdering.js @@ -16,9 +16,7 @@ interface Goo { //// [typeArgumentInferenceOrdering.js] -function foo(f) { - return null; -} +function foo(f) { return null; } var x = foo(new C()).x; // was Error that property x does not exist on type {} var C = (function () { function C() { diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.js b/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.js index 50d7767b5db..941c9330a5f 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.js +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraintAsCommonRoot.js @@ -8,9 +8,7 @@ var e: Elephant; f(g, e); // valid because both Giraffe and Elephant satisfy the constraint. T is Animal //// [typeArgumentInferenceWithConstraintAsCommonRoot.js] -function f(x, y) { - return undefined; -} +function f(x, y) { return undefined; } var g; var e; f(g, e); // valid because both Giraffe and Elephant satisfy the constraint. T is Animal diff --git a/tests/baselines/reference/typeArgumentInferenceWithConstraints.js b/tests/baselines/reference/typeArgumentInferenceWithConstraints.js index f2300de8144..b8c051f0c37 100644 --- a/tests/baselines/reference/typeArgumentInferenceWithConstraints.js +++ b/tests/baselines/reference/typeArgumentInferenceWithConstraints.js @@ -160,9 +160,7 @@ someGenerics7(function (n) { return n; }, function (n) { return n; }, function ( someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); someGenerics7(function (n) { return n; }, function (n) { return n; }, function (n) { return n; }); // Generic call with argument of generic function type -function someGenerics8(n) { - return n; -} +function someGenerics8(n) { return n; } var x = someGenerics8(someGenerics7); // Error x(null, null, null); // Error // Generic call with multiple parameters of generic type passed arguments with no best common type diff --git a/tests/baselines/reference/typeAssertionToGenericFunctionType.js b/tests/baselines/reference/typeAssertionToGenericFunctionType.js index 1746cee3e85..15e5cf82f26 100644 --- a/tests/baselines/reference/typeAssertionToGenericFunctionType.js +++ b/tests/baselines/reference/typeAssertionToGenericFunctionType.js @@ -9,9 +9,7 @@ x.b(); // error //// [typeAssertionToGenericFunctionType.js] var x = { a: (function (x) { return 1; }), - b: function (x) { - x; - } + b: function (x) { x; } }; x.a(1); // bug was that this caused 'Could not find symbol T' on return type T in the type assertion on x.a's definition x.b(); // error diff --git a/tests/baselines/reference/typeInfer1.js b/tests/baselines/reference/typeInfer1.js index f0b14a6b6c9..f9613298838 100644 --- a/tests/baselines/reference/typeInfer1.js +++ b/tests/baselines/reference/typeInfer1.js @@ -19,7 +19,5 @@ var x = { WriteLine: function (s) { } }; var yyyyyyyy = { - Moo: function () { - return "cow"; - } + Moo: function () { return "cow"; } }; diff --git a/tests/baselines/reference/typeMatch2.js b/tests/baselines/reference/typeMatch2.js index f262adb4e18..1fd624e4e5b 100644 --- a/tests/baselines/reference/typeMatch2.js +++ b/tests/baselines/reference/typeMatch2.js @@ -93,12 +93,8 @@ function f4() { a = { x: 1, y: _any }; a = { x: 1, y: _any, z: 1 }; a = { x: 1 }; // error - var mf = function m(n) { - return false; - }; - var zf = function z(n) { - return true; - }; + var mf = function m(n) { return false; }; + var zf = function z(n) { return true; }; mf = zf; mf(_any); zf(_any); diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraint.js b/tests/baselines/reference/typeParameterAsTypeParameterConstraint.js index c54e8694c6e..9266f520867 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraint.js +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraint.js @@ -29,18 +29,14 @@ foo2(1, ['']); //// [typeParameterAsTypeParameterConstraint.js] // using a type parameter as a constraint for a type parameter is valid // no errors expected except illegal constraints -function foo(x, y) { - return y; -} +function foo(x, y) { return y; } var r = foo(1, 2); var r = foo({}, 1); var a; var b; var r2 = foo(a, b); var r3 = foo({ x: 1 }, { x: 2, y: 3 }); -function foo2(x, y) { - return y; -} +function foo2(x, y) { return y; } foo2(1, ''); foo2({}, { length: 2 }); foo2(1, { width: 3, length: 2 }); diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.js b/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.js index 9e1b3b1b3ec..e8066b9ebfa 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.js +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraint2.js @@ -21,16 +21,12 @@ foo2([], ['']); //// [typeParameterAsTypeParameterConstraint2.js] // using a type parameter as a constraint for a type parameter is invalid // these should be errors unless otherwise noted -function foo(x, y) { - return y; -} // this is now an error +function foo(x, y) { return y; } // this is now an error foo(1, ''); foo(1, {}); var n; var r3 = foo(1, n); -function foo2(x, y) { - return y; -} // this is now an error +function foo2(x, y) { return y; } // this is now an error foo2(1, { length: '' }); foo2(1, { length: {} }); foo2([], ['']); diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.js b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.js index 20cadec3981..bc50363036d 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.js +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively.js @@ -30,18 +30,14 @@ foo(b, b, { foo: 1, bar: '', hm: '' }); var a; var b; var c; -function foo(x, y, z) { - return z; -} +function foo(x, y, z) { return z; } //function foo(x: T, y: U, z: V): V { return z; } foo(1, 2, 3); foo({ x: 1 }, { x: 1, y: '' }, { x: 2, y: '', z: true }); foo(a, b, c); foo(a, b, { foo: 1, bar: '', hm: true }); foo(function (x, y) { }, function (x) { }, function () { }); -function foo2(x, y, z) { - return z; -} +function foo2(x, y, z) { return z; } //function foo2(x: T, y: U, z: V): V { return z; } foo(a, a, a); foo(a, b, c); diff --git a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.js b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.js index c63c1e9e13a..6541cfaa231 100644 --- a/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.js +++ b/tests/baselines/reference/typeParameterAsTypeParameterConstraintTransitively2.js @@ -29,18 +29,14 @@ foo(c, c, a); var a; var b; var c; -function foo(x, y, z) { - return z; -} +function foo(x, y, z) { return z; } //function foo(x: T, y: U, z: V): V { return z; } foo(1, 2, ''); foo({ x: 1 }, { x: 1, y: '' }, { x: 2, y: 2, z: true }); foo(a, b, a); foo(a, { foo: 1, bar: '', hm: true }, b); foo(function (x, y) { }, function (x, y) { }, function () { }); -function foo2(x, y, z) { - return z; -} +function foo2(x, y, z) { return z; } //function foo2(x: T, y: U, z: V): V { return z; } foo(b, a, c); foo(c, c, a); diff --git a/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.js b/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.js index 04fb7b1dc25..7e923941386 100644 --- a/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.js +++ b/tests/baselines/reference/typeParameterCompatibilityAccrossDeclarations.js @@ -25,14 +25,10 @@ i2 = a2; // no error //// [typeParameterCompatibilityAccrossDeclarations.js] define(["require", "exports"], function (require, exports) { var a = { - x: function (y) { - return null; - } + x: function (y) { return null; } }; var a2 = { - x: function (y) { - return null; - } + x: function (y) { return null; } }; var i; var i2; diff --git a/tests/baselines/reference/typeParametersInStaticAccessors.js b/tests/baselines/reference/typeParametersInStaticAccessors.js index 2f9d8c795ff..c621de910bc 100644 --- a/tests/baselines/reference/typeParametersInStaticAccessors.js +++ b/tests/baselines/reference/typeParametersInStaticAccessors.js @@ -9,9 +9,7 @@ var foo = (function () { function foo() { } Object.defineProperty(foo, "Foo", { - get: function () { - return null; - }, + get: function () { return null; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/typeQueryOnClass.js b/tests/baselines/reference/typeQueryOnClass.js index 5c881a5ced3..1c8b2424a7e 100644 --- a/tests/baselines/reference/typeQueryOnClass.js +++ b/tests/baselines/reference/typeQueryOnClass.js @@ -82,9 +82,7 @@ var C = (function () { enumerable: true, configurable: true }); - C.prototype.baz = function (x) { - return ''; - }; + C.prototype.baz = function (x) { return ''; }; Object.defineProperty(C.prototype, "ic", { get: function () { return 1; diff --git a/tests/baselines/reference/typeofOperatorWithBooleanType.js b/tests/baselines/reference/typeofOperatorWithBooleanType.js index d7c5a1a5edf..82af3eac26f 100644 --- a/tests/baselines/reference/typeofOperatorWithBooleanType.js +++ b/tests/baselines/reference/typeofOperatorWithBooleanType.js @@ -53,15 +53,11 @@ z: typeof M.n; //// [typeofOperatorWithBooleanType.js] // typeof operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/typeofOperatorWithNumberType.js b/tests/baselines/reference/typeofOperatorWithNumberType.js index d40f09ee604..14b45ab518f 100644 --- a/tests/baselines/reference/typeofOperatorWithNumberType.js +++ b/tests/baselines/reference/typeofOperatorWithNumberType.js @@ -61,15 +61,11 @@ z: typeof M.n; // typeof operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -83,9 +79,7 @@ var ResultIsString2 = typeof NUMBER1; // number type literal var ResultIsString3 = typeof 1; var ResultIsString4 = typeof { x: 1, y: 2 }; -var ResultIsString5 = typeof { x: 1, y: function (n) { - return n; -} }; +var ResultIsString5 = typeof { x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsString6 = typeof objA.a; var ResultIsString7 = typeof M.n; diff --git a/tests/baselines/reference/typeofOperatorWithStringType.js b/tests/baselines/reference/typeofOperatorWithStringType.js index b3c3b748df6..381205ff8c1 100644 --- a/tests/baselines/reference/typeofOperatorWithStringType.js +++ b/tests/baselines/reference/typeofOperatorWithStringType.js @@ -61,15 +61,11 @@ z: typeof M.n; // typeof operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -83,9 +79,7 @@ var ResultIsString2 = typeof STRING1; // string type literal var ResultIsString3 = typeof ""; var ResultIsString4 = typeof { x: "", y: "" }; -var ResultIsString5 = typeof { x: "", y: function (s) { - return s; -} }; +var ResultIsString5 = typeof { x: "", y: function (s) { return s; } }; // string type expressions var ResultIsString6 = typeof objA.a; var ResultIsString7 = typeof M.n; diff --git a/tests/baselines/reference/underscoreTest1.js b/tests/baselines/reference/underscoreTest1.js index b9bfe51533c..bbecbac4059 100644 --- a/tests/baselines/reference/underscoreTest1.js +++ b/tests/baselines/reference/underscoreTest1.js @@ -962,21 +962,15 @@ _.range(0, 30, 5); _.range(0, 30, 5); _.range(0); /////////////////////////////////////////////////////////////////////////////////////// -var func = function (greeting) { - return greeting + ': ' + this.name; -}; +var func = function (greeting) { return greeting + ': ' + this.name; }; // need a second var otherwise typescript thinks func signature is the above func type, // instead of the newly returned _bind => func type. var func2 = _.bind(func, { name: 'moe' }, 'hi'); func2(); var buttonView = { label: 'underscore', - onClick: function () { - alert('clicked: ' + this.label); - }, - onHover: function () { - alert('hovering: ' + this.label); - } + onClick: function () { alert('clicked: ' + this.label); }, + onHover: function () { alert('hovering: ' + this.label); } }; _.bindAll(buttonView); $('#underscore_button').bind('click', buttonView.onClick); @@ -985,9 +979,7 @@ var fibonacci = _.memoize(function (n) { }); var log = _.bind(function (message) { }, Date); _.delay(log, 1000, 'logged later'); -_.defer(function () { - alert('deferred'); -}); +_.defer(function () { alert('deferred'); }); var updatePosition = function () { return alert('updating position...'); }; var throttled = _.throttle(updatePosition, 100); $(null).scroll(throttled); @@ -1002,19 +994,11 @@ var notes; var render = function () { return alert("rendering..."); }; var renderNotes = _.after(notes.length, render); _.each(notes, function (note) { return note.asyncSave({ success: renderNotes }); }); -var hello = function (name) { - return "hello: " + name; -}; -hello = _.wrap(hello, function (func, arg) { - return "before, " + func(arg) + ", after"; -}); +var hello = function (name) { return "hello: " + name; }; +hello = _.wrap(hello, function (func, arg) { return "before, " + func(arg) + ", after"; }); hello("moe"); -var greet = function (name) { - return "hi: " + name; -}; -var exclaim = function (statement) { - return statement + "!"; -}; +var greet = function (name) { return "hi: " + name; }; +var exclaim = function (statement) { return statement + "!"; }; var welcome = _.compose(exclaim, greet); welcome('moe'); /////////////////////////////////////////////////////////////////////////////////////// @@ -1029,11 +1013,7 @@ _.omit({ name: 'moe', age: 50, userid: 'moe1' }, 'userid'); var iceCream = { flavor: "chocolate" }; _.defaults(iceCream, { flavor: "vanilla", sprinkles: "lots" }); _.clone({ name: 'moe' }); -_.chain([1, 2, 3, 200]).filter(function (num) { - return num % 2 == 0; -}).tap(alert).map(function (num) { - return num * num; -}).value(); +_.chain([1, 2, 3, 200]).filter(function (num) { return num % 2 == 0; }).tap(alert).map(function (num) { return num * num; }).value(); _.has({ a: 1, b: 2, c: 3 }, "b"); var moe = { name: 'moe', luckyNumbers: [13, 27, 34] }; var clone = { name: 'moe', luckyNumbers: [13, 27, 34] }; @@ -1042,9 +1022,7 @@ _.isEqual(moe, clone); _.isEmpty([1, 2, 3]); _.isEmpty({}); _.isElement($('body')[0]); -(function () { - return _.isArray(arguments); -})(); +(function () { return _.isArray(arguments); })(); _.isArray([1, 2, 3]); _.isObject({}); _.isObject(1); @@ -1069,9 +1047,7 @@ var underscore = _.noConflict(); var moe2 = { name: 'moe' }; moe2 === _.identity(moe); var genie; -_.times(3, function (n) { - genie.grantWishNumber(n); -}); +_.times(3, function (n) { genie.grantWishNumber(n); }); _.random(0, 100); _.mixin({ capitalize: function (string) { @@ -1081,9 +1057,7 @@ _.mixin({ _("fabio").capitalize(); _.uniqueId('contact_'); _.escape('Curly, Larry & Moe'); -var object = { cheese: 'crumpets', stuff: function () { - return 'nonsense'; -} }; +var object = { cheese: 'crumpets', stuff: function () { return 'nonsense'; } }; _.result(object, 'cheese'); _.result(object, 'stuff'); var compiled = _.template("hello: <%= name %>"); diff --git a/tests/baselines/reference/unexpectedStatementBlockTerminator.js b/tests/baselines/reference/unexpectedStatementBlockTerminator.js index c4bf2c51aee..87b4652375a 100644 --- a/tests/baselines/reference/unexpectedStatementBlockTerminator.js +++ b/tests/baselines/reference/unexpectedStatementBlockTerminator.js @@ -18,6 +18,4 @@ var Bar = (function () { } return Bar; })(); -function Goo() { - return { a: 1, b: 2 }; -} +function Goo() { return { a: 1, b: 2 }; } diff --git a/tests/baselines/reference/unknownSymbols2.js b/tests/baselines/reference/unknownSymbols2.js index ba1b92ef71c..b158f5c9503 100644 --- a/tests/baselines/reference/unknownSymbols2.js +++ b/tests/baselines/reference/unknownSymbols2.js @@ -51,9 +51,7 @@ var M; break; } var a = function () { return asdf; }; - var b = function (asdf) { - return qwerty; - }; + var b = function (asdf) { return qwerty; }; var N; (function (N) { var x = 1; diff --git a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js index 9ff4a5c469a..9e0ff95536d 100644 --- a/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js +++ b/tests/baselines/reference/untypedFunctionCallsWithTypeParameters1.js @@ -51,9 +51,7 @@ var __extends = this.__extends || function (d, b) { d.prototype = new __(); }; // none of these function calls should be allowed -var x = function () { - return; -}; +var x = function () { return; }; var r1 = x(); var y = x; var r2 = y(); diff --git a/tests/baselines/reference/validMultipleVariableDeclarations.js b/tests/baselines/reference/validMultipleVariableDeclarations.js index 5c65d388711..16c47ce8ee2 100644 --- a/tests/baselines/reference/validMultipleVariableDeclarations.js +++ b/tests/baselines/reference/validMultipleVariableDeclarations.js @@ -59,9 +59,7 @@ var p = { x: 1, y: undefined }; var p = { x: 1, y: 2 }; var p = { x: 0, y: undefined }; var p; -var fn = function (s) { - return 42; -}; +var fn = function (s) { return 42; }; var fn = function (s) { return 3; }; var fn; var fn; diff --git a/tests/baselines/reference/voidFunctionAssignmentCompat.js b/tests/baselines/reference/voidFunctionAssignmentCompat.js index 42e0f99ec31..0b7c4b60d89 100644 --- a/tests/baselines/reference/voidFunctionAssignmentCompat.js +++ b/tests/baselines/reference/voidFunctionAssignmentCompat.js @@ -20,39 +20,15 @@ var frv3: (v:any)=>number = (function() { return function () { return 0; } })() //// [voidFunctionAssignmentCompat.js] -var fa = function () { - return 3; -}; +var fa = function () { return 3; }; fa = function () { }; // should not work var fv = function () { }; -fv = function () { - return 0; -}; // should work -function execAny(callback) { - return callback(0); -} +fv = function () { return 0; }; // should work +function execAny(callback) { return callback(0); } execAny(function () { }); // should work -function execVoid(callback) { - callback(0); -} -execVoid(function () { - return 0; -}); // should work -var fra = function () { - return function () { }; -}; // should work -var frv = function () { - return function () { - return 0; - }; -}; // should work -var fra3 = (function () { - return function (v) { - return v; - }; -})(); // should work -var frv3 = (function () { - return function () { - return 0; - }; -})(); // should work +function execVoid(callback) { callback(0); } +execVoid(function () { return 0; }); // should work +var fra = function () { return function () { }; }; // should work +var frv = function () { return function () { return 0; }; }; // should work +var fra3 = (function () { return function (v) { return v; }; })(); // should work +var frv3 = (function () { return function () { return 0; }; })(); // should work diff --git a/tests/baselines/reference/voidOperatorWithBooleanType.js b/tests/baselines/reference/voidOperatorWithBooleanType.js index 64c09e2ea65..69c609c1280 100644 --- a/tests/baselines/reference/voidOperatorWithBooleanType.js +++ b/tests/baselines/reference/voidOperatorWithBooleanType.js @@ -41,15 +41,11 @@ void M.n; //// [voidOperatorWithBooleanType.js] // void operator on boolean type var BOOLEAN; -function foo() { - return true; -} +function foo() { return true; } var A = (function () { function A() { } - A.foo = function () { - return false; - }; + A.foo = function () { return false; }; return A; })(); var M; diff --git a/tests/baselines/reference/voidOperatorWithNumberType.js b/tests/baselines/reference/voidOperatorWithNumberType.js index e37e5a82577..2426690489d 100644 --- a/tests/baselines/reference/voidOperatorWithNumberType.js +++ b/tests/baselines/reference/voidOperatorWithNumberType.js @@ -49,15 +49,11 @@ void objA.a, M.n; // void operator on number type var NUMBER; var NUMBER1 = [1, 2]; -function foo() { - return 1; -} +function foo() { return 1; } var A = (function () { function A() { } - A.foo = function () { - return 1; - }; + A.foo = function () { return 1; }; return A; })(); var M; @@ -71,9 +67,7 @@ var ResultIsAny2 = void NUMBER1; // number type literal var ResultIsAny3 = void 1; var ResultIsAny4 = void { x: 1, y: 2 }; -var ResultIsAny5 = void { x: 1, y: function (n) { - return n; -} }; +var ResultIsAny5 = void { x: 1, y: function (n) { return n; } }; // number type expressions var ResultIsAny6 = void objA.a; var ResultIsAny7 = void M.n; diff --git a/tests/baselines/reference/voidOperatorWithStringType.js b/tests/baselines/reference/voidOperatorWithStringType.js index 7954f50bf57..9f30d1fcb0c 100644 --- a/tests/baselines/reference/voidOperatorWithStringType.js +++ b/tests/baselines/reference/voidOperatorWithStringType.js @@ -48,15 +48,11 @@ void objA.a,M.n; // void operator on string type var STRING; var STRING1 = ["", "abc"]; -function foo() { - return "abc"; -} +function foo() { return "abc"; } var A = (function () { function A() { } - A.foo = function () { - return ""; - }; + A.foo = function () { return ""; }; return A; })(); var M; @@ -70,9 +66,7 @@ var ResultIsAny2 = void STRING1; // string type literal var ResultIsAny3 = void ""; var ResultIsAny4 = void { x: "", y: "" }; -var ResultIsAny5 = void { x: "", y: function (s) { - return s; -} }; +var ResultIsAny5 = void { x: "", y: function (s) { return s; } }; // string type expressions var ResultIsAny6 = void objA.a; var ResultIsAny7 = void M.n; diff --git a/tests/baselines/reference/witness.js b/tests/baselines/reference/witness.js index 607c2415044..82a1298f156 100644 --- a/tests/baselines/reference/witness.js +++ b/tests/baselines/reference/witness.js @@ -210,9 +210,7 @@ function fnArg1(x, y) { var x; fnArg1(fnArg1, 0); } -function overload1() { - return undefined; -} +function overload1() { return undefined; } ; function fnArg2() { return overload1(fnArg2); From f44144a77cb664024ae799ef90fc4486bfbbdfb6 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 6 Feb 2015 20:16:35 -0800 Subject: [PATCH 009/162] Preserve newlines appropriately between elements of an object literal or array literal when emitting. --- src/compiler/emitter.ts | 93 ++++++++++++++----- .../baselines/reference/APISample_compile.js | 6 +- .../reference/YieldExpression10_es6.js | 5 +- tests/baselines/reference/classExpression.js | 4 +- .../contextualTypeWithUnionTypeMembers.js | 69 +++++++------- tests/baselines/reference/enumBasics.js | 16 +--- .../reference/genericsManyTypeParameters.js | 19 +++- .../reference/nestedClassDeclaration.js | 3 +- .../reference/objectLiteralWithSemicolons4.js | 3 +- .../objectTypesWithOptionalProperties2.js | 3 +- ...serErrorRecoveryArrayLiteralExpression1.js | 3 +- ...serErrorRecoveryArrayLiteralExpression2.js | 3 +- .../parserErrorRecovery_ObjectLiteral2.js | 3 +- .../parserErrorRecovery_ObjectLiteral3.js | 3 +- .../parserErrorRecovery_ObjectLiteral4.js | 3 +- .../parserErrorRecovery_ObjectLiteral5.js | 3 +- tests/baselines/reference/parserharness.js | 4 +- tests/baselines/reference/privateIndexer2.js | 3 +- tests/baselines/reference/targetTypeTest1.js | 9 +- .../templateStringInObjectLiteral.js | 3 +- .../templateStringInObjectLiteralES6.js | 3 +- ...eAnnotationBestCommonTypeInArrayLiteral.js | 3 +- ...CheckingInsideFunctionExpressionInArray.js | 10 +- ...ndefinedSymbolReferencedInArrayLiteral1.js | 6 +- .../wrappedAndRecursiveConstraints3.js | 4 +- .../wrappedAndRecursiveConstraints4.js | 4 +- 26 files changed, 168 insertions(+), 120 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index f2b40f589f5..d84bb5fb03b 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1742,8 +1742,8 @@ module ts { lastRecordedSourceMapSpan.emittedLine != emittedLine || lastRecordedSourceMapSpan.emittedColumn != emittedColumn || (lastRecordedSourceMapSpan.sourceIndex === sourceMapSourceIndex && - (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || - (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { + (lastRecordedSourceMapSpan.sourceLine > sourceLinePos.line || + (lastRecordedSourceMapSpan.sourceLine === sourceLinePos.line && lastRecordedSourceMapSpan.sourceColumn > sourceLinePos.character)))) { // Encode the last recordedSpan before assigning new encodeLastRecordedSourceMapSpan(); @@ -1994,7 +1994,7 @@ module ts { break; } // _a .. _h, _j ... _z, _0, _1, ... - name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0: 1) + CharacterCodes.a) : tempCount - 25); + name = "_" + (tempCount < 25 ? String.fromCharCode(tempCount + (tempCount < 8 ? 0 : 1) + CharacterCodes.a) : tempCount - 25); tempCount++; } var result = createNode(SyntaxKind.Identifier); @@ -2057,6 +2057,49 @@ module ts { } } + function emitLinePreservingList(parent: Node, nodes: NodeArray, allowTrailingComma: boolean, spacesBetweenBraces: boolean) { + Debug.assert(nodes.length > 0); + increaseIndent(); + if (nodeStartPositionsAreOnSameLine(parent, nodes[0])) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + + for (var i = 0, n = nodes.length; i < n; i++) { + if (i) { + if (nodeEndIsOnSameLineAsNodeStart(nodes[i - 1], nodes[i])) { + write(", "); + } + else { + write(","); + writeLine(); + } + } + + emit(nodes[i]); + } + + var closeTokenIsOnSameLineAsLastElement = nodeEndPositionsAreOnSameLine(parent, lastOrUndefined(nodes)); + + if (nodes.hasTrailingComma && allowTrailingComma) { + write(","); + } + + decreaseIndent(); + if (closeTokenIsOnSameLineAsLastElement) { + if (spacesBetweenBraces) { + write(" "); + } + } + else { + writeLine(); + } + } + function emitList(nodes: Node[], start: number, count: number, multiLine: boolean, trailingComma: boolean) { if (multiLine) { increaseIndent(); @@ -2122,7 +2165,7 @@ module ts { function emitLiteral(node: LiteralExpression) { var text = languageVersion < ScriptTarget.ES6 && isTemplateLiteralKind(node.kind) ? getTemplateLiteralAsStringLiteral(node) : node.parent ? getSourceTextOfNodeFromSourceFile(currentSourceFile, node) : - node.text; + node.text; if (compilerOptions.sourceMap && (node.kind === SyntaxKind.StringLiteral || isTemplateLiteralKind(node.kind))) { writer.writeLiteral(text); } @@ -2423,6 +2466,10 @@ module ts { return true; } + function isSpreadElementExpression(node: Node) { + return node.kind === SyntaxKind.SpreadElementExpression; + } + function emitArrayLiteral(node: ArrayLiteralExpression) { var elements = node.elements; var length = elements.length; @@ -2430,13 +2477,14 @@ module ts { write("[]"); return; } - if (languageVersion >= ScriptTarget.ES6) { + + if (languageVersion >= ScriptTarget.ES6 || !forEach(elements, isSpreadElementExpression)) { write("["); - emitList(elements, 0, elements.length, /*multiLine*/(node.flags & NodeFlags.MultiLine) !== 0, - /*trailingComma*/ elements.hasTrailingComma); + emitLinePreservingList(node, elements, /*allowTrailingComma:*/ true, /*spacesBetweenBraces:*/ false); write("]"); return; } + var pos = 0; var group = 0; while (pos < length) { @@ -2459,7 +2507,7 @@ module ts { i++; } write("["); - emitList(elements, pos, i - pos, /*multiLine*/ (node.flags & NodeFlags.MultiLine) !== 0, + emitList(elements, pos, i - pos, /*multiLine*/(node.flags & NodeFlags.MultiLine) !== 0, /*trailingComma*/ elements.hasTrailingComma); write("]"); pos = i; @@ -2475,15 +2523,7 @@ module ts { write("{"); var properties = node.properties; if (properties.length) { - var multiLine = (node.flags & NodeFlags.MultiLine) !== 0; - if (!multiLine) { - write(" "); - } - emitList(properties, 0, properties.length, /*multiLine*/ multiLine, - /*trailingComma*/ properties.hasTrailingComma && languageVersion >= ScriptTarget.ES5); - if (!multiLine) { - write(" "); - } + emitLinePreservingList(node, properties, /*allowTrailingComma:*/ languageVersion >= ScriptTarget.ES5, /*spacesBetweenBraces:*/ true); } write("}"); } @@ -2713,7 +2753,7 @@ module ts { emit(node.whenFalse); } - function isSingleLineBlock(node: Node) { + function isSingleLineEmptyBlock(node: Node) { if (node && node.kind === SyntaxKind.Block) { var block = node; return block.statements.length === 0 && nodeEndIsOnSameLineAsNodeStart(block, block); @@ -2721,7 +2761,7 @@ module ts { } function emitBlock(node: Block) { - if (isSingleLineBlock(node)) { + if (isSingleLineEmptyBlock(node)) { emitToken(SyntaxKind.OpenBraceToken, node.pos); write(" "); emitToken(SyntaxKind.CloseBraceToken, node.statements.end); @@ -2895,9 +2935,14 @@ module ts { emitToken(SyntaxKind.CloseBraceToken, node.clauses.end); } - function isOnSameLine(node1: Node, node2: Node) { + function nodeStartPositionsAreOnSameLine(node1: Node, node2: Node) { return getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node1.pos)) === - getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); + getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); + } + + function nodeEndPositionsAreOnSameLine(node1: Node, node2: Node) { + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, node2.end); } function nodeEndIsOnSameLineAsNodeStart(node1: Node, node2: Node) { @@ -2914,7 +2959,7 @@ module ts { else { write("default:"); } - if (node.statements.length === 1 && isOnSameLine(node, node.statements[0])) { + if (node.statements.length === 1 && nodeStartPositionsAreOnSameLine(node, node.statements[0])) { write(" "); emit(node.statements[0]); } @@ -3404,7 +3449,7 @@ module ts { emitSignatureParameters(node); } - if (isSingleLineBlock(node.body) || !node.body) { + if (isSingleLineEmptyBlock(node.body) || !node.body) { write(" { }"); } else if (node.body.kind === SyntaxKind.Block) { @@ -3449,7 +3494,7 @@ module ts { // If we didn't have to emit any preamble code, then attempt to keep the arrow // function on one line. - if (!preambleEmitted && isOnSameLine(node, body)) { + if (!preambleEmitted && nodeStartPositionsAreOnSameLine(node, body)) { write(" "); emitStart(body); write("return "); diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 6840f079972..a543806f5a8 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -1930,8 +1930,6 @@ function compile(fileNames, options) { } exports.compile = compile; compile(process.argv.slice(2), { - noEmitOnError: true, - noImplicitAny: true, - target: 1 /* ES5 */, - module: 1 /* CommonJS */ + noEmitOnError: true, noImplicitAny: true, + target: 1 /* ES5 */, module: 1 /* CommonJS */ }); diff --git a/tests/baselines/reference/YieldExpression10_es6.js b/tests/baselines/reference/YieldExpression10_es6.js index f111e6e1bdf..3bae1b645fe 100644 --- a/tests/baselines/reference/YieldExpression10_es6.js +++ b/tests/baselines/reference/YieldExpression10_es6.js @@ -7,5 +7,6 @@ var v = { * foo() { //// [YieldExpression10_es6.js] var v = { foo: function () { - ; -} }; + ; + } +}; diff --git a/tests/baselines/reference/classExpression.js b/tests/baselines/reference/classExpression.js index 9d902abbf52..6bcf0f46f74 100644 --- a/tests/baselines/reference/classExpression.js +++ b/tests/baselines/reference/classExpression.js @@ -20,9 +20,7 @@ var C = (function () { return C; })(); var y = { - foo: , - class: C2 -}, _a = void 0; + foo: , class: C2 }, _a = void 0; var M; (function (M) { var z = ; diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js index b04c804ad7e..10672d86796 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js +++ b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js @@ -150,26 +150,27 @@ var i1Ori2 = { propertyOnlyInI2: "Hello" }; var arrayI1OrI2 = [i1, i2, { - commonPropertyType: "hello", - commonMethodType: function (a) { return a; }, - commonMethodWithTypeParameter: function (a) { return a; }, - methodOnlyInI1: function (a) { return a; }, - propertyOnlyInI1: "Hello" -}, { - commonPropertyType: "hello", - commonMethodType: function (a) { return a; }, - commonMethodWithTypeParameter: function (a) { return a; }, - methodOnlyInI2: function (a) { return a; }, - propertyOnlyInI2: "Hello" -}, { - commonPropertyType: "hello", - commonMethodType: function (a) { return a; }, - commonMethodWithTypeParameter: function (a) { return a; }, - methodOnlyInI1: function (a) { return a; }, - propertyOnlyInI1: "Hello", - methodOnlyInI2: function (a) { return a; }, - propertyOnlyInI2: "Hello" -}]; + commonPropertyType: "hello", + commonMethodType: function (a) { return a; }, + commonMethodWithTypeParameter: function (a) { return a; }, + methodOnlyInI1: function (a) { return a; }, + propertyOnlyInI1: "Hello" + }, + { + commonPropertyType: "hello", + commonMethodType: function (a) { return a; }, + commonMethodWithTypeParameter: function (a) { return a; }, + methodOnlyInI2: function (a) { return a; }, + propertyOnlyInI2: "Hello" + }, { + commonPropertyType: "hello", + commonMethodType: function (a) { return a; }, + commonMethodWithTypeParameter: function (a) { return a; }, + methodOnlyInI1: function (a) { return a; }, + propertyOnlyInI1: "Hello", + methodOnlyInI2: function (a) { return a; }, + propertyOnlyInI2: "Hello" + }]; var i11; var i21; var i11Ori21 = i11; @@ -191,17 +192,17 @@ var i11Ori21 = { commonPropertyDifferentType: 10 }; var arrayOrI11OrI21 = [i11, i21, i11 || i21, { - // Like i1 - commonMethodDifferentReturnType: function (a, b) { - var z = a.charAt(b); - return z; - }, - commonPropertyDifferentType: "hello" -}, { - // Like i2 - commonMethodDifferentReturnType: function (a, b) { - var z = a.charCodeAt(b); - return z; - }, - commonPropertyDifferentType: 10 -}]; + // Like i1 + commonMethodDifferentReturnType: function (a, b) { + var z = a.charAt(b); + return z; + }, + commonPropertyDifferentType: "hello" + }, { + // Like i2 + commonMethodDifferentReturnType: function (a, b) { + var z = a.charCodeAt(b); + return z; + }, + commonPropertyDifferentType: 10 + }]; diff --git a/tests/baselines/reference/enumBasics.js b/tests/baselines/reference/enumBasics.js index 6f1a039ca6e..eca92215fb6 100644 --- a/tests/baselines/reference/enumBasics.js +++ b/tests/baselines/reference/enumBasics.js @@ -150,21 +150,9 @@ var E9; // (refer to .js to validate) // Enum constant members are propagated var doNotPropagate = [ - E8.B, - E7.A, - E4.Z, - E3.X, - E3.Y, - E3.Z + E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z ]; // Enum computed members are not propagated var doPropagate = [ - 0 /* A */, - E9.B, - 0 /* B */, - 1 /* C */, - 0 /* A */, - 0 /* A */, - 3 /* B */, - 4 /* C */ + 0 /* A */, E9.B, 0 /* B */, 1 /* C */, 0 /* A */, 0 /* A */, 3 /* B */, 4 /* C */ ]; diff --git a/tests/baselines/reference/genericsManyTypeParameters.js b/tests/baselines/reference/genericsManyTypeParameters.js index 19a5117cb6b..491f0c41168 100644 --- a/tests/baselines/reference/genericsManyTypeParameters.js +++ b/tests/baselines/reference/genericsManyTypeParameters.js @@ -61,5 +61,22 @@ function Foo< //// [genericsManyTypeParameters.js] function Foo(x1, y1, z1, a1, b1, c1, x2, y2, z2, a2, b2, c2, x3, y3, z3, a3, b3, c3, x4, y4, z4, a4, b4, c4, x5, y5, z5, a5, b5, c5, x6, y6, z6, a6, b6, c6, x7, y7, z7, a7, b7, c7, x8, y8, z8, a8, b8, c8, x9, y9, z9, a9, b9, c9, x10, y12, z10, a10, b10, c10, x11, y13, z11, a11, b11, c11, x12, y14, z12, a12, b12, c12, x13, y15, z13, a13, b13, c13, x14, y16, z14, a14, b14, c14, x15, y17, z15, a15, b15, c15, x16, y18, z16, a16, b16, c16, x17, y19, z17, a17, b17, c17, x18, y10, z18, a18, b18, c18) { - return [x1, y1, z1, a1, b1, c1, x2, y2, z2, a2, b2, c2, x3, y3, z3, a3, b3, c3, x4, y4, z4, a4, b4, c4, x5, y5, z5, a5, b5, c5, x6, y6, z6, a6, b6, c6, x7, y7, z7, a7, b7, c7, x8, y8, z8, a8, b8, c8, x9, y9, z9, a9, b9, c9, x10, y12, z10, a10, b10, c10, x11, y13, z11, a11, b11, c11, x12, y14, z12, a12, b12, c12, x13, y15, z13, a13, b13, c13, x14, y16, z14, a14, b14, c14, x15, y17, z15, a15, b15, c15, x16, y18, z16, a16, b16, c16, x17, y19, z17, a17, b17, c17, x18, y10, z18, a18, b18, c18]; + return [x1, y1, z1, a1, b1, c1, + x2, y2, z2, a2, b2, c2, + x3, y3, z3, a3, b3, c3, + x4, y4, z4, a4, b4, c4, + x5, y5, z5, a5, b5, c5, + x6, y6, z6, a6, b6, c6, + x7, y7, z7, a7, b7, c7, + x8, y8, z8, a8, b8, c8, + x9, y9, z9, a9, b9, c9, + x10, y12, z10, a10, b10, c10, + x11, y13, z11, a11, b11, c11, + x12, y14, z12, a12, b12, c12, + x13, y15, z13, a13, b13, c13, + x14, y16, z14, a14, b14, c14, + x15, y17, z15, a15, b15, c15, + x16, y18, z16, a16, b16, c16, + x17, y19, z17, a17, b17, c17, + x18, y10, z18, a18, b18, c18]; } diff --git a/tests/baselines/reference/nestedClassDeclaration.js b/tests/baselines/reference/nestedClassDeclaration.js index fa69ef5950e..70445b3372f 100644 --- a/tests/baselines/reference/nestedClassDeclaration.js +++ b/tests/baselines/reference/nestedClassDeclaration.js @@ -37,5 +37,4 @@ var C3 = (function () { return C3; })(); var x = { - class: C4 -}, _a = void 0; + class: C4 }, _a = void 0; diff --git a/tests/baselines/reference/objectLiteralWithSemicolons4.js b/tests/baselines/reference/objectLiteralWithSemicolons4.js index 9e1e3dea4b9..a01d52548ee 100644 --- a/tests/baselines/reference/objectLiteralWithSemicolons4.js +++ b/tests/baselines/reference/objectLiteralWithSemicolons4.js @@ -5,5 +5,4 @@ var v = { //// [objectLiteralWithSemicolons4.js] var v = { - a: -}; + a: }; diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties2.js b/tests/baselines/reference/objectTypesWithOptionalProperties2.js index 7a237223d7c..cf0d113c244 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties2.js +++ b/tests/baselines/reference/objectTypesWithOptionalProperties2.js @@ -42,6 +42,5 @@ var C2 = (function () { return C2; })(); var b = { - x: function () { }, - 1: // error + x: function () { }, 1: // error }; diff --git a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js index 1ed36d8dac5..c33dbc2a626 100644 --- a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js +++ b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js @@ -3,4 +3,5 @@ var v = [1, 2, 3 4, 5, 6, 7]; //// [parserErrorRecoveryArrayLiteralExpression1.js] -var v = [1, 2, 3, 4, 5, 6, 7]; +var v = [1, 2, 3, + 4, 5, 6, 7]; diff --git a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js index c5386a2b6a2..0bfe59964db 100644 --- a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js +++ b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js @@ -5,4 +5,5 @@ var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0 //// [parserErrorRecoveryArrayLiteralExpression2.js] -var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0, .7042760848999023, 1.1955541372299194, 0.19600726664066315, -0.7120069861412048]; +var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0, + .7042760848999023, 1.1955541372299194, 0.19600726664066315, -0.7120069861412048]; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js index 08dc96d38ef..6a703759fff 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js @@ -3,4 +3,5 @@ var v = { a return; //// [parserErrorRecovery_ObjectLiteral2.js] -var v = { a: , return: }; +var v = { a: , + return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js index 1ea23d59112..eecf45fea4f 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js @@ -3,4 +3,5 @@ var v = { a: return; //// [parserErrorRecovery_ObjectLiteral3.js] -var v = { a: , return: }; +var v = { a: , + return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js index 4fe49788740..87a1a31437e 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js @@ -3,4 +3,5 @@ var v = { a: 1 return; //// [parserErrorRecovery_ObjectLiteral4.js] -var v = { a: 1, return: }; +var v = { a: 1, + return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js index cf55b59c711..97e618946a0 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js @@ -3,4 +3,5 @@ var v = { a: 1, return; //// [parserErrorRecovery_ObjectLiteral5.js] -var v = { a: 1, return: }; +var v = { a: 1, + return: }; diff --git a/tests/baselines/reference/parserharness.js b/tests/baselines/reference/parserharness.js index 64e8b13ab9d..02304380013 100644 --- a/tests/baselines/reference/parserharness.js +++ b/tests/baselines/reference/parserharness.js @@ -2627,9 +2627,7 @@ var Harness; var description = b.description + (prop ? ": " + prop : ''); emitLog('testStart', { desc: description }); emitLog('pass', { - desc: description, - pass: true, - perfResults: { + desc: description, pass: true, perfResults: { mean: b.results[prop].mean(), min: b.results[prop].min(), max: b.results[prop].max(), diff --git a/tests/baselines/reference/privateIndexer2.js b/tests/baselines/reference/privateIndexer2.js index 13849216ca0..2db63d1cd98 100644 --- a/tests/baselines/reference/privateIndexer2.js +++ b/tests/baselines/reference/privateIndexer2.js @@ -12,7 +12,6 @@ var y: { //// [privateIndexer2.js] // private indexers not allowed var x = { - [x]: string, - string: + [x]: string, string: }; var y; diff --git a/tests/baselines/reference/targetTypeTest1.js b/tests/baselines/reference/targetTypeTest1.js index 1507fcf2a1b..5b3230439e6 100644 --- a/tests/baselines/reference/targetTypeTest1.js +++ b/tests/baselines/reference/targetTypeTest1.js @@ -108,6 +108,9 @@ function C(a, b) { this.a = a; this.b = b; } -C.prototype = { a: 0, b: 0, C1M1: function (c, d) { - return (this.a + c) + (this.b + d); -} }; +C.prototype = { a: 0, + b: 0, + C1M1: function (c, d) { + return (this.a + c) + (this.b + d); + } +}; diff --git a/tests/baselines/reference/templateStringInObjectLiteral.js b/tests/baselines/reference/templateStringInObjectLiteral.js index b026aedf4d3..6df5a64d78a 100644 --- a/tests/baselines/reference/templateStringInObjectLiteral.js +++ b/tests/baselines/reference/templateStringInObjectLiteral.js @@ -6,6 +6,5 @@ var x = { //// [templateStringInObjectLiteral.js] var x = { - a: "abc" + 123 + "def" -} "b"; + a: "abc" + 123 + "def" } "b"; 321; diff --git a/tests/baselines/reference/templateStringInObjectLiteralES6.js b/tests/baselines/reference/templateStringInObjectLiteralES6.js index 22144e75247..7de012185a9 100644 --- a/tests/baselines/reference/templateStringInObjectLiteralES6.js +++ b/tests/baselines/reference/templateStringInObjectLiteralES6.js @@ -6,6 +6,5 @@ var x = { //// [templateStringInObjectLiteralES6.js] var x = { - a: `abc${123}def`, -} `b`; + a: `abc${123}def`, } `b`; 321; diff --git a/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js b/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js index be252fe345b..cf5ddb23ccd 100644 --- a/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js +++ b/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js @@ -29,8 +29,7 @@ var menuData = [ "type": "image", "link": "", "icon": "modules/menu/logo.svg" - }, - { + }, { "id": "productName", "type": "default", "link": "", diff --git a/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js b/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js index 9d387d850a7..9dad9fb671f 100644 --- a/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js +++ b/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js @@ -9,8 +9,8 @@ var functions = [function () { //// [typeCheckingInsideFunctionExpressionInArray.js] var functions = [function () { - var k = 10; - k = new Object(); - [1, 2, 3].NonexistantMethod(); - derp(); -}]; + var k = 10; + k = new Object(); + [1, 2, 3].NonexistantMethod(); + derp(); + }]; diff --git a/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js b/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js index 94211010677..f314f9ad111 100644 --- a/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js +++ b/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js @@ -11,6 +11,6 @@ var functions = [function() { //// [undefinedSymbolReferencedInArrayLiteral1.js] var tokens = [{ startIndex: deltaOffset }]; var functions = [function () { - [1, 2, 3].NonexistantMethod(); - anotherNonExistingMethod(); -}]; + [1, 2, 3].NonexistantMethod(); + anotherNonExistingMethod(); + }]; diff --git a/tests/baselines/reference/wrappedAndRecursiveConstraints3.js b/tests/baselines/reference/wrappedAndRecursiveConstraints3.js index 01f591de323..fb0f5388aaa 100644 --- a/tests/baselines/reference/wrappedAndRecursiveConstraints3.js +++ b/tests/baselines/reference/wrappedAndRecursiveConstraints3.js @@ -30,6 +30,6 @@ var C = (function () { })(); var c = new C({ length: 2 }); var r = c.foo({ length: 3, charAt: function (x) { - ''; -} }); + ''; + } }); var r2 = r(''); diff --git a/tests/baselines/reference/wrappedAndRecursiveConstraints4.js b/tests/baselines/reference/wrappedAndRecursiveConstraints4.js index da4117860a7..998c16a9f87 100644 --- a/tests/baselines/reference/wrappedAndRecursiveConstraints4.js +++ b/tests/baselines/reference/wrappedAndRecursiveConstraints4.js @@ -28,5 +28,5 @@ var C = (function () { var c = new C({ length: 2 }); var r = c.foo(''); var r2 = r({ length: 3, charAt: function (x) { - ''; -} }); // error + ''; + } }); // error From 11d75ef4ce1d341c9cc26eb96e8dca41ba70843d Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Mon, 26 Jan 2015 14:34:22 -0800 Subject: [PATCH 010/162] Allow Symbol indexer in ES6 --- src/compiler/checker.ts | 24 ++++++++++++------- .../diagnosticInformationMap.generated.ts | 3 ++- src/compiler/diagnosticMessages.json | 7 +++++- src/compiler/utilities.ts | 7 ++++++ .../reference/arraySigChecking.errors.txt | 4 ++-- ...eReferenceWithoutTypeArgument.d.errors.txt | 4 ++-- ...ypeReferenceWithoutTypeArgument.errors.txt | 4 ++-- ...peReferenceWithoutTypeArgument2.errors.txt | 4 ++-- ...peReferenceWithoutTypeArgument3.errors.txt | 4 ++-- .../reference/indexTypeCheck.errors.txt | 4 ++-- .../parserES5SymbolIndexer1.errors.txt | 12 ++++++++++ .../parserES5SymbolIndexer2.errors.txt | 12 ++++++++++ .../parserES5SymbolIndexer3.errors.txt | 12 ++++++++++ .../parserIndexSignature6.errors.txt | 4 ++-- .../parserIndexSignature8.errors.txt | 8 +++---- .../reference/parserSymbolIndexer1.js | 6 +++++ .../reference/parserSymbolIndexer1.types | 8 +++++++ .../reference/parserSymbolIndexer2.js | 11 +++++++++ .../reference/parserSymbolIndexer2.types | 8 +++++++ .../reference/parserSymbolIndexer3.errors.txt | 9 +++++++ .../reference/parserSymbolIndexer4.js | 7 ++++++ .../reference/parserSymbolIndexer4.types | 8 +++++++ .../reference/parserSymbolIndexer5.errors.txt | 21 ++++++++++++++++ .../Symbols/parserES5SymbolIndexer1.ts | 4 ++++ .../Symbols/parserES5SymbolIndexer2.ts | 4 ++++ .../Symbols/parserES5SymbolIndexer3.ts | 4 ++++ .../Symbols/parserSymbolIndexer1.ts | 4 ++++ .../Symbols/parserSymbolIndexer2.ts | 4 ++++ .../Symbols/parserSymbolIndexer3.ts | 4 ++++ .../Symbols/parserSymbolIndexer4.ts | 4 ++++ .../Symbols/parserSymbolIndexer5.ts | 4 ++++ 31 files changed, 195 insertions(+), 28 deletions(-) create mode 100644 tests/baselines/reference/parserES5SymbolIndexer1.errors.txt create mode 100644 tests/baselines/reference/parserES5SymbolIndexer2.errors.txt create mode 100644 tests/baselines/reference/parserES5SymbolIndexer3.errors.txt create mode 100644 tests/baselines/reference/parserSymbolIndexer1.js create mode 100644 tests/baselines/reference/parserSymbolIndexer1.types create mode 100644 tests/baselines/reference/parserSymbolIndexer2.js create mode 100644 tests/baselines/reference/parserSymbolIndexer2.types create mode 100644 tests/baselines/reference/parserSymbolIndexer3.errors.txt create mode 100644 tests/baselines/reference/parserSymbolIndexer4.js create mode 100644 tests/baselines/reference/parserSymbolIndexer4.types create mode 100644 tests/baselines/reference/parserSymbolIndexer5.errors.txt create mode 100644 tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7c43b8bb233..56f5ec09001 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10472,25 +10472,33 @@ module ts { return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_exactly_one_parameter); } } - else if (parameter.dotDotDotToken) { + if (parameter.dotDotDotToken) { return grammarErrorOnNode(parameter.dotDotDotToken, Diagnostics.An_index_signature_cannot_have_a_rest_parameter); } - else if (parameter.flags & NodeFlags.Modifier) { + if (parameter.flags & NodeFlags.Modifier) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_accessibility_modifier); } - else if (parameter.questionToken) { + if (parameter.questionToken) { return grammarErrorOnNode(parameter.questionToken, Diagnostics.An_index_signature_parameter_cannot_have_a_question_mark); } - else if (parameter.initializer) { + if (parameter.initializer) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_cannot_have_an_initializer); } - else if (!parameter.type) { + if (!parameter.type) { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } - else if (parameter.type.kind !== SyntaxKind.StringKeyword && parameter.type.kind !== SyntaxKind.NumberKeyword) { - return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); + if (parameter.type.kind !== SyntaxKind.StringKeyword && parameter.type.kind !== SyntaxKind.NumberKeyword) { + if (isESSymbolTypeNode(parameter.type)) { + if (languageVersion < ScriptTarget.ES6) { + return grammarErrorOnNode(parameter.type, Diagnostics.Symbol_indexers_are_only_available_when_targeting_ECMAScript_6_and_higher); + } + // No error for parameter type + } + else { + return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_number_or_Symbol); + } } - else if (!node.type) { + if (!node.type) { return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_a_type_annotation); } } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 1188d346191..c6a7ad81334 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -19,7 +19,7 @@ module ts { An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an initializer." }, An_index_signature_must_have_a_type_annotation: { code: 1021, category: DiagnosticCategory.Error, key: "An index signature must have a type annotation." }, An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: DiagnosticCategory.Error, key: "An index signature parameter must have a type annotation." }, - An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: DiagnosticCategory.Error, key: "An index signature parameter type must be 'string' or 'number'." }, + An_index_signature_parameter_type_must_be_string_number_or_Symbol: { code: 1023, category: DiagnosticCategory.Error, key: "An index signature parameter type must be 'string', 'number', or 'Symbol'." }, A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: DiagnosticCategory.Error, key: "A class or interface declaration can only have one 'extends' clause." }, An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: DiagnosticCategory.Error, key: "An 'extends' clause must precede an 'implements' clause." }, A_class_can_only_extend_a_single_class: { code: 1026, category: DiagnosticCategory.Error, key: "A class can only extend a single class." }, @@ -147,6 +147,7 @@ module ts { Merge_conflict_marker_encountered: { code: 1185, category: DiagnosticCategory.Error, key: "Merge conflict marker encountered." }, A_rest_element_cannot_have_an_initializer: { code: 1186, category: DiagnosticCategory.Error, key: "A rest element cannot have an initializer." }, A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: DiagnosticCategory.Error, key: "A parameter property may not be a binding pattern." }, + Symbol_indexers_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1188, category: DiagnosticCategory.Error, key: "'Symbol' indexers are only available when targeting ECMAScript 6 and higher.", isEarly: true }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index b1a794716a4..0cf83d7b185 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -67,7 +67,7 @@ "category": "Error", "code": 1022 }, - "An index signature parameter type must be 'string' or 'number'.": { + "An index signature parameter type must be 'string', 'number', or 'Symbol'.": { "category": "Error", "code": 1023 }, @@ -579,6 +579,11 @@ "category": "Error", "code": 1187 }, + "'Symbol' indexers are only available when targeting ECMAScript 6 and higher.": { + "category": "Error", + "code": 1188, + "isEarly": true + }, "Duplicate identifier '{0}'.": { "category": "Error", diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 5a50e2799dc..8c3dd112b15 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -835,6 +835,13 @@ module ts { return SyntaxKind.FirstTriviaToken <= token && token <= SyntaxKind.LastTriviaToken; } + export function isESSymbolTypeNode(node: Node): boolean { + return node.kind === SyntaxKind.TypeReference && + (node).typeArguments === undefined && + (node).typeName.kind === SyntaxKind.Identifier && + ((node).typeName).text === "Symbol"; + } + export function isModifier(token: SyntaxKind): boolean { switch (token) { case SyntaxKind.PublicKeyword: diff --git a/tests/baselines/reference/arraySigChecking.errors.txt b/tests/baselines/reference/arraySigChecking.errors.txt index b70b659773c..82a32dbda4d 100644 --- a/tests/baselines/reference/arraySigChecking.errors.txt +++ b/tests/baselines/reference/arraySigChecking.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/arraySigChecking.ts(11,17): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/compiler/arraySigChecking.ts(11,17): error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. tests/cases/compiler/arraySigChecking.ts(18,5): error TS2322: Type 'void[]' is not assignable to type 'string[]'. Type 'void' is not assignable to type 'string'. tests/cases/compiler/arraySigChecking.ts(22,1): error TS2322: Type 'number[][]' is not assignable to type 'number[][][]'. @@ -20,7 +20,7 @@ tests/cases/compiler/arraySigChecking.ts(22,1): error TS2322: Type 'number[][]' var foo: { [index: any]; }; // expect an error here ~~~~~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. } interface myInt { diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt index 6c98d419dec..68543a10b01 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(10,21): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(11,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(11,26): error TS2314: Generic type 'C' requires 1 type argument(s). -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,19): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,19): error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,26): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(14,23): error TS2314: Generic type 'C' requires 1 type argument(s). @@ -36,7 +36,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc !!! error TS2314: Generic type 'C' requires 1 type argument(s). declare var d: { [x: C]: C }; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. ~ !!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt index d57f3c2fc0d..9076b86ff3e 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(10,13): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(11,14): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(11,18): error TS2314: Generic type 'C' requires 1 type argument(s). -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,11): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,11): error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,14): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,18): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(14,13): error TS2314: Generic type 'C' requires 1 type argument(s). @@ -46,7 +46,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc !!! error TS2314: Generic type 'C' requires 1 type argument(s). var d: { [x: C]: C }; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. ~ !!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt index 745da9aa106..ca79c04f6ed 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(10,13): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(11,14): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(11,18): error TS2314: Generic type 'I' requires 1 type argument(s). -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,11): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,11): error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,14): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,18): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(14,13): error TS2314: Generic type 'I' requires 1 type argument(s). @@ -46,7 +46,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc !!! error TS2314: Generic type 'I' requires 1 type argument(s). var d: { [x: I]: I }; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. ~ !!! error TS2314: Generic type 'I' requires 1 type argument(s). ~ diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt index 1fec52356a2..7154a90cb8a 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(10,21): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(11,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(11,26): error TS2314: Generic type 'C' requires 1 type argument(s). -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,19): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,19): error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,26): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(14,23): error TS2314: Generic type 'C' requires 1 type argument(s). @@ -36,7 +36,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc !!! error TS2314: Generic type 'C' requires 1 type argument(s). declare var d: { [x: C]: C }; ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. ~ !!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ diff --git a/tests/baselines/reference/indexTypeCheck.errors.txt b/tests/baselines/reference/indexTypeCheck.errors.txt index 03d0e2ce8ed..0914ea9ca7b 100644 --- a/tests/baselines/reference/indexTypeCheck.errors.txt +++ b/tests/baselines/reference/indexTypeCheck.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/indexTypeCheck.ts(17,2): error TS2413: Numeric index type ' tests/cases/compiler/indexTypeCheck.ts(22,2): error TS2413: Numeric index type 'Orange' is not assignable to string index type 'Yellow'. tests/cases/compiler/indexTypeCheck.ts(27,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'. tests/cases/compiler/indexTypeCheck.ts(32,3): error TS1096: An index signature must have exactly one parameter. -tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. @@ -58,7 +58,7 @@ tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression interface Magenta { [p:Purple]; // error ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. } var yellow: Yellow; diff --git a/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt new file mode 100644 index 00000000000..8128f95d3b6 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts(2,9): error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts(2,9): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts (2 errors) ==== + interface I { + [s: Symbol]: string; + ~~~~~~ +!!! error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt new file mode 100644 index 00000000000..b1904d0fe53 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts(2,9): error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts(2,9): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts (2 errors) ==== + class C { + [s: Symbol]: string; + ~~~~~~ +!!! error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt new file mode 100644 index 00000000000..bc1bc64aeda --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts(2,9): error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts(2,9): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts (2 errors) ==== + var x: { + [s: Symbol]: string; + ~~~~~~ +!!! error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexSignature6.errors.txt b/tests/baselines/reference/parserIndexSignature6.errors.txt index db53f219832..eae5aae90c9 100644 --- a/tests/baselines/reference/parserIndexSignature6.errors.txt +++ b/tests/baselines/reference/parserIndexSignature6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature6.ts(2,4): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature6.ts(2,4): error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. ==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature6.ts (1 errors) ==== interface I { [a:boolean] ~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexSignature8.errors.txt b/tests/baselines/reference/parserIndexSignature8.errors.txt index 87369df1b76..859d373eca4 100644 --- a/tests/baselines/reference/parserIndexSignature8.errors.txt +++ b/tests/baselines/reference/parserIndexSignature8.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts(1,13): error TS1023: An index signature parameter type must be 'string' or 'number'. -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts(2,14): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts(1,13): error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts(2,14): error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. ==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts (2 errors) ==== var foo: { [index: any]; }; // expect an error here ~~~~~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. var foo2: { [index: RegExp]; }; // expect an error here ~~~~~ -!!! error TS1023: An index signature parameter type must be 'string' or 'number'. +!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer1.js b/tests/baselines/reference/parserSymbolIndexer1.js new file mode 100644 index 00000000000..4c99edda168 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer1.js @@ -0,0 +1,6 @@ +//// [parserSymbolIndexer1.ts] +interface I { + [s: Symbol]: string; +} + +//// [parserSymbolIndexer1.js] diff --git a/tests/baselines/reference/parserSymbolIndexer1.types b/tests/baselines/reference/parserSymbolIndexer1.types new file mode 100644 index 00000000000..86020c8cbdd --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer1.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts === +interface I { +>I : I + + [s: Symbol]: string; +>s : Symbol +>Symbol : Symbol +} diff --git a/tests/baselines/reference/parserSymbolIndexer2.js b/tests/baselines/reference/parserSymbolIndexer2.js new file mode 100644 index 00000000000..1acae44ae2a --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer2.js @@ -0,0 +1,11 @@ +//// [parserSymbolIndexer2.ts] +class C { + [s: Symbol]: string; +} + +//// [parserSymbolIndexer2.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolIndexer2.types b/tests/baselines/reference/parserSymbolIndexer2.types new file mode 100644 index 00000000000..ffa9ff96346 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer2.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts === +class C { +>C : C + + [s: Symbol]: string; +>s : Symbol +>Symbol : Symbol +} diff --git a/tests/baselines/reference/parserSymbolIndexer3.errors.txt b/tests/baselines/reference/parserSymbolIndexer3.errors.txt new file mode 100644 index 00000000000..f5066a09ee9 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer3.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts(2,5): error TS1145: Modifiers not permitted on index signature members. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts (1 errors) ==== + class C { + static [s: Symbol]: string; + ~~~~~~ +!!! error TS1145: Modifiers not permitted on index signature members. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer4.js b/tests/baselines/reference/parserSymbolIndexer4.js new file mode 100644 index 00000000000..607b1ada481 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer4.js @@ -0,0 +1,7 @@ +//// [parserSymbolIndexer4.ts] +var x: { + [s: Symbol]: string; +} + +//// [parserSymbolIndexer4.js] +var x; diff --git a/tests/baselines/reference/parserSymbolIndexer4.types b/tests/baselines/reference/parserSymbolIndexer4.types new file mode 100644 index 00000000000..0f632e5dc32 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer4.types @@ -0,0 +1,8 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts === +var x: { +>x : {} + + [s: Symbol]: string; +>s : Symbol +>Symbol : Symbol +} diff --git a/tests/baselines/reference/parserSymbolIndexer5.errors.txt b/tests/baselines/reference/parserSymbolIndexer5.errors.txt new file mode 100644 index 00000000000..611ad109a34 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer5.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,6): error TS2304: Cannot find name 's'. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,7): error TS1005: ']' expected. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,15): error TS1005: ',' expected. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,16): error TS1136: Property assignment expected. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(3,1): error TS1005: ':' expected. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts (5 errors) ==== + var x = { + [s: Symbol]: "" + ~ +!!! error TS2304: Cannot find name 's'. + ~ +!!! error TS1005: ']' expected. + ~ +!!! error TS1005: ',' expected. + ~ +!!! error TS1136: Property assignment expected. + } + ~ +!!! error TS1005: ':' expected. \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts new file mode 100644 index 00000000000..f90f804a615 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts @@ -0,0 +1,4 @@ +//@target: ES5 +interface I { + [s: Symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts new file mode 100644 index 00000000000..1f13320f5d1 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts @@ -0,0 +1,4 @@ +//@target: ES5 +class C { + [s: Symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts new file mode 100644 index 00000000000..1e3829f9e40 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts @@ -0,0 +1,4 @@ +//@target: ES5 +var x: { + [s: Symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts new file mode 100644 index 00000000000..668ebb496f4 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts @@ -0,0 +1,4 @@ +//@target: ES6 +interface I { + [s: Symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts new file mode 100644 index 00000000000..cf4ee50974e --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + [s: Symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts new file mode 100644 index 00000000000..f7f7154af35 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + static [s: Symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts new file mode 100644 index 00000000000..99e8112ce55 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var x: { + [s: Symbol]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts new file mode 100644 index 00000000000..8c468043a8f --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var x = { + [s: Symbol]: "" +} \ No newline at end of file From b30d8f39c23b08063c12e9b11a6e5577cc0b537a Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 27 Jan 2015 16:07:01 -0800 Subject: [PATCH 011/162] Change computed property error messages to be about symbols --- src/compiler/checker.ts | 14 +++--- .../diagnosticInformationMap.generated.ts | 10 ++--- src/compiler/diagnosticMessages.json | 10 ++--- .../computedPropertyNames12.errors.txt | 44 +++++++++---------- .../computedPropertyNames35.errors.txt | 4 +- .../computedPropertyNames42.errors.txt | 4 +- ...edPropertyNamesDeclarationEmit3.errors.txt | 4 +- ...edPropertyNamesDeclarationEmit4.errors.txt | 4 +- ...omputedPropertyNamesOnOverloads.errors.txt | 8 ++-- tests/baselines/reference/giant.errors.txt | 32 +++++++------- ...SignatureMustHaveTypeAnnotation.errors.txt | 8 ++-- .../indexSignatureWithInitializer.errors.txt | 8 ++-- .../indexWithoutParamType2.errors.txt | 4 +- .../parserComputedPropertyName10.errors.txt | 4 +- .../parserComputedPropertyName11.errors.txt | 4 +- .../parserComputedPropertyName13.errors.txt | 4 +- .../parserComputedPropertyName14.errors.txt | 4 +- .../parserComputedPropertyName15.errors.txt | 4 +- .../parserComputedPropertyName18.errors.txt | 4 +- .../parserComputedPropertyName19.errors.txt | 4 +- .../parserComputedPropertyName20.errors.txt | 4 +- .../parserComputedPropertyName21.errors.txt | 4 +- .../parserComputedPropertyName22.errors.txt | 4 +- .../parserComputedPropertyName25.errors.txt | 4 +- .../parserComputedPropertyName28.errors.txt | 8 ++-- .../parserComputedPropertyName29.errors.txt | 8 ++-- .../parserComputedPropertyName31.errors.txt | 8 ++-- .../parserComputedPropertyName32.errors.txt | 4 +- .../parserComputedPropertyName36.errors.txt | 4 +- .../parserComputedPropertyName7.errors.txt | 4 +- .../parserComputedPropertyName8.errors.txt | 4 +- .../parserComputedPropertyName9.errors.txt | 4 +- .../parserES5ComputedPropertyName1.errors.txt | 4 +- ...parserES5ComputedPropertyName10.errors.txt | 4 +- ...parserES5ComputedPropertyName11.errors.txt | 4 +- .../parserES5ComputedPropertyName5.errors.txt | 4 +- .../parserES5ComputedPropertyName7.errors.txt | 4 +- .../parserES5ComputedPropertyName8.errors.txt | 4 +- .../parserES5ComputedPropertyName9.errors.txt | 4 +- .../parserIndexSignature11.errors.txt | 4 +- .../parserIndexSignature4.errors.txt | 4 +- .../parserIndexSignature5.errors.txt | 4 +- .../reference/propertyAssignment.errors.txt | 4 +- 43 files changed, 143 insertions(+), 143 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 56f5ec09001..70aa5187549 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10803,17 +10803,17 @@ module ts { // and accessors are not allowed in ambient contexts in general, // so this error only really matters for methods. if (isInAmbientContext(node)) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_an_ambient_context); + return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_Symbol); } else if (!node.body) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_method_overloads); + return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_Symbol); } } else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_interfaces); + return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_Symbol); } else if (node.parent.kind === SyntaxKind.TypeLiteral) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_type_literals); + return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_Symbol); } } @@ -11084,17 +11084,17 @@ module ts { function checkGrammarProperty(node: PropertyDeclaration) { if (node.parent.kind === SyntaxKind.ClassDeclaration) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, Diagnostics.A_class_member_cannot_be_declared_optional) || - checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_class_property_declarations)) { + checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_Symbol)) { return true; } } else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) { - if (checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_interfaces)) { + if (checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_Symbol)) { return true; } } else if (node.parent.kind === SyntaxKind.TypeLiteral) { - if (checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_type_literals)) { + if (checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_Symbol)) { return true; } } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index c6a7ad81334..6c89679a0a0 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -123,12 +123,12 @@ module ts { An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." }, yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration." }, Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." }, - Computed_property_names_are_not_allowed_in_an_ambient_context: { code: 1165, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in an ambient context." }, - Computed_property_names_are_not_allowed_in_class_property_declarations: { code: 1166, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in class property declarations." }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_Symbol: { code: 1165, category: DiagnosticCategory.Error, key: "A computed property name in an ambient context must directly refer to a built-in Symbol." }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_Symbol: { code: 1166, category: DiagnosticCategory.Error, key: "A computed property name in a class property declaration must directly refer to a built-in Symbol." }, Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, - Computed_property_names_are_not_allowed_in_method_overloads: { code: 1168, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in method overloads." }, - Computed_property_names_are_not_allowed_in_interfaces: { code: 1169, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in interfaces." }, - Computed_property_names_are_not_allowed_in_type_literals: { code: 1170, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in type literals." }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_Symbol: { code: 1168, category: DiagnosticCategory.Error, key: "A computed property name in a method overload must directly refer to a built-in Symbol." }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_Symbol: { code: 1169, category: DiagnosticCategory.Error, key: "A computed property name in an interface must directly refer to a built-in Symbol." }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_Symbol: { code: 1170, category: DiagnosticCategory.Error, key: "A computed property name in a type literal must directly refer to a built-in Symbol." }, A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: DiagnosticCategory.Error, key: "A comma expression is not allowed in a computed property name." }, extends_clause_already_seen: { code: 1172, category: DiagnosticCategory.Error, key: "'extends' clause already seen." }, extends_clause_must_precede_implements_clause: { code: 1173, category: DiagnosticCategory.Error, key: "'extends' clause must precede 'implements' clause." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 0cf83d7b185..709750679dc 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -483,11 +483,11 @@ "category": "Error", "code": 1164 }, - "Computed property names are not allowed in an ambient context.": { + "A computed property name in an ambient context must directly refer to a built-in Symbol.": { "category": "Error", "code": 1165 }, - "Computed property names are not allowed in class property declarations.": { + "A computed property name in a class property declaration must directly refer to a built-in Symbol.": { "category": "Error", "code": 1166 }, @@ -495,15 +495,15 @@ "category": "Error", "code": 1167 }, - "Computed property names are not allowed in method overloads.": { + "A computed property name in a method overload must directly refer to a built-in Symbol.": { "category": "Error", "code": 1168 }, - "Computed property names are not allowed in interfaces.": { + "A computed property name in an interface must directly refer to a built-in Symbol.": { "category": "Error", "code": 1169 }, - "Computed property names are not allowed in type literals.": { + "A computed property name in a type literal must directly refer to a built-in Symbol.": { "category": "Error", "code": 1170 }, diff --git a/tests/baselines/reference/computedPropertyNames12.errors.txt b/tests/baselines/reference/computedPropertyNames12.errors.txt index 56774fe8dae..f0fd658c33a 100644 --- a/tests/baselines/reference/computedPropertyNames12.errors.txt +++ b/tests/baselines/reference/computedPropertyNames12.errors.txt @@ -1,14 +1,14 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(5,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(6,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(7,12): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(10,12): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(11,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(12,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(13,12): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(14,5): error TS1166: Computed property names are not allowed in class property declarations. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(15,12): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(5,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(6,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(7,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(10,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(11,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(12,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(13,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(14,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(15,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts (11 errors) ==== @@ -18,35 +18,35 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(15,12) class C { [s]: number; ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. [n] = n; ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. static [s + s]: string; ~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. [s + n] = 2; ~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. [+s]: typeof s; ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. static [""]: number; ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. [0]: number; ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. [a]: number; ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. static [true]: number; ~~~~~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. [`hello bye`] = 0; ~~~~~~~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. static [`hello ${a} bye`] = 0 ~~~~~~~~~~~~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames35.errors.txt b/tests/baselines/reference/computedPropertyNames35.errors.txt index 01c4614e84a..c9986864b0e 100644 --- a/tests/baselines/reference/computedPropertyNames35.errors.txt +++ b/tests/baselines/reference/computedPropertyNames35.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,5): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. @@ -8,7 +8,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,10): bar(): string; [foo()](): void; ~~~~~~~~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. ~ !!! error TS2466: A computed property name cannot reference a type parameter from its containing type. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames42.errors.txt b/tests/baselines/reference/computedPropertyNames42.errors.txt index 059b3117a43..2c05e8869c0 100644 --- a/tests/baselines/reference/computedPropertyNames42.errors.txt +++ b/tests/baselines/reference/computedPropertyNames42.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. @@ -12,7 +12,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): // Computed properties [""]: Foo; ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~~~~~~~~~~ !!! error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt index 69ff2b9e452..ab2d1822e4c 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts (1 errors) ==== interface I { ["" + ""](): void; ~~~~~~~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt index 53eb057f8a1..f366427d525 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts(2,5): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts(2,5): error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts (1 errors) ==== var v: { ["" + ""](): void; ~~~~~~~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt index b3c2957a13f..64b6ba87452 100644 --- a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(4,5): error TS1168: Computed property names are not allowed in method overloads. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(5,5): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(4,5): error TS1168: A computed property name in a method overload must directly refer to a built-in Symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(5,5): error TS1168: A computed property name in a method overload must directly refer to a built-in Symbol. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts (2 errors) ==== @@ -8,9 +8,9 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads. class C { [methodName](v: string); ~~~~~~~~~~~~ -!!! error TS1168: Computed property names are not allowed in method overloads. +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in Symbol. [methodName](); ~~~~~~~~~~~~ -!!! error TS1168: Computed property names are not allowed in method overloads. +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in Symbol. [methodName](v?: string) { } } \ No newline at end of file diff --git a/tests/baselines/reference/giant.errors.txt b/tests/baselines/reference/giant.errors.txt index e8c574d2115..99a4360ac52 100644 --- a/tests/baselines/reference/giant.errors.txt +++ b/tests/baselines/reference/giant.errors.txt @@ -16,7 +16,7 @@ tests/cases/compiler/giant.ts(34,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(35,12): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(36,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(61,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(61,5): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. tests/cases/compiler/giant.ts(61,6): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(62,5): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(63,6): error TS1096: An index signature must have exactly one parameter. @@ -39,7 +39,7 @@ tests/cases/compiler/giant.ts(98,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(99,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(100,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(100,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(125,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(125,9): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. tests/cases/compiler/giant.ts(125,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(126,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(127,10): error TS1096: An index signature must have exactly one parameter. @@ -63,7 +63,7 @@ tests/cases/compiler/giant.ts(177,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(178,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(179,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(179,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(204,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(204,9): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. tests/cases/compiler/giant.ts(204,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(205,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(206,10): error TS1096: An index signature must have exactly one parameter. @@ -119,7 +119,7 @@ tests/cases/compiler/giant.ts(292,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(293,12): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(294,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(294,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(319,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(319,5): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. tests/cases/compiler/giant.ts(319,6): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(320,5): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(321,6): error TS1096: An index signature must have exactly one parameter. @@ -142,7 +142,7 @@ tests/cases/compiler/giant.ts(356,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(357,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(358,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(358,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(383,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(383,9): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. tests/cases/compiler/giant.ts(383,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(384,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(385,10): error TS1096: An index signature must have exactly one parameter. @@ -166,7 +166,7 @@ tests/cases/compiler/giant.ts(435,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(436,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(437,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(437,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(462,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(462,9): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. tests/cases/compiler/giant.ts(462,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(463,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(464,10): error TS1096: An index signature must have exactly one parameter. @@ -238,7 +238,7 @@ tests/cases/compiler/giant.ts(556,21): error TS1036: Statements are not allowed tests/cases/compiler/giant.ts(558,24): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(561,21): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(563,21): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(587,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(587,9): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. tests/cases/compiler/giant.ts(587,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(588,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(589,10): error TS1096: An index signature must have exactly one parameter. @@ -255,7 +255,7 @@ tests/cases/compiler/giant.ts(621,26): error TS1184: An implementation cannot be tests/cases/compiler/giant.ts(623,24): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(626,21): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(628,21): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(653,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/giant.ts(653,9): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. tests/cases/compiler/giant.ts(653,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(654,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(655,10): error TS1096: An index signature must have exactly one parameter. @@ -364,7 +364,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -474,7 +474,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -601,7 +601,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -828,7 +828,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -938,7 +938,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -1065,7 +1065,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -1334,7 +1334,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -1434,7 +1434,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; diff --git a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt index 82e96bf3846..e8b8ed9d488 100644 --- a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt +++ b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,6): error TS2304: Cannot find name 'x'. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(4,5): error TS1021: An index signature must have a type annotation. -tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,6): error TS2304: Cannot find name 'x'. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021: An index signature must have a type annotation. @@ -11,7 +11,7 @@ tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021 // Used to be indexer, now it is a computed property [x]: string; ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'x'. [x: string]; @@ -23,7 +23,7 @@ tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021 // Used to be indexer, now it is a computed property [x]: string ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'x'. diff --git a/tests/baselines/reference/indexSignatureWithInitializer.errors.txt b/tests/baselines/reference/indexSignatureWithInitializer.errors.txt index d6f547a25cb..b7298e6b5e7 100644 --- a/tests/baselines/reference/indexSignatureWithInitializer.errors.txt +++ b/tests/baselines/reference/indexSignatureWithInitializer.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/indexSignatureWithInitializer.ts(3,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/compiler/indexSignatureWithInitializer.ts(3,5): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. tests/cases/compiler/indexSignatureWithInitializer.ts(3,6): error TS2304: Cannot find name 'x'. -tests/cases/compiler/indexSignatureWithInitializer.ts(7,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/compiler/indexSignatureWithInitializer.ts(7,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot find name 'x'. @@ -9,7 +9,7 @@ tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot interface I { [x = '']: string; ~~~~~~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'x'. } @@ -17,7 +17,7 @@ tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot class C { [x = 0]: string ~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/indexWithoutParamType2.errors.txt b/tests/baselines/reference/indexWithoutParamType2.errors.txt index 468368b5f23..163b7b98753 100644 --- a/tests/baselines/reference/indexWithoutParamType2.errors.txt +++ b/tests/baselines/reference/indexWithoutParamType2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/indexWithoutParamType2.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/compiler/indexWithoutParamType2.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/compiler/indexWithoutParamType2.ts(3,6): error TS2304: Cannot find name 'x'. @@ -7,7 +7,7 @@ tests/cases/compiler/indexWithoutParamType2.ts(3,6): error TS2304: Cannot find n // Used to be indexer, now it is a computed property [x]: string ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName10.errors.txt b/tests/baselines/reference/parserComputedPropertyName10.errors.txt index 061e2c40c2d..96ed65032af 100644 --- a/tests/baselines/reference/parserComputedPropertyName10.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName10.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e] = 1 ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName11.errors.txt b/tests/baselines/reference/parserComputedPropertyName11.errors.txt index 65748f72b24..2083c5bc819 100644 --- a/tests/baselines/reference/parserComputedPropertyName11.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,4): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,4): error TS1168: A computed property name in a method overload must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e](); ~~~ -!!! error TS1168: Computed property names are not allowed in method overloads. +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName13.errors.txt b/tests/baselines/reference/parserComputedPropertyName13.errors.txt index b209f3c7d01..e0d06224488 100644 --- a/tests/baselines/reference/parserComputedPropertyName13.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName13.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts (2 errors) ==== var v: { [e]: number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName14.errors.txt b/tests/baselines/reference/parserComputedPropertyName14.errors.txt index 6ac2d276a80..99e36669f50 100644 --- a/tests/baselines/reference/parserComputedPropertyName14.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName14.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts (2 errors) ==== var v: { [e](): number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName15.errors.txt b/tests/baselines/reference/parserComputedPropertyName15.errors.txt index f66e5930c26..1985338e19f 100644 --- a/tests/baselines/reference/parserComputedPropertyName15.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName15.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,31): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,31): error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,32): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts (2 errors) ==== var v: { [e: number]: string; [e]: number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName18.errors.txt b/tests/baselines/reference/parserComputedPropertyName18.errors.txt index f7485a127cb..9a78c057cc7 100644 --- a/tests/baselines/reference/parserComputedPropertyName18.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName18.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts (2 errors) ==== var v: { [e]?(): number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName19.errors.txt b/tests/baselines/reference/parserComputedPropertyName19.errors.txt index 65c22ff36c3..412995f93e0 100644 --- a/tests/baselines/reference/parserComputedPropertyName19.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName19.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts (2 errors) ==== var v: { [e]? }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName20.errors.txt b/tests/baselines/reference/parserComputedPropertyName20.errors.txt index d65dfede1d2..7c93d63a7ef 100644 --- a/tests/baselines/reference/parserComputedPropertyName20.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName20.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP interface I { [e](): number ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName21.errors.txt b/tests/baselines/reference/parserComputedPropertyName21.errors.txt index 5a9738a23a6..603940f24b2 100644 --- a/tests/baselines/reference/parserComputedPropertyName21.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName21.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP interface I { [e]: number ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName22.errors.txt b/tests/baselines/reference/parserComputedPropertyName22.errors.txt index ce20dd0c587..2cdd5321e02 100644 --- a/tests/baselines/reference/parserComputedPropertyName22.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName22.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP declare class C { [e]: number ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName25.errors.txt b/tests/baselines/reference/parserComputedPropertyName25.errors.txt index 8d26c8afdb7..d0b632aa2ec 100644 --- a/tests/baselines/reference/parserComputedPropertyName25.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName25.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,6): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(4,6): error TS2304: Cannot find name 'e2'. @@ -8,7 +8,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP // No ASI [e] = 0 ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. [e2] = 1 diff --git a/tests/baselines/reference/parserComputedPropertyName28.errors.txt b/tests/baselines/reference/parserComputedPropertyName28.errors.txt index c522ec031eb..70a010092e4 100644 --- a/tests/baselines/reference/parserComputedPropertyName28.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName28.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,6): error TS2304: Cannot find name 'e'. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,6): error TS2304: Cannot find name 'e2'. @@ -8,12 +8,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e]: number = 0; ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. [e2]: number ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~~ !!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName29.errors.txt b/tests/baselines/reference/parserComputedPropertyName29.errors.txt index 5e6baed0f06..54d3f9746ff 100644 --- a/tests/baselines/reference/parserComputedPropertyName29.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName29.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,6): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,11): error TS2304: Cannot find name 'id'. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,6): error TS2304: Cannot find name 'e2'. @@ -10,14 +10,14 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP // yes ASI [e] = id++ ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. ~~ !!! error TS2304: Cannot find name 'id'. [e2]: number ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~~ !!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName31.errors.txt b/tests/baselines/reference/parserComputedPropertyName31.errors.txt index 97a3b1ee187..ef4f34bd3e3 100644 --- a/tests/baselines/reference/parserComputedPropertyName31.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName31.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,6): error TS2304: Cannot find name 'e'. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,6): error TS2304: Cannot find name 'e2'. @@ -9,12 +9,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP // yes ASI [e]: number ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. [e2]: number ~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~~ !!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName32.errors.txt b/tests/baselines/reference/parserComputedPropertyName32.errors.txt index da423baaa05..b70d346ce1e 100644 --- a/tests/baselines/reference/parserComputedPropertyName32.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName32.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,5): error TS1165: Computed property names are not allowed in an ambient context. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,5): error TS1165: A computed property name in an ambient context must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP declare class C { [e](): number ~~~ -!!! error TS1165: Computed property names are not allowed in an ambient context. +!!! error TS1165: A computed property name in an ambient context must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName36.errors.txt b/tests/baselines/reference/parserComputedPropertyName36.errors.txt index 1b4130b0e27..3536ead6ebe 100644 --- a/tests/baselines/reference/parserComputedPropertyName36.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName36.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,6): error TS2304: Cannot find name 'public'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [public ]: string; ~~~~~~~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~~~~~~ !!! error TS2304: Cannot find name 'public'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName7.errors.txt b/tests/baselines/reference/parserComputedPropertyName7.errors.txt index bcf39b0ca0a..833383b64c9 100644 --- a/tests/baselines/reference/parserComputedPropertyName7.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e] ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName8.errors.txt b/tests/baselines/reference/parserComputedPropertyName8.errors.txt index 250c7a52c6e..d8798997f59 100644 --- a/tests/baselines/reference/parserComputedPropertyName8.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName8.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,11): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,11): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,12): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { public [e] ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName9.errors.txt b/tests/baselines/reference/parserComputedPropertyName9.errors.txt index fd434046564..ce97d134718 100644 --- a/tests/baselines/reference/parserComputedPropertyName9.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName9.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,5): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'. @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e]: Type ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. ~~~~ diff --git a/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt index 55af923e54b..7dc962d83b0 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,5): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput declare class C { [e]: number ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt index 7db85cdef35..76a2a986261 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e] = 1 ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt index ead27a994d1..41d146ba518 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,4): error TS1168: Computed property names are not allowed in method overloads. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,4): error TS1168: A computed property name in a method overload must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e](); ~~~ -!!! error TS1168: Computed property names are not allowed in method overloads. +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt index 122ca20a0e4..d375f202918 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,5): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput interface I { [e]: number ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt index d38d57d87be..849cdc6d2a1 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e] ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt index e52727c6929..84cf5e849f6 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,10): error TS1170: Computed property names are not allowed in type literals. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts (2 errors) ==== var v: { [e]: number }; ~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt index 8cbe0ffcf8d..da62c00cd0f 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,4): error TS1166: Computed property names are not allowed in class property declarations. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,5): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'. @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e]: Type ~~~ -!!! error TS1166: Computed property names are not allowed in class property declarations. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'e'. ~~~~ diff --git a/tests/baselines/reference/parserIndexSignature11.errors.txt b/tests/baselines/reference/parserIndexSignature11.errors.txt index 8cf474b19bb..b3c29f44d99 100644 --- a/tests/baselines/reference/parserIndexSignature11.errors.txt +++ b/tests/baselines/reference/parserIndexSignature11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,9): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,9): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,10): error TS2304: Cannot find name 'p'. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(3,9): error TS1021: An index signature must have a type annotation. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(4,10): error TS1096: An index signature must have exactly one parameter. @@ -8,7 +8,7 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature1 interface I { [p]; // Used to be indexer, now it is a computed property ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; diff --git a/tests/baselines/reference/parserIndexSignature4.errors.txt b/tests/baselines/reference/parserIndexSignature4.errors.txt index d625f27eb6f..f67ea364c46 100644 --- a/tests/baselines/reference/parserIndexSignature4.errors.txt +++ b/tests/baselines/reference/parserIndexSignature4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,3): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,3): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,4): error TS2304: Cannot find name 'a'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4 interface I { [a = 0] // Used to be indexer, now it is a computed property ~~~~~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'a'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexSignature5.errors.txt b/tests/baselines/reference/parserIndexSignature5.errors.txt index 3f3415973d9..85c9e0a21a1 100644 --- a/tests/baselines/reference/parserIndexSignature5.errors.txt +++ b/tests/baselines/reference/parserIndexSignature5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,3): error TS1169: Computed property names are not allowed in interfaces. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,3): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,4): error TS2304: Cannot find name 'a'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5 interface I { [a] // Used to be indexer, now it is a computed property ~~~ -!!! error TS1169: Computed property names are not allowed in interfaces. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. ~ !!! error TS2304: Cannot find name 'a'. } \ No newline at end of file diff --git a/tests/baselines/reference/propertyAssignment.errors.txt b/tests/baselines/reference/propertyAssignment.errors.txt index 51850754a9a..54a74e1b129 100644 --- a/tests/baselines/reference/propertyAssignment.errors.txt +++ b/tests/baselines/reference/propertyAssignment.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/propertyAssignment.ts(6,13): error TS1170: Computed property names are not allowed in type literals. +tests/cases/compiler/propertyAssignment.ts(6,13): error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. tests/cases/compiler/propertyAssignment.ts(6,14): error TS2304: Cannot find name 'index'. tests/cases/compiler/propertyAssignment.ts(14,1): error TS2322: Type '{ x: number; }' is not assignable to type 'new () => any'. tests/cases/compiler/propertyAssignment.ts(16,1): error TS2322: Type '{ x: number; }' is not assignable to type '() => void'. @@ -12,7 +12,7 @@ tests/cases/compiler/propertyAssignment.ts(16,1): error TS2322: Type '{ x: numbe var foo2: { [index]; } // should be an error, used to be indexer, now it is a computed property ~~~~~~~ -!!! error TS1170: Computed property names are not allowed in type literals. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. ~~~~~ !!! error TS2304: Cannot find name 'index'. var bar2: { x : number; } From 39952b1a934b34666219b7e81aee2cf15abc9dad Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 27 Jan 2015 17:35:29 -0800 Subject: [PATCH 012/162] Syntactically allow computed properties everywhere if the name looks like a built in Symbol --- src/compiler/checker.ts | 20 +++++++++---------- src/compiler/utilities.ts | 14 +++++++++++-- .../parserES5SymbolProperty1.errors.txt | 12 +++++++++++ .../parserES5SymbolProperty2.errors.txt | 12 +++++++++++ .../parserES5SymbolProperty3.errors.txt | 12 +++++++++++ .../parserES5SymbolProperty4.errors.txt | 12 +++++++++++ .../parserES5SymbolProperty5.errors.txt | 12 +++++++++++ .../parserES5SymbolProperty6.errors.txt | 12 +++++++++++ .../parserES5SymbolProperty7.errors.txt | 12 +++++++++++ .../parserES5SymbolProperty8.errors.txt | 12 +++++++++++ .../parserES5SymbolProperty9.errors.txt | 12 +++++++++++ .../parserSymbolProperty1.errors.txt | 9 +++++++++ .../reference/parserSymbolProperty1.js | 6 ++++++ .../parserSymbolProperty2.errors.txt | 9 +++++++++ .../reference/parserSymbolProperty2.js | 6 ++++++ .../parserSymbolProperty3.errors.txt | 9 +++++++++ .../reference/parserSymbolProperty3.js | 6 ++++++ .../parserSymbolProperty4.errors.txt | 9 +++++++++ .../reference/parserSymbolProperty4.js | 6 ++++++ .../parserSymbolProperty5.errors.txt | 9 +++++++++ .../reference/parserSymbolProperty5.js | 11 ++++++++++ .../parserSymbolProperty6.errors.txt | 9 +++++++++ .../reference/parserSymbolProperty6.js | 12 +++++++++++ .../parserSymbolProperty7.errors.txt | 9 +++++++++ .../reference/parserSymbolProperty7.js | 13 ++++++++++++ .../parserSymbolProperty8.errors.txt | 9 +++++++++ .../reference/parserSymbolProperty8.js | 7 +++++++ .../parserSymbolProperty9.errors.txt | 9 +++++++++ .../reference/parserSymbolProperty9.js | 7 +++++++ .../Symbols/parserES5SymbolProperty1.ts | 4 ++++ .../Symbols/parserES5SymbolProperty2.ts | 4 ++++ .../Symbols/parserES5SymbolProperty3.ts | 4 ++++ .../Symbols/parserES5SymbolProperty4.ts | 4 ++++ .../Symbols/parserES5SymbolProperty5.ts | 4 ++++ .../Symbols/parserES5SymbolProperty6.ts | 4 ++++ .../Symbols/parserES5SymbolProperty7.ts | 4 ++++ .../Symbols/parserES5SymbolProperty8.ts | 4 ++++ .../Symbols/parserES5SymbolProperty9.ts | 4 ++++ .../Symbols/parserSymbolProperty1.ts | 4 ++++ .../Symbols/parserSymbolProperty2.ts | 4 ++++ .../Symbols/parserSymbolProperty3.ts | 4 ++++ .../Symbols/parserSymbolProperty4.ts | 4 ++++ .../Symbols/parserSymbolProperty5.ts | 4 ++++ .../Symbols/parserSymbolProperty6.ts | 4 ++++ .../Symbols/parserSymbolProperty7.ts | 4 ++++ .../Symbols/parserSymbolProperty8.ts | 4 ++++ .../Symbols/parserSymbolProperty9.ts | 4 ++++ 47 files changed, 357 insertions(+), 12 deletions(-) create mode 100644 tests/baselines/reference/parserES5SymbolProperty1.errors.txt create mode 100644 tests/baselines/reference/parserES5SymbolProperty2.errors.txt create mode 100644 tests/baselines/reference/parserES5SymbolProperty3.errors.txt create mode 100644 tests/baselines/reference/parserES5SymbolProperty4.errors.txt create mode 100644 tests/baselines/reference/parserES5SymbolProperty5.errors.txt create mode 100644 tests/baselines/reference/parserES5SymbolProperty6.errors.txt create mode 100644 tests/baselines/reference/parserES5SymbolProperty7.errors.txt create mode 100644 tests/baselines/reference/parserES5SymbolProperty8.errors.txt create mode 100644 tests/baselines/reference/parserES5SymbolProperty9.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty1.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty1.js create mode 100644 tests/baselines/reference/parserSymbolProperty2.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty2.js create mode 100644 tests/baselines/reference/parserSymbolProperty3.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty3.js create mode 100644 tests/baselines/reference/parserSymbolProperty4.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty4.js create mode 100644 tests/baselines/reference/parserSymbolProperty5.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty5.js create mode 100644 tests/baselines/reference/parserSymbolProperty6.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty6.js create mode 100644 tests/baselines/reference/parserSymbolProperty7.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty7.js create mode 100644 tests/baselines/reference/parserSymbolProperty8.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty8.js create mode 100644 tests/baselines/reference/parserSymbolProperty9.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty9.js create mode 100644 tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 70aa5187549..65a97f2b2f4 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7487,7 +7487,7 @@ module ts { function checkPropertyDeclaration(node: PropertyDeclaration) { // Grammar checking - checkGrammarModifiers(node) || checkGrammarProperty(node); + checkGrammarModifiers(node) || checkGrammarProperty(node) || checkGrammarComputedPropertyName(node.name); checkVariableLikeDeclaration(node); } @@ -10771,8 +10771,8 @@ module ts { } } - function checkGrammarForDisallowedComputedProperty(node: DeclarationName, message: DiagnosticMessage) { - if (node.kind === SyntaxKind.ComputedPropertyName) { + function checkGrammarForNonSymbolComputedProperty(node: DeclarationName, message: DiagnosticMessage) { + if (node.kind === SyntaxKind.ComputedPropertyName && !isWellKnownSymbolSyntactically((node).expression)) { return grammarErrorOnNode(node, message); } } @@ -10803,17 +10803,17 @@ module ts { // and accessors are not allowed in ambient contexts in general, // so this error only really matters for methods. if (isInAmbientContext(node)) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_Symbol); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_Symbol); } else if (!node.body) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_Symbol); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_Symbol); } } else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_Symbol); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_Symbol); } else if (node.parent.kind === SyntaxKind.TypeLiteral) { - return checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_Symbol); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_Symbol); } } @@ -11084,17 +11084,17 @@ module ts { function checkGrammarProperty(node: PropertyDeclaration) { if (node.parent.kind === SyntaxKind.ClassDeclaration) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, Diagnostics.A_class_member_cannot_be_declared_optional) || - checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_Symbol)) { + checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_Symbol)) { return true; } } else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) { - if (checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_Symbol)) { + if (checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_Symbol)) { return true; } } else if (node.parent.kind === SyntaxKind.TypeLiteral) { - if (checkGrammarForDisallowedComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_Symbol)) { + if (checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_Symbol)) { return true; } } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 8c3dd112b15..d543c749089 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -835,11 +835,21 @@ module ts { return SyntaxKind.FirstTriviaToken <= token && token <= SyntaxKind.LastTriviaToken; } + export function isWellKnownSymbolSyntactically(node: Node): boolean { + return node.kind === SyntaxKind.PropertyAccessExpression && isESSymbolIdentifier((node).expression); + } + export function isESSymbolTypeNode(node: Node): boolean { return node.kind === SyntaxKind.TypeReference && (node).typeArguments === undefined && - (node).typeName.kind === SyntaxKind.Identifier && - ((node).typeName).text === "Symbol"; + isESSymbolIdentifier((node).typeName); + } + + /** + * Includes the word "Symbol" with unicode escapes + */ + export function isESSymbolIdentifier(node: Node): boolean { + return node.kind === SyntaxKind.Identifier && (node).text === "Symbol"; } export function isModifier(token: SyntaxKind): boolean { diff --git a/tests/baselines/reference/parserES5SymbolProperty1.errors.txt b/tests/baselines/reference/parserES5SymbolProperty1.errors.txt new file mode 100644 index 00000000000..e82ac4c3bc6 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty1.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts (2 errors) ==== + interface I { + [Symbol.iterator]: string; + ~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty2.errors.txt b/tests/baselines/reference/parserES5SymbolProperty2.errors.txt new file mode 100644 index 00000000000..c8ca6613da8 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty2.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts (2 errors) ==== + interface I { + [Symbol.unscopables](): string; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty3.errors.txt b/tests/baselines/reference/parserES5SymbolProperty3.errors.txt new file mode 100644 index 00000000000..4bd883b44b7 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty3.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts (2 errors) ==== + declare class C { + [Symbol.unscopables](): string; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty4.errors.txt b/tests/baselines/reference/parserES5SymbolProperty4.errors.txt new file mode 100644 index 00000000000..cdc5510766e --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty4.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts (2 errors) ==== + declare class C { + [Symbol.isRegExp]: string; + ~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty5.errors.txt b/tests/baselines/reference/parserES5SymbolProperty5.errors.txt new file mode 100644 index 00000000000..2e80a55b47e --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty5.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts (2 errors) ==== + class C { + [Symbol.isRegExp]: string; + ~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty6.errors.txt b/tests/baselines/reference/parserES5SymbolProperty6.errors.txt new file mode 100644 index 00000000000..615be8ca8da --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty6.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts (2 errors) ==== + class C { + [Symbol.toStringTag]: string = ""; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty7.errors.txt b/tests/baselines/reference/parserES5SymbolProperty7.errors.txt new file mode 100644 index 00000000000..fa43310f0a7 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty7.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts (2 errors) ==== + class C { + [Symbol.toStringTag](): void { } + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty8.errors.txt b/tests/baselines/reference/parserES5SymbolProperty8.errors.txt new file mode 100644 index 00000000000..ce7ce5b8319 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty8.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts (2 errors) ==== + var x: { + [Symbol.toPrimitive](): string + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolProperty9.errors.txt b/tests/baselines/reference/parserES5SymbolProperty9.errors.txt new file mode 100644 index 00000000000..90c3785c938 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty9.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts(2,6): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts (2 errors) ==== + var x: { + [Symbol.toPrimitive]: string + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty1.errors.txt b/tests/baselines/reference/parserSymbolProperty1.errors.txt new file mode 100644 index 00000000000..40f15966703 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty1.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts (1 errors) ==== + interface I { + [Symbol.iterator]: string; + ~~~~~~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty1.js b/tests/baselines/reference/parserSymbolProperty1.js new file mode 100644 index 00000000000..6bcede608fb --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty1.js @@ -0,0 +1,6 @@ +//// [parserSymbolProperty1.ts] +interface I { + [Symbol.iterator]: string; +} + +//// [parserSymbolProperty1.js] diff --git a/tests/baselines/reference/parserSymbolProperty2.errors.txt b/tests/baselines/reference/parserSymbolProperty2.errors.txt new file mode 100644 index 00000000000..fa6f99c2695 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty2.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts (1 errors) ==== + interface I { + [Symbol.unscopables](): string; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty2.js b/tests/baselines/reference/parserSymbolProperty2.js new file mode 100644 index 00000000000..6530072d46f --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty2.js @@ -0,0 +1,6 @@ +//// [parserSymbolProperty2.ts] +interface I { + [Symbol.unscopables](): string; +} + +//// [parserSymbolProperty2.js] diff --git a/tests/baselines/reference/parserSymbolProperty3.errors.txt b/tests/baselines/reference/parserSymbolProperty3.errors.txt new file mode 100644 index 00000000000..2b9ecdc7705 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty3.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts (1 errors) ==== + declare class C { + [Symbol.unscopables](): string; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty3.js b/tests/baselines/reference/parserSymbolProperty3.js new file mode 100644 index 00000000000..5b1b48254b1 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty3.js @@ -0,0 +1,6 @@ +//// [parserSymbolProperty3.ts] +declare class C { + [Symbol.unscopables](): string; +} + +//// [parserSymbolProperty3.js] diff --git a/tests/baselines/reference/parserSymbolProperty4.errors.txt b/tests/baselines/reference/parserSymbolProperty4.errors.txt new file mode 100644 index 00000000000..2405651b0b1 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty4.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts (1 errors) ==== + declare class C { + [Symbol.isRegExp]: string; + ~~~~~~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty4.js b/tests/baselines/reference/parserSymbolProperty4.js new file mode 100644 index 00000000000..f79db0b1d79 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty4.js @@ -0,0 +1,6 @@ +//// [parserSymbolProperty4.ts] +declare class C { + [Symbol.isRegExp]: string; +} + +//// [parserSymbolProperty4.js] diff --git a/tests/baselines/reference/parserSymbolProperty5.errors.txt b/tests/baselines/reference/parserSymbolProperty5.errors.txt new file mode 100644 index 00000000000..8eb85a293f5 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty5.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts (1 errors) ==== + class C { + [Symbol.isRegExp]: string; + ~~~~~~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty5.js b/tests/baselines/reference/parserSymbolProperty5.js new file mode 100644 index 00000000000..922e1fb0323 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty5.js @@ -0,0 +1,11 @@ +//// [parserSymbolProperty5.ts] +class C { + [Symbol.isRegExp]: string; +} + +//// [parserSymbolProperty5.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolProperty6.errors.txt b/tests/baselines/reference/parserSymbolProperty6.errors.txt new file mode 100644 index 00000000000..8fde6aac4a8 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty6.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts (1 errors) ==== + class C { + [Symbol.toStringTag]: string = ""; + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty6.js b/tests/baselines/reference/parserSymbolProperty6.js new file mode 100644 index 00000000000..cbc06cd2951 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty6.js @@ -0,0 +1,12 @@ +//// [parserSymbolProperty6.ts] +class C { + [Symbol.toStringTag]: string = ""; +} + +//// [parserSymbolProperty6.js] +var C = (function () { + function C() { + this[Symbol.toStringTag] = ""; + } + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolProperty7.errors.txt b/tests/baselines/reference/parserSymbolProperty7.errors.txt new file mode 100644 index 00000000000..b55bbaa11ae --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty7.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts (1 errors) ==== + class C { + [Symbol.toStringTag](): void { } + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty7.js b/tests/baselines/reference/parserSymbolProperty7.js new file mode 100644 index 00000000000..9d34b9e3bce --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty7.js @@ -0,0 +1,13 @@ +//// [parserSymbolProperty7.ts] +class C { + [Symbol.toStringTag](): void { } +} + +//// [parserSymbolProperty7.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toStringTag] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolProperty8.errors.txt b/tests/baselines/reference/parserSymbolProperty8.errors.txt new file mode 100644 index 00000000000..c37219682df --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty8.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts (1 errors) ==== + var x: { + [Symbol.toPrimitive](): string + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty8.js b/tests/baselines/reference/parserSymbolProperty8.js new file mode 100644 index 00000000000..f312ede6b1d --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty8.js @@ -0,0 +1,7 @@ +//// [parserSymbolProperty8.ts] +var x: { + [Symbol.toPrimitive](): string +} + +//// [parserSymbolProperty8.js] +var x; diff --git a/tests/baselines/reference/parserSymbolProperty9.errors.txt b/tests/baselines/reference/parserSymbolProperty9.errors.txt new file mode 100644 index 00000000000..b229d29b1b4 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty9.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts (1 errors) ==== + var x: { + [Symbol.toPrimitive]: string + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty9.js b/tests/baselines/reference/parserSymbolProperty9.js new file mode 100644 index 00000000000..6efc6650ea0 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty9.js @@ -0,0 +1,7 @@ +//// [parserSymbolProperty9.ts] +var x: { + [Symbol.toPrimitive]: string +} + +//// [parserSymbolProperty9.js] +var x; diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts new file mode 100644 index 00000000000..64ca01bba6c --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty1.ts @@ -0,0 +1,4 @@ +//@target: ES5 +interface I { + [Symbol.iterator]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts new file mode 100644 index 00000000000..cc606c2e6a3 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty2.ts @@ -0,0 +1,4 @@ +//@target: ES5 +interface I { + [Symbol.unscopables](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts new file mode 100644 index 00000000000..978d4ef95f0 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty3.ts @@ -0,0 +1,4 @@ +//@target: ES5 +declare class C { + [Symbol.unscopables](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts new file mode 100644 index 00000000000..7f16672ebd2 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty4.ts @@ -0,0 +1,4 @@ +//@target: ES5 +declare class C { + [Symbol.isRegExp]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts new file mode 100644 index 00000000000..fb7f00d7694 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty5.ts @@ -0,0 +1,4 @@ +//@target: ES5 +class C { + [Symbol.isRegExp]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts new file mode 100644 index 00000000000..3fc8e6f8979 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty6.ts @@ -0,0 +1,4 @@ +//@target: ES5 +class C { + [Symbol.toStringTag]: string = ""; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts new file mode 100644 index 00000000000..a27636388c0 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty7.ts @@ -0,0 +1,4 @@ +//@target: ES5 +class C { + [Symbol.toStringTag](): void { } +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts new file mode 100644 index 00000000000..78e5738f7da --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty8.ts @@ -0,0 +1,4 @@ +//@target: ES5 +var x: { + [Symbol.toPrimitive](): string +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts new file mode 100644 index 00000000000..7838df4d8fc --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolProperty9.ts @@ -0,0 +1,4 @@ +//@target: ES5 +var x: { + [Symbol.toPrimitive]: string +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts new file mode 100644 index 00000000000..d29272fd561 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts @@ -0,0 +1,4 @@ +//@target: ES6 +interface I { + [Symbol.iterator]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts new file mode 100644 index 00000000000..3ef11e99aa9 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts @@ -0,0 +1,4 @@ +//@target: ES6 +interface I { + [Symbol.unscopables](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts new file mode 100644 index 00000000000..d63302991d0 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts @@ -0,0 +1,4 @@ +//@target: ES6 +declare class C { + [Symbol.unscopables](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts new file mode 100644 index 00000000000..6a0962f15cb --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts @@ -0,0 +1,4 @@ +//@target: ES6 +declare class C { + [Symbol.isRegExp]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts new file mode 100644 index 00000000000..5f3fbaeaaea --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + [Symbol.isRegExp]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts new file mode 100644 index 00000000000..24d67c8b707 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + [Symbol.toStringTag]: string = ""; +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts new file mode 100644 index 00000000000..69f2f4b30f8 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts @@ -0,0 +1,4 @@ +//@target: ES6 +class C { + [Symbol.toStringTag](): void { } +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts new file mode 100644 index 00000000000..dcc6d5b7615 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var x: { + [Symbol.toPrimitive](): string +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts new file mode 100644 index 00000000000..b7093f188d2 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var x: { + [Symbol.toPrimitive]: string +} \ No newline at end of file From d78862433211e6ae693df6728adbf37c57562ee6 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 27 Jan 2015 17:38:14 -0800 Subject: [PATCH 013/162] Move hasDynamicName to utilities.ts --- src/compiler/binder.ts | 11 ----------- src/compiler/utilities.ts | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index c1b9d76f1b5..78fe4af0a1e 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -51,17 +51,6 @@ module ts { } } - /** - * A declaration has a dynamic name if both of the following are true: - * 1. The declaration has a computed property name - * 2. The computed name is *not* expressed as Symbol., where name - * is a property of the Symbol constructor that denotes a built in - * Symbol. - */ - export function hasDynamicName(declaration: Declaration): boolean { - return declaration.name && declaration.name.kind === SyntaxKind.ComputedPropertyName; - } - export function bindSourceFile(file: SourceFile): void { var start = new Date().getTime(); bindSourceFileWorker(file); diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index d543c749089..c9d3dfc94ba 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -835,6 +835,17 @@ module ts { return SyntaxKind.FirstTriviaToken <= token && token <= SyntaxKind.LastTriviaToken; } + /** + * A declaration has a dynamic name if both of the following are true: + * 1. The declaration has a computed property name + * 2. The computed name is *not* expressed as Symbol., where name + * is a property of the Symbol constructor that denotes a built in + * Symbol. + */ + export function hasDynamicName(declaration: Declaration): boolean { + return declaration.name && declaration.name.kind === SyntaxKind.ComputedPropertyName; + } + export function isWellKnownSymbolSyntactically(node: Node): boolean { return node.kind === SyntaxKind.PropertyAccessExpression && isESSymbolIdentifier((node).expression); } From 07f3641af2b3def43c823ff8287fb065628a09b6 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 28 Jan 2015 10:46:22 -0800 Subject: [PATCH 014/162] Update hasDynamicName to take well known symbols into account --- src/compiler/utilities.ts | 4 +++- .../baselines/reference/parserSymbolProperty1.errors.txt | 9 --------- tests/baselines/reference/parserSymbolProperty1.types | 9 +++++++++ .../baselines/reference/parserSymbolProperty2.errors.txt | 9 --------- tests/baselines/reference/parserSymbolProperty2.types | 9 +++++++++ .../baselines/reference/parserSymbolProperty3.errors.txt | 9 --------- tests/baselines/reference/parserSymbolProperty3.types | 9 +++++++++ .../baselines/reference/parserSymbolProperty4.errors.txt | 9 --------- tests/baselines/reference/parserSymbolProperty4.types | 9 +++++++++ .../baselines/reference/parserSymbolProperty5.errors.txt | 9 --------- tests/baselines/reference/parserSymbolProperty5.types | 9 +++++++++ .../baselines/reference/parserSymbolProperty6.errors.txt | 9 --------- tests/baselines/reference/parserSymbolProperty6.types | 9 +++++++++ .../baselines/reference/parserSymbolProperty7.errors.txt | 9 --------- tests/baselines/reference/parserSymbolProperty7.types | 9 +++++++++ .../baselines/reference/parserSymbolProperty8.errors.txt | 9 --------- tests/baselines/reference/parserSymbolProperty8.types | 9 +++++++++ .../baselines/reference/parserSymbolProperty9.errors.txt | 9 --------- tests/baselines/reference/parserSymbolProperty9.types | 9 +++++++++ 19 files changed, 84 insertions(+), 82 deletions(-) delete mode 100644 tests/baselines/reference/parserSymbolProperty1.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty1.types delete mode 100644 tests/baselines/reference/parserSymbolProperty2.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty2.types delete mode 100644 tests/baselines/reference/parserSymbolProperty3.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty3.types delete mode 100644 tests/baselines/reference/parserSymbolProperty4.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty4.types delete mode 100644 tests/baselines/reference/parserSymbolProperty5.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty5.types delete mode 100644 tests/baselines/reference/parserSymbolProperty6.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty6.types delete mode 100644 tests/baselines/reference/parserSymbolProperty7.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty7.types delete mode 100644 tests/baselines/reference/parserSymbolProperty8.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty8.types delete mode 100644 tests/baselines/reference/parserSymbolProperty9.errors.txt create mode 100644 tests/baselines/reference/parserSymbolProperty9.types diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index c9d3dfc94ba..6dc6d86fc04 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -843,7 +843,9 @@ module ts { * Symbol. */ export function hasDynamicName(declaration: Declaration): boolean { - return declaration.name && declaration.name.kind === SyntaxKind.ComputedPropertyName; + return declaration.name && + declaration.name.kind === SyntaxKind.ComputedPropertyName && + !isWellKnownSymbolSyntactically((declaration.name).expression); } export function isWellKnownSymbolSyntactically(node: Node): boolean { diff --git a/tests/baselines/reference/parserSymbolProperty1.errors.txt b/tests/baselines/reference/parserSymbolProperty1.errors.txt deleted file mode 100644 index 40f15966703..00000000000 --- a/tests/baselines/reference/parserSymbolProperty1.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. - - -==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts (1 errors) ==== - interface I { - [Symbol.iterator]: string; - ~~~~~~~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. - } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty1.types b/tests/baselines/reference/parserSymbolProperty1.types new file mode 100644 index 00000000000..ab68b0bc7ac --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty1.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty1.ts === +interface I { +>I : I + + [Symbol.iterator]: string; +>Symbol.iterator : Symbol +>Symbol : SymbolConstructor +>iterator : Symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty2.errors.txt b/tests/baselines/reference/parserSymbolProperty2.errors.txt deleted file mode 100644 index fa6f99c2695..00000000000 --- a/tests/baselines/reference/parserSymbolProperty2.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. - - -==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts (1 errors) ==== - interface I { - [Symbol.unscopables](): string; - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. - } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty2.types b/tests/baselines/reference/parserSymbolProperty2.types new file mode 100644 index 00000000000..02ba4c21a8a --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty2.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty2.ts === +interface I { +>I : I + + [Symbol.unscopables](): string; +>Symbol.unscopables : Symbol +>Symbol : SymbolConstructor +>unscopables : Symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty3.errors.txt b/tests/baselines/reference/parserSymbolProperty3.errors.txt deleted file mode 100644 index 2b9ecdc7705..00000000000 --- a/tests/baselines/reference/parserSymbolProperty3.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. - - -==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts (1 errors) ==== - declare class C { - [Symbol.unscopables](): string; - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. - } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty3.types b/tests/baselines/reference/parserSymbolProperty3.types new file mode 100644 index 00000000000..4f0245cee6f --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty3.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty3.ts === +declare class C { +>C : C + + [Symbol.unscopables](): string; +>Symbol.unscopables : Symbol +>Symbol : SymbolConstructor +>unscopables : Symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty4.errors.txt b/tests/baselines/reference/parserSymbolProperty4.errors.txt deleted file mode 100644 index 2405651b0b1..00000000000 --- a/tests/baselines/reference/parserSymbolProperty4.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. - - -==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts (1 errors) ==== - declare class C { - [Symbol.isRegExp]: string; - ~~~~~~~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. - } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty4.types b/tests/baselines/reference/parserSymbolProperty4.types new file mode 100644 index 00000000000..9fcd6c4a29e --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty4.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty4.ts === +declare class C { +>C : C + + [Symbol.isRegExp]: string; +>Symbol.isRegExp : Symbol +>Symbol : SymbolConstructor +>isRegExp : Symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty5.errors.txt b/tests/baselines/reference/parserSymbolProperty5.errors.txt deleted file mode 100644 index 8eb85a293f5..00000000000 --- a/tests/baselines/reference/parserSymbolProperty5.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. - - -==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts (1 errors) ==== - class C { - [Symbol.isRegExp]: string; - ~~~~~~~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. - } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty5.types b/tests/baselines/reference/parserSymbolProperty5.types new file mode 100644 index 00000000000..1cdaa6ec694 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty5.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty5.ts === +class C { +>C : C + + [Symbol.isRegExp]: string; +>Symbol.isRegExp : Symbol +>Symbol : SymbolConstructor +>isRegExp : Symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty6.errors.txt b/tests/baselines/reference/parserSymbolProperty6.errors.txt deleted file mode 100644 index 8fde6aac4a8..00000000000 --- a/tests/baselines/reference/parserSymbolProperty6.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. - - -==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts (1 errors) ==== - class C { - [Symbol.toStringTag]: string = ""; - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. - } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty6.types b/tests/baselines/reference/parserSymbolProperty6.types new file mode 100644 index 00000000000..7f14f36d28d --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty6.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty6.ts === +class C { +>C : C + + [Symbol.toStringTag]: string = ""; +>Symbol.toStringTag : Symbol +>Symbol : SymbolConstructor +>toStringTag : Symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty7.errors.txt b/tests/baselines/reference/parserSymbolProperty7.errors.txt deleted file mode 100644 index b55bbaa11ae..00000000000 --- a/tests/baselines/reference/parserSymbolProperty7.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. - - -==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts (1 errors) ==== - class C { - [Symbol.toStringTag](): void { } - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. - } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty7.types b/tests/baselines/reference/parserSymbolProperty7.types new file mode 100644 index 00000000000..ce62cd93498 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty7.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty7.ts === +class C { +>C : C + + [Symbol.toStringTag](): void { } +>Symbol.toStringTag : Symbol +>Symbol : SymbolConstructor +>toStringTag : Symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty8.errors.txt b/tests/baselines/reference/parserSymbolProperty8.errors.txt deleted file mode 100644 index c37219682df..00000000000 --- a/tests/baselines/reference/parserSymbolProperty8.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. - - -==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts (1 errors) ==== - var x: { - [Symbol.toPrimitive](): string - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. - } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty8.types b/tests/baselines/reference/parserSymbolProperty8.types new file mode 100644 index 00000000000..cc3a20af9be --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty8.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts === +var x: { +>x : {} + + [Symbol.toPrimitive](): string +>Symbol.toPrimitive : Symbol +>Symbol : SymbolConstructor +>toPrimitive : Symbol +} diff --git a/tests/baselines/reference/parserSymbolProperty9.errors.txt b/tests/baselines/reference/parserSymbolProperty9.errors.txt deleted file mode 100644 index b229d29b1b4..00000000000 --- a/tests/baselines/reference/parserSymbolProperty9.errors.txt +++ /dev/null @@ -1,9 +0,0 @@ -tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. - - -==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts (1 errors) ==== - var x: { - [Symbol.toPrimitive]: string - ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. - } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolProperty9.types b/tests/baselines/reference/parserSymbolProperty9.types new file mode 100644 index 00000000000..77746283990 --- /dev/null +++ b/tests/baselines/reference/parserSymbolProperty9.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts === +var x: { +>x : {} + + [Symbol.toPrimitive]: string +>Symbol.toPrimitive : Symbol +>Symbol : SymbolConstructor +>toPrimitive : Symbol +} From f344654460c0772eb781754a0c5b460cf740e114 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 28 Jan 2015 15:57:47 -0800 Subject: [PATCH 015/162] Add named property symbol for known Symbol properties --- src/compiler/binder.ts | 9 +++++++-- src/compiler/checker.ts | 10 ++++++++-- src/compiler/utilities.ts | 2 +- tests/baselines/reference/parserSymbolProperty8.types | 2 +- tests/baselines/reference/parserSymbolProperty9.types | 2 +- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 78fe4af0a1e..3f17d26d2b2 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -87,13 +87,18 @@ module ts { if (symbolKind & SymbolFlags.Value && !symbol.valueDeclaration) symbol.valueDeclaration = node; } - // Should not be called on a declaration with a computed property name. + // Should not be called on a declaration with a computed property name, + // unless it is a well known Symbol. function getDeclarationName(node: Declaration): string { if (node.name) { if (node.kind === SyntaxKind.ModuleDeclaration && node.name.kind === SyntaxKind.StringLiteral) { return '"' + (node.name).text + '"'; } - Debug.assert(!hasDynamicName(node)); + if (node.name.kind === SyntaxKind.ComputedPropertyName) { + var nameExpression = (node.name).expression; + Debug.assert(isWellKnownSymbolSyntactically(nameExpression)); + return "__@" + (nameExpression).name.text; + } return (node.name).text; } switch (node.kind) { diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 65a97f2b2f4..5a5d5931c27 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -706,9 +706,15 @@ module ts { return type; } - // A reserved member name starts with two underscores followed by a non-underscore + // A reserved member name starts with two underscores, but the third character cannot be an underscore + // or the @ symbol. A third underscore indicates an escaped form of an identifer that started + // with at least two underscores. The @ character indicates that the name is denoted by a well known ES + // Symbol instance. function isReservedMemberName(name: string) { - return name.charCodeAt(0) === CharacterCodes._ && name.charCodeAt(1) === CharacterCodes._ && name.charCodeAt(2) !== CharacterCodes._; + return name.charCodeAt(0) === CharacterCodes._ && + name.charCodeAt(1) === CharacterCodes._ && + name.charCodeAt(2) !== CharacterCodes._ && + name.charCodeAt(2) !== CharacterCodes.at; } function getNamedMembers(members: SymbolTable): Symbol[] { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 6dc6d86fc04..abf902d5fd1 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -848,7 +848,7 @@ module ts { !isWellKnownSymbolSyntactically((declaration.name).expression); } - export function isWellKnownSymbolSyntactically(node: Node): boolean { + export function isWellKnownSymbolSyntactically(node: Expression): boolean { return node.kind === SyntaxKind.PropertyAccessExpression && isESSymbolIdentifier((node).expression); } diff --git a/tests/baselines/reference/parserSymbolProperty8.types b/tests/baselines/reference/parserSymbolProperty8.types index cc3a20af9be..048885dfd38 100644 --- a/tests/baselines/reference/parserSymbolProperty8.types +++ b/tests/baselines/reference/parserSymbolProperty8.types @@ -1,6 +1,6 @@ === tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty8.ts === var x: { ->x : {} +>x : { [Symbol.toPrimitive](): string; } [Symbol.toPrimitive](): string >Symbol.toPrimitive : Symbol diff --git a/tests/baselines/reference/parserSymbolProperty9.types b/tests/baselines/reference/parserSymbolProperty9.types index 77746283990..cc3b35d3302 100644 --- a/tests/baselines/reference/parserSymbolProperty9.types +++ b/tests/baselines/reference/parserSymbolProperty9.types @@ -1,6 +1,6 @@ === tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolProperty9.ts === var x: { ->x : {} +>x : { [Symbol.toPrimitive]: string; } [Symbol.toPrimitive]: string >Symbol.toPrimitive : Symbol From 30892af5636b462d2ead50ad334e6db653b51df9 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 28 Jan 2015 16:14:46 -0800 Subject: [PATCH 016/162] Change computed property error message to mention Symbols --- src/compiler/checker.ts | 2 +- .../diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- .../computedPropertyNames14.errors.txt | 24 +++++++++---------- .../computedPropertyNames15.errors.txt | 8 +++---- .../computedPropertyNames17.errors.txt | 24 +++++++++---------- .../computedPropertyNames3.errors.txt | 16 ++++++------- .../computedPropertyNames5.errors.txt | 24 +++++++++---------- .../computedPropertyNames6.errors.txt | 8 +++---- .../computedPropertyNames8.errors.txt | 8 +++---- .../computedPropertyNames9.errors.txt | 4 ++-- .../parserComputedPropertyName41.errors.txt | 4 ++-- 12 files changed, 63 insertions(+), 63 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5a5d5931c27..b59221175e2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5517,7 +5517,7 @@ module ts { // This will allow types number, string, or any. It will also allow enums, the unknown // type, and any union of these types (like string | number). if (!isTypeOfKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike)) { - error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_or_any); + error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_Symbol_or_any); } } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 6c89679a0a0..96a01b89abb 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -300,7 +300,7 @@ module ts { Type_0_is_not_an_array_type: { code: 2461, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type." }, A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: DiagnosticCategory.Error, key: "A rest element must be last in an array destructuring pattern" }, A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: DiagnosticCategory.Error, key: "A binding pattern parameter cannot be optional in an implementation signature." }, - A_computed_property_name_must_be_of_type_string_number_or_any: { code: 2464, category: DiagnosticCategory.Error, key: "A computed property name must be of type 'string', 'number', or 'any'." }, + A_computed_property_name_must_be_of_type_string_number_Symbol_or_any: { code: 2464, category: DiagnosticCategory.Error, key: "A computed property name must be of type 'string', 'number', 'Symbol', or 'any'." }, this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a computed property name." }, super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in a computed property name." }, A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 709750679dc..39328ff7aef 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1193,7 +1193,7 @@ "category": "Error", "code": 2463 }, - "A computed property name must be of type 'string', 'number', or 'any'.": { + "A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.": { "category": "Error", "code": 2464 }, diff --git a/tests/baselines/reference/computedPropertyNames14.errors.txt b/tests/baselines/reference/computedPropertyNames14.errors.txt index 1cf5b1445f2..23d22be0780 100644 --- a/tests/baselines/reference/computedPropertyNames14.errors.txt +++ b/tests/baselines/reference/computedPropertyNames14.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts (6 errors) ==== @@ -11,20 +11,20 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): class C { [b]() {} ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. static [true]() { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. [[]]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. static [{}]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. [undefined]() { } ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. static [null]() { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames15.errors.txt b/tests/baselines/reference/computedPropertyNames15.errors.txt index 0e759668a95..dc0ffb5fe46 100644 --- a/tests/baselines/reference/computedPropertyNames15.errors.txt +++ b/tests/baselines/reference/computedPropertyNames15.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts (2 errors) ==== @@ -10,8 +10,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): [p1]() { } [p2]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. [p3]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames17.errors.txt b/tests/baselines/reference/computedPropertyNames17.errors.txt index b236ae3245e..78ce6d5e433 100644 --- a/tests/baselines/reference/computedPropertyNames17.errors.txt +++ b/tests/baselines/reference/computedPropertyNames17.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts (6 errors) ==== @@ -11,20 +11,20 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): class C { get [b]() { return 0;} ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. static set [true](v) { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. get [[]]() { return 0; } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. set [{}](v) { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. static get [undefined]() { return 0; } ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. set [null](v) { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames3.errors.txt b/tests/baselines/reference/computedPropertyNames3.errors.txt index 080bff1ab9a..23dbcf7d9b1 100644 --- a/tests/baselines/reference/computedPropertyNames3.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (6 errors) ==== @@ -12,19 +12,19 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): [0 + 1]() { } static [() => { }]() { } ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. get [delete id]() { } ~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. set [[0, 1]](v) { } ~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. static get [""]() { } ~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. static set [id.toString()](v) { } } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames5.errors.txt b/tests/baselines/reference/computedPropertyNames5.errors.txt index 2b8cf5503b8..d8fa1d30750 100644 --- a/tests/baselines/reference/computedPropertyNames5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames5.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts (6 errors) ==== @@ -11,20 +11,20 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): e var v = { [b]: 0, ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. [true]: 1, ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. [[]]: 0, ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. [{}]: 0, ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. [undefined]: undefined, ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. [null]: null ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames6.errors.txt b/tests/baselines/reference/computedPropertyNames6.errors.txt index 57798e9f6b6..3ee4387610b 100644 --- a/tests/baselines/reference/computedPropertyNames6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames6.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts (2 errors) ==== @@ -10,8 +10,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): e [p1]: 0, [p2]: 1, ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. [p3]: 2 ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames8.errors.txt b/tests/baselines/reference/computedPropertyNames8.errors.txt index 515af1f4fc4..f45280c517c 100644 --- a/tests/baselines/reference/computedPropertyNames8.errors.txt +++ b/tests/baselines/reference/computedPropertyNames8.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts (2 errors) ==== @@ -9,9 +9,9 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): e var v = { [t]: 0, ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. [u]: 1 ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. }; } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames9.errors.txt b/tests/baselines/reference/computedPropertyNames9.errors.txt index d87576f1f77..ba27c193767 100644 --- a/tests/baselines/reference/computedPropertyNames9.errors.txt +++ b/tests/baselines/reference/computedPropertyNames9.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts (1 errors) ==== @@ -12,5 +12,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): e [f(0)]: 0, [f(true)]: 0 ~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName41.errors.txt b/tests/baselines/reference/parserComputedPropertyName41.errors.txt index 65d4ec8627f..3de11e5218a 100644 --- a/tests/baselines/reference/parserComputedPropertyName41.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName41.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts (1 errors) ==== var v = { [0 in []]: true ~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. } \ No newline at end of file From 9cb38fb5f2cf88fc39773f59454a3664ffbbccfc Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 29 Jan 2015 17:15:57 -0800 Subject: [PATCH 017/162] Create global Symbol type --- src/compiler/checker.ts | 81 +++++++++++++------ .../diagnosticInformationMap.generated.ts | 1 + src/compiler/diagnosticMessages.json | 4 + .../reference/parserForStatement3.errors.txt | 5 +- .../reference/parserForStatement6.errors.txt | 4 +- .../reference/parserForStatement7.errors.txt | 4 +- tests/baselines/reference/symbolProperty1.js | 20 +++++ .../baselines/reference/symbolProperty1.types | 21 +++++ tests/baselines/reference/symbolProperty2.js | 20 +++++ .../baselines/reference/symbolProperty2.types | 22 +++++ .../reference/symbolProperty3.errors.txt | 20 +++++ tests/baselines/reference/symbolProperty3.js | 20 +++++ tests/baselines/reference/symbolProperty4.js | 18 +++++ .../baselines/reference/symbolProperty4.types | 20 +++++ tests/baselines/reference/symbolProperty5.js | 18 +++++ .../baselines/reference/symbolProperty5.types | 23 ++++++ tests/baselines/reference/symbolProperty6.js | 26 ++++++ .../baselines/reference/symbolProperty6.types | 27 +++++++ .../reference/symbolProperty7.errors.txt | 17 ++++ tests/baselines/reference/symbolProperty8.js | 7 ++ .../baselines/reference/symbolProperty8.types | 14 ++++ .../es6/Symbols/symbolProperty1.ts | 9 +++ .../es6/Symbols/symbolProperty2.ts | 9 +++ .../es6/Symbols/symbolProperty3.ts | 9 +++ .../es6/Symbols/symbolProperty4.ts | 8 ++ .../es6/Symbols/symbolProperty5.ts | 8 ++ .../es6/Symbols/symbolProperty6.ts | 9 +++ .../es6/Symbols/symbolProperty7.ts | 9 +++ .../es6/Symbols/symbolProperty8.ts | 5 ++ 29 files changed, 427 insertions(+), 31 deletions(-) create mode 100644 tests/baselines/reference/symbolProperty1.js create mode 100644 tests/baselines/reference/symbolProperty1.types create mode 100644 tests/baselines/reference/symbolProperty2.js create mode 100644 tests/baselines/reference/symbolProperty2.types create mode 100644 tests/baselines/reference/symbolProperty3.errors.txt create mode 100644 tests/baselines/reference/symbolProperty3.js create mode 100644 tests/baselines/reference/symbolProperty4.js create mode 100644 tests/baselines/reference/symbolProperty4.types create mode 100644 tests/baselines/reference/symbolProperty5.js create mode 100644 tests/baselines/reference/symbolProperty5.types create mode 100644 tests/baselines/reference/symbolProperty6.js create mode 100644 tests/baselines/reference/symbolProperty6.types create mode 100644 tests/baselines/reference/symbolProperty7.errors.txt create mode 100644 tests/baselines/reference/symbolProperty8.js create mode 100644 tests/baselines/reference/symbolProperty8.types create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty1.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty2.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty3.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty4.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty5.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty6.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty7.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty8.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b59221175e2..7e652f30c62 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -84,6 +84,7 @@ module ts { var globals: SymbolTable = {}; var globalArraySymbol: Symbol; + var globalESSymbolConstructorSymbol: Symbol; var globalObjectType: ObjectType; var globalFunctionType: ObjectType; @@ -93,6 +94,8 @@ module ts { var globalBooleanType: ObjectType; var globalRegExpType: ObjectType; var globalTemplateStringsArrayType: ObjectType; + var globalESSymbolType: ObjectType; + var globalESSymbolConstructorType: ObjectType; var anyArrayType: Type; @@ -3005,12 +3008,20 @@ module ts { return type; } - function getGlobalSymbol(name: string): Symbol { - return resolveName(undefined, name, SymbolFlags.Type, Diagnostics.Cannot_find_global_type_0, name); + function getGlobalValueSymbol(name: string): Symbol { + return getGlobalSymbol(name, SymbolFlags.Value, Diagnostics.Cannot_find_global_value_0); + } + + function getGlobalTypeSymbol(name: string): Symbol { + return getGlobalSymbol(name, SymbolFlags.Type, Diagnostics.Cannot_find_global_type_0); + } + + function getGlobalSymbol(name: string, meaning: SymbolFlags, diagnostic: DiagnosticMessage): Symbol { + return resolveName(undefined, name, meaning, diagnostic, name); } function getGlobalType(name: string): ObjectType { - return getTypeOfGlobalSymbol(getGlobalSymbol(name), 0); + return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), 0); } function createArrayType(elementType: Type): Type { @@ -5481,7 +5492,7 @@ module ts { function isNumericComputedName(name: ComputedPropertyName): boolean { // It seems odd to consider an expression of type Any to result in a numeric name, // but this behavior is consistent with checkIndexedAccess - return isTypeOfKind(checkComputedPropertyName(name), TypeFlags.Any | TypeFlags.NumberLike); + return isTypeOfKind(checkComputedPropertyName(name), TypeFlags.Any | TypeFlags.NumberLike, /*includeESSymbols*/ false); } function isNumericLiteralName(name: string) { @@ -5514,9 +5525,9 @@ module ts { if (!links.resolvedType) { links.resolvedType = checkExpression(node.expression); - // This will allow types number, string, or any. It will also allow enums, the unknown + // This will allow types number, string, Symbol or any. It will also allow enums, the unknown // type, and any union of these types (like string | number). - if (!isTypeOfKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike)) { + if (!isTypeOfKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike, /*includeESSymbols*/ true)) { error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_Symbol_or_any); } } @@ -5781,10 +5792,10 @@ module ts { } // Check for compatible indexer types. - if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike)) { + if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike, /*includeESSymbols*/ true)) { // Try to use a number indexer. - if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.NumberLike)) { + if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.NumberLike, /*includeESSymbols*/ false)) { var numberIndexType = getIndexTypeOfType(objectType, IndexKind.Number); if (numberIndexType) { return numberIndexType; @@ -6722,7 +6733,7 @@ module ts { } function checkArithmeticOperandType(operand: Node, type: Type, diagnostic: DiagnosticMessage): boolean { - if (!isTypeOfKind(type, TypeFlags.Any | TypeFlags.NumberLike)) { + if (!isTypeOfKind(type, TypeFlags.Any | TypeFlags.NumberLike, /*includeESSymbols*/ false)) { error(operand, diagnostic); return false; } @@ -6874,19 +6885,28 @@ module ts { } // Return true if type has the given flags, or is a union type composed of types that all have those flags - function isTypeOfKind(type: Type, kind: TypeFlags): boolean { + // If include includeESSymbols is true, then check if the type (or union constituents) is an ESSymbol + // if it does not match the kind. This is necessary because ESSymbol has no corresponding flag. + function isTypeOfKind(type: Type, kind: TypeFlags, includeESSymbols: boolean): boolean { if (type.flags & kind) { return true; } if (type.flags & TypeFlags.Union) { var types = (type).types; for (var i = 0; i < types.length; i++) { - if (!(types[i].flags & kind)) { - return false; + if (types[i].flags & kind) { + continue; } + if (includeESSymbols && types[i] === globalESSymbolType) { + continue; + } + return false; } return true; } + if (includeESSymbols) { + return type === globalESSymbolType; + } return false; } @@ -6904,7 +6924,11 @@ module ts { // and the right operand to be of type Any or a subtype of the 'Function' interface type. // The result is always of the Boolean primitive type. // NOTE: do not raise error if leftType is unknown as related error was already reported - if (isTypeOfKind(leftType, TypeFlags.Primitive)) { + // + // The reason for globalESSymbolType !== unknownType is that if the type is unknownType, we don't want to error. + // If the globalESSymbolType is also unknownType, then by including globalESSymbolType, we will error + // on unknownType, because transitively, type will be the same as globalESSymbolType. + if (isTypeOfKind(leftType, TypeFlags.Primitive, /*includeESSymbols*/ globalESSymbolType !== unknownType)) { error(node.left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported @@ -6919,10 +6943,10 @@ module ts { // The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type, // and the right operand to be of type Any, an object type, or a type parameter type. // The result is always of the Boolean primitive type. - if (!isTypeOfKind(leftType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike)) { + if (!isTypeOfKind(leftType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike, /*includeESSymbols*/ true)) { error(node.left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number); } - if (!isTypeOfKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { + if (!isTypeOfKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter, /*includeESSymbols*/ false)) { error(node.right, Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; @@ -7083,12 +7107,12 @@ module ts { if (rightType.flags & (TypeFlags.Undefined | TypeFlags.Null)) rightType = leftType; var resultType: Type; - if (isTypeOfKind(leftType, TypeFlags.NumberLike) && isTypeOfKind(rightType, TypeFlags.NumberLike)) { + if (isTypeOfKind(leftType, TypeFlags.NumberLike, /*includeESSymbols*/ false) && isTypeOfKind(rightType, TypeFlags.NumberLike, /*includeESSymbols*/ false)) { // Operands of an enum type are treated as having the primitive type Number. // If both operands are of the Number primitive type, the result is of the Number primitive type. resultType = numberType; } - else if (isTypeOfKind(leftType, TypeFlags.StringLike) || isTypeOfKind(rightType, TypeFlags.StringLike)) { + else if (isTypeOfKind(leftType, TypeFlags.StringLike, /*includeESSymbols*/ false) || isTypeOfKind(rightType, TypeFlags.StringLike, /*includeESSymbols*/ false)) { // If one or both operands are of the String primitive type, the result is of the String primitive type. resultType = stringType; } @@ -8454,7 +8478,7 @@ module ts { // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var exprType = checkExpression(varExpr); - if (exprType !== anyType && exprType !== stringType) { + if (!isTypeOfKind(exprType, TypeFlags.Any | TypeFlags.StringLike, /*includeESSymbols*/ true)) { error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { @@ -8466,7 +8490,7 @@ module ts { var exprType = checkExpression(node.expression); // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one - if (!isTypeOfKind(exprType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { + if (!isTypeOfKind(exprType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter, /*includeESSymbols*/ false)) { error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } @@ -10251,7 +10275,7 @@ module ts { getSymbolLinks(unknownSymbol).type = unknownType; globals[undefinedSymbol.name] = undefinedSymbol; // Initialize special types - globalArraySymbol = getGlobalSymbol("Array"); + globalArraySymbol = getGlobalTypeSymbol("Array"); globalArrayType = getTypeOfGlobalSymbol(globalArraySymbol, 1); globalObjectType = getGlobalType("Object"); globalFunctionType = getGlobalType("Function"); @@ -10259,11 +10283,22 @@ module ts { globalNumberType = getGlobalType("Number"); globalBooleanType = getGlobalType("Boolean"); globalRegExpType = getGlobalType("RegExp"); + // If we're in ES6 mode, load the TemplateStringsArray. // Otherwise, default to 'unknown' for the purposes of type checking in LS scenarios. - globalTemplateStringsArrayType = languageVersion >= ScriptTarget.ES6 - ? getGlobalType("TemplateStringsArray") - : unknownType; + if (languageVersion >= ScriptTarget.ES6) { + globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); + globalESSymbolType = getGlobalType("Symbol"); + globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); + globalESSymbolConstructorType = getTypeOfGlobalSymbol(globalESSymbolConstructorSymbol, /*arity*/ 0); + } + else { + globalTemplateStringsArrayType = unknownType; + globalESSymbolType = unknownType; + globalESSymbolConstructorSymbol = unknownSymbol; + globalESSymbolConstructorType = unknownType; + } + anyArrayType = createArrayType(anyType); } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 96a01b89abb..0955702fe02 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -304,6 +304,7 @@ module ts { this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a computed property name." }, super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in a computed property name." }, A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." }, + Cannot_find_global_value_0: { code: 2468, category: DiagnosticCategory.Error, key: "Cannot find global value '{0}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 39328ff7aef..581f8a5cafe 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1209,6 +1209,10 @@ "category": "Error", "code": 2466 }, + "Cannot find global value '{0}'.": { + "category": "Error", + "code": 2468 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/tests/baselines/reference/parserForStatement3.errors.txt b/tests/baselines/reference/parserForStatement3.errors.txt index 533958505c1..06c3f083d45 100644 --- a/tests/baselines/reference/parserForStatement3.errors.txt +++ b/tests/baselines/reference/parserForStatement3.errors.txt @@ -1,5 +1,4 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,5): error TS2304: Cannot find name 'd'. -tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,5): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,10): error TS2304: Cannot find name '_'. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,15): error TS2304: Cannot find name 'a'. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,18): error TS2304: Cannot find name '_'. @@ -7,12 +6,10 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,2 tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts(1,30): error TS2304: Cannot find name 'b'. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts (7 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement3.ts (6 errors) ==== for(d in _.jh[a]=_.jh[a]||[],b); ~ !!! error TS2304: Cannot find name 'd'. - ~ -!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. ~ !!! error TS2304: Cannot find name '_'. ~ diff --git a/tests/baselines/reference/parserForStatement6.errors.txt b/tests/baselines/reference/parserForStatement6.errors.txt index a098141c81b..a41f103e929 100644 --- a/tests/baselines/reference/parserForStatement6.errors.txt +++ b/tests/baselines/reference/parserForStatement6.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,6): error TS2304: Cannot find name 'foo'. -tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,6): error TS2406: Invalid left-hand side in 'for...in' statement. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,15): error TS2304: Cannot find name 'b'. @@ -8,7 +8,7 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement6.ts(1,1 ~~~ !!! error TS2304: Cannot find name 'foo'. ~~~~~ -!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +!!! error TS2406: Invalid left-hand side in 'for...in' statement. ~ !!! error TS2304: Cannot find name 'b'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForStatement7.errors.txt b/tests/baselines/reference/parserForStatement7.errors.txt index da1f1ce6808..3aa67480105 100644 --- a/tests/baselines/reference/parserForStatement7.errors.txt +++ b/tests/baselines/reference/parserForStatement7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,6): error TS2406: Invalid left-hand side in 'for...in' statement. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,10): error TS2304: Cannot find name 'foo'. tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,19): error TS2304: Cannot find name 'b'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts(1,1 ==== tests/cases/conformance/parser/ecmascript5/Statements/parserForStatement7.ts (3 errors) ==== for (new foo() in b) { ~~~~~~~~~ -!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +!!! error TS2406: Invalid left-hand side in 'for...in' statement. ~~~ !!! error TS2304: Cannot find name 'foo'. ~ diff --git a/tests/baselines/reference/symbolProperty1.js b/tests/baselines/reference/symbolProperty1.js new file mode 100644 index 00000000000..e5189d0c88f --- /dev/null +++ b/tests/baselines/reference/symbolProperty1.js @@ -0,0 +1,20 @@ +//// [symbolProperty1.ts] +var s: Symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} + +//// [symbolProperty1.js] +var s; +var x = { + [s]: 0, + [s]() { + }, + get [s]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty1.types b/tests/baselines/reference/symbolProperty1.types new file mode 100644 index 00000000000..9c24051449e --- /dev/null +++ b/tests/baselines/reference/symbolProperty1.types @@ -0,0 +1,21 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty1.ts === +var s: Symbol; +>s : Symbol +>Symbol : Symbol + +var x = { +>x : {} +>{ [s]: 0, [s]() { }, get [s]() { return 0; }} : {} + + [s]: 0, +>s : Symbol + + [s]() { }, +>s : Symbol + + get [s]() { +>s : Symbol + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty2.js b/tests/baselines/reference/symbolProperty2.js new file mode 100644 index 00000000000..5c0f89b0257 --- /dev/null +++ b/tests/baselines/reference/symbolProperty2.js @@ -0,0 +1,20 @@ +//// [symbolProperty2.ts] +var s = Symbol(); +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} + +//// [symbolProperty2.js] +var s = Symbol(); +var x = { + [s]: 0, + [s]() { + }, + get [s]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty2.types b/tests/baselines/reference/symbolProperty2.types new file mode 100644 index 00000000000..d45ff4584f6 --- /dev/null +++ b/tests/baselines/reference/symbolProperty2.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty2.ts === +var s = Symbol(); +>s : Symbol +>Symbol() : Symbol +>Symbol : SymbolConstructor + +var x = { +>x : {} +>{ [s]: 0, [s]() { }, get [s]() { return 0; }} : {} + + [s]: 0, +>s : Symbol + + [s]() { }, +>s : Symbol + + get [s]() { +>s : Symbol + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty3.errors.txt b/tests/baselines/reference/symbolProperty3.errors.txt new file mode 100644 index 00000000000..44c75a3ef7b --- /dev/null +++ b/tests/baselines/reference/symbolProperty3.errors.txt @@ -0,0 +1,20 @@ +tests/cases/conformance/es6/Symbols/symbolProperty3.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/Symbols/symbolProperty3.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/Symbols/symbolProperty3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty3.ts (3 errors) ==== + var s = Symbol; + var x = { + [s]: 0, + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. + [s]() { }, + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. + get [s]() { + ~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty3.js b/tests/baselines/reference/symbolProperty3.js new file mode 100644 index 00000000000..6159b10f9f3 --- /dev/null +++ b/tests/baselines/reference/symbolProperty3.js @@ -0,0 +1,20 @@ +//// [symbolProperty3.ts] +var s = Symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} + +//// [symbolProperty3.js] +var s = Symbol; +var x = { + [s]: 0, + [s]() { + }, + get [s]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty4.js b/tests/baselines/reference/symbolProperty4.js new file mode 100644 index 00000000000..be7cdab5f85 --- /dev/null +++ b/tests/baselines/reference/symbolProperty4.js @@ -0,0 +1,18 @@ +//// [symbolProperty4.ts] +var x = { + [Symbol()]: 0, + [Symbol()]() { }, + get [Symbol()]() { + return 0; + } +} + +//// [symbolProperty4.js] +var x = { + [Symbol()]: 0, + [Symbol()]() { + }, + get [Symbol()]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty4.types b/tests/baselines/reference/symbolProperty4.types new file mode 100644 index 00000000000..af3d7a85590 --- /dev/null +++ b/tests/baselines/reference/symbolProperty4.types @@ -0,0 +1,20 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty4.ts === +var x = { +>x : {} +>{ [Symbol()]: 0, [Symbol()]() { }, get [Symbol()]() { return 0; }} : {} + + [Symbol()]: 0, +>Symbol() : Symbol +>Symbol : SymbolConstructor + + [Symbol()]() { }, +>Symbol() : Symbol +>Symbol : SymbolConstructor + + get [Symbol()]() { +>Symbol() : Symbol +>Symbol : SymbolConstructor + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty5.js b/tests/baselines/reference/symbolProperty5.js new file mode 100644 index 00000000000..9f0ff3d688f --- /dev/null +++ b/tests/baselines/reference/symbolProperty5.js @@ -0,0 +1,18 @@ +//// [symbolProperty5.ts] +var x = { + [Symbol.iterator]: 0, + [Symbol.isRegExp]() { }, + get [Symbol.toStringTag]() { + return 0; + } +} + +//// [symbolProperty5.js] +var x = { + [Symbol.iterator]: 0, + [Symbol.isRegExp]() { + }, + get [Symbol.toStringTag]() { + return 0; + } +}; diff --git a/tests/baselines/reference/symbolProperty5.types b/tests/baselines/reference/symbolProperty5.types new file mode 100644 index 00000000000..d39025ae85b --- /dev/null +++ b/tests/baselines/reference/symbolProperty5.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty5.ts === +var x = { +>x : { [Symbol.iterator]: number; [Symbol.isRegExp](): void; [Symbol.toStringTag]: number; } +>{ [Symbol.iterator]: 0, [Symbol.isRegExp]() { }, get [Symbol.toStringTag]() { return 0; }} : { [Symbol.iterator]: number; [Symbol.isRegExp](): void; [Symbol.toStringTag]: number; } + + [Symbol.iterator]: 0, +>Symbol.iterator : Symbol +>Symbol : SymbolConstructor +>iterator : Symbol + + [Symbol.isRegExp]() { }, +>Symbol.isRegExp : Symbol +>Symbol : SymbolConstructor +>isRegExp : Symbol + + get [Symbol.toStringTag]() { +>Symbol.toStringTag : Symbol +>Symbol : SymbolConstructor +>toStringTag : Symbol + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty6.js b/tests/baselines/reference/symbolProperty6.js new file mode 100644 index 00000000000..114999dc873 --- /dev/null +++ b/tests/baselines/reference/symbolProperty6.js @@ -0,0 +1,26 @@ +//// [symbolProperty6.ts] +class C { + [Symbol.iterator] = 0; + [Symbol.unscopables]: number; + [Symbol.isRegExp]() { } + get [Symbol.toStringTag]() { + return 0; + } +} + +//// [symbolProperty6.js] +var C = (function () { + function C() { + this[Symbol.iterator] = 0; + } + C.prototype[Symbol.isRegExp] = function () { + }; + Object.defineProperty(C.prototype, Symbol.toStringTag, { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty6.types b/tests/baselines/reference/symbolProperty6.types new file mode 100644 index 00000000000..703ef4506a8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty6.types @@ -0,0 +1,27 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty6.ts === +class C { +>C : C + + [Symbol.iterator] = 0; +>Symbol.iterator : Symbol +>Symbol : SymbolConstructor +>iterator : Symbol + + [Symbol.unscopables]: number; +>Symbol.unscopables : Symbol +>Symbol : SymbolConstructor +>unscopables : Symbol + + [Symbol.isRegExp]() { } +>Symbol.isRegExp : Symbol +>Symbol : SymbolConstructor +>isRegExp : Symbol + + get [Symbol.toStringTag]() { +>Symbol.toStringTag : Symbol +>Symbol : SymbolConstructor +>toStringTag : Symbol + + return 0; + } +} diff --git a/tests/baselines/reference/symbolProperty7.errors.txt b/tests/baselines/reference/symbolProperty7.errors.txt new file mode 100644 index 00000000000..0fe3597a10e --- /dev/null +++ b/tests/baselines/reference/symbolProperty7.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/Symbols/symbolProperty7.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/es6/Symbols/symbolProperty7.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty7.ts (2 errors) ==== + class C { + [Symbol()] = 0; + ~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. + [Symbol()]: number; + ~~~~~~~~~~ +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. + [Symbol()]() { } + get [Symbol()]() { + return 0; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty8.js b/tests/baselines/reference/symbolProperty8.js new file mode 100644 index 00000000000..6f3ec6cfa26 --- /dev/null +++ b/tests/baselines/reference/symbolProperty8.js @@ -0,0 +1,7 @@ +//// [symbolProperty8.ts] +interface I { + [Symbol.unscopables]: number; + [Symbol.isRegExp](); +} + +//// [symbolProperty8.js] diff --git a/tests/baselines/reference/symbolProperty8.types b/tests/baselines/reference/symbolProperty8.types new file mode 100644 index 00000000000..d1bab0615ed --- /dev/null +++ b/tests/baselines/reference/symbolProperty8.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty8.ts === +interface I { +>I : I + + [Symbol.unscopables]: number; +>Symbol.unscopables : Symbol +>Symbol : SymbolConstructor +>unscopables : Symbol + + [Symbol.isRegExp](); +>Symbol.isRegExp : Symbol +>Symbol : SymbolConstructor +>isRegExp : Symbol +} diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty1.ts b/tests/cases/conformance/es6/Symbols/symbolProperty1.ts new file mode 100644 index 00000000000..033f1b5cbda --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty1.ts @@ -0,0 +1,9 @@ +//@target: ES6 +var s: Symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty2.ts b/tests/cases/conformance/es6/Symbols/symbolProperty2.ts new file mode 100644 index 00000000000..44a2ba13874 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty2.ts @@ -0,0 +1,9 @@ +//@target: ES6 +var s = Symbol(); +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty3.ts b/tests/cases/conformance/es6/Symbols/symbolProperty3.ts new file mode 100644 index 00000000000..027e93a86ad --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty3.ts @@ -0,0 +1,9 @@ +//@target: ES6 +var s = Symbol; +var x = { + [s]: 0, + [s]() { }, + get [s]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty4.ts b/tests/cases/conformance/es6/Symbols/symbolProperty4.ts new file mode 100644 index 00000000000..b6079bb31b3 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty4.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var x = { + [Symbol()]: 0, + [Symbol()]() { }, + get [Symbol()]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty5.ts b/tests/cases/conformance/es6/Symbols/symbolProperty5.ts new file mode 100644 index 00000000000..84cb12a9de8 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty5.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var x = { + [Symbol.iterator]: 0, + [Symbol.isRegExp]() { }, + get [Symbol.toStringTag]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty6.ts b/tests/cases/conformance/es6/Symbols/symbolProperty6.ts new file mode 100644 index 00000000000..ff17b977c38 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty6.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { + [Symbol.iterator] = 0; + [Symbol.unscopables]: number; + [Symbol.isRegExp]() { } + get [Symbol.toStringTag]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty7.ts b/tests/cases/conformance/es6/Symbols/symbolProperty7.ts new file mode 100644 index 00000000000..972e96c282b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty7.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { + [Symbol()] = 0; + [Symbol()]: number; + [Symbol()]() { } + get [Symbol()]() { + return 0; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty8.ts b/tests/cases/conformance/es6/Symbols/symbolProperty8.ts new file mode 100644 index 00000000000..14b4a32688f --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty8.ts @@ -0,0 +1,5 @@ +//@target: ES6 +interface I { + [Symbol.unscopables]: number; + [Symbol.isRegExp](); +} \ No newline at end of file From 25fcbe2f9ec163da94fef1cfd2251d27c74333e0 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 29 Jan 2015 19:17:16 -0800 Subject: [PATCH 018/162] Change certain hasDynamicName checks to check the SyntaxKind instead --- src/compiler/checker.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7e652f30c62..68d41199de2 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -7243,7 +7243,7 @@ module ts { } function checkPropertyAssignment(node: PropertyAssignment, contextualMapper?: TypeMapper): Type { - if (hasDynamicName(node)) { + if (node.name.kind === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.name); } @@ -7254,7 +7254,7 @@ module ts { // Grammar checking checkGrammarMethod(node); - if (hasDynamicName(node)) { + if (node.name.kind === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.name); } @@ -8066,12 +8066,13 @@ module ts { function checkFunctionLikeDeclaration(node: FunctionLikeDeclaration): void { checkSignatureDeclaration(node); - if (hasDynamicName(node)) { + if (node.name.kind === SyntaxKind.ComputedPropertyName) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals checkComputedPropertyName(node.name); } - else { + + if (!hasDynamicName(node)) { // first we want to check the local symbol that contain this declaration // - if node.localSymbol !== undefined - this is current declaration is exported and localSymbol points to the local symbol // - if node.localSymbol === undefined - this node is non-exported so we can just pick the result of getSymbolOfNode @@ -8300,12 +8301,11 @@ module ts { function checkVariableLikeDeclaration(node: VariableLikeDeclaration) { checkSourceElement(node.type); // For a computed property, just check the initializer and exit - if (hasDynamicName(node)) { + if (node.name.kind === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.name); if (node.initializer) { checkExpressionCached(node.initializer); } - return; } // For a binding pattern, check contained binding elements if (isBindingPattern(node.name)) { From b60fa1467f94da0566d94bebec061a5cd28f35b9 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Fri, 30 Jan 2015 14:57:51 -0800 Subject: [PATCH 019/162] Add tests for operators with symbol operand --- .../reference/symbolType1.errors.txt | 11 ++++ tests/baselines/reference/symbolType1.js | 7 +++ .../reference/symbolType10.errors.txt | 34 ++++++++++++ tests/baselines/reference/symbolType10.js | 16 ++++++ tests/baselines/reference/symbolType11.js | 17 ++++++ tests/baselines/reference/symbolType12.js | 55 +++++++++++++++++++ tests/baselines/reference/symbolType13.js | 17 ++++++ tests/baselines/reference/symbolType2.js | 7 +++ tests/baselines/reference/symbolType3.js | 23 ++++++++ .../reference/symbolType4.errors.txt | 12 ++++ tests/baselines/reference/symbolType4.js | 9 +++ .../reference/symbolType5.errors.txt | 34 ++++++++++++ tests/baselines/reference/symbolType5.js | 16 ++++++ tests/baselines/reference/symbolType6.js | 21 +++++++ .../reference/symbolType7.errors.txt | 37 +++++++++++++ tests/baselines/reference/symbolType7.js | 17 ++++++ tests/baselines/reference/symbolType8.js | 21 +++++++ tests/baselines/reference/symbolType9.js | 21 +++++++ tests/baselines/reference/symbolType9.types | 44 +++++++++++++++ .../conformance/es6/Symbols/symbolType1.ts | 3 + .../conformance/es6/Symbols/symbolType10.ts | 8 +++ .../conformance/es6/Symbols/symbolType11.ts | 8 +++ .../conformance/es6/Symbols/symbolType12.ts | 27 +++++++++ .../conformance/es6/Symbols/symbolType13.ts | 7 +++ .../conformance/es6/Symbols/symbolType2.ts | 3 + .../conformance/es6/Symbols/symbolType3.ts | 11 ++++ .../conformance/es6/Symbols/symbolType4.ts | 4 ++ .../conformance/es6/Symbols/symbolType5.ts | 8 +++ .../conformance/es6/Symbols/symbolType6.ts | 10 ++++ .../conformance/es6/Symbols/symbolType7.ts | 8 +++ .../conformance/es6/Symbols/symbolType8.ts | 10 ++++ .../conformance/es6/Symbols/symbolType9.ts | 10 ++++ 32 files changed, 536 insertions(+) create mode 100644 tests/baselines/reference/symbolType1.errors.txt create mode 100644 tests/baselines/reference/symbolType1.js create mode 100644 tests/baselines/reference/symbolType10.errors.txt create mode 100644 tests/baselines/reference/symbolType10.js create mode 100644 tests/baselines/reference/symbolType11.js create mode 100644 tests/baselines/reference/symbolType12.js create mode 100644 tests/baselines/reference/symbolType13.js create mode 100644 tests/baselines/reference/symbolType2.js create mode 100644 tests/baselines/reference/symbolType3.js create mode 100644 tests/baselines/reference/symbolType4.errors.txt create mode 100644 tests/baselines/reference/symbolType4.js create mode 100644 tests/baselines/reference/symbolType5.errors.txt create mode 100644 tests/baselines/reference/symbolType5.js create mode 100644 tests/baselines/reference/symbolType6.js create mode 100644 tests/baselines/reference/symbolType7.errors.txt create mode 100644 tests/baselines/reference/symbolType7.js create mode 100644 tests/baselines/reference/symbolType8.js create mode 100644 tests/baselines/reference/symbolType9.js create mode 100644 tests/baselines/reference/symbolType9.types create mode 100644 tests/cases/conformance/es6/Symbols/symbolType1.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolType10.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolType11.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolType12.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolType13.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolType2.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolType3.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolType4.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolType5.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolType6.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolType7.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolType8.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolType9.ts diff --git a/tests/baselines/reference/symbolType1.errors.txt b/tests/baselines/reference/symbolType1.errors.txt new file mode 100644 index 00000000000..db535f57625 --- /dev/null +++ b/tests/baselines/reference/symbolType1.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/Symbols/symbolType1.ts(1,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. +tests/cases/conformance/es6/Symbols/symbolType1.ts(2,19): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. + + +==== tests/cases/conformance/es6/Symbols/symbolType1.ts (2 errors) ==== + Symbol() instanceof Symbol; + ~~~~~~~~ +!!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. + Symbol instanceof Symbol(); + ~~~~~~~~ +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType1.js b/tests/baselines/reference/symbolType1.js new file mode 100644 index 00000000000..a3b00871c4e --- /dev/null +++ b/tests/baselines/reference/symbolType1.js @@ -0,0 +1,7 @@ +//// [symbolType1.ts] +Symbol() instanceof Symbol; +Symbol instanceof Symbol(); + +//// [symbolType1.js] +Symbol() instanceof Symbol; +Symbol instanceof Symbol(); diff --git a/tests/baselines/reference/symbolType10.errors.txt b/tests/baselines/reference/symbolType10.errors.txt new file mode 100644 index 00000000000..852f863bae8 --- /dev/null +++ b/tests/baselines/reference/symbolType10.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/es6/Symbols/symbolType10.ts(2,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(2,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(3,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(3,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(4,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType10.ts(7,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es6/Symbols/symbolType10.ts (8 errors) ==== + var s = Symbol.for("bitwise"); + s & s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s | s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s ^ s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + s & 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 0 | s; + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType10.js b/tests/baselines/reference/symbolType10.js new file mode 100644 index 00000000000..378479fb70f --- /dev/null +++ b/tests/baselines/reference/symbolType10.js @@ -0,0 +1,16 @@ +//// [symbolType10.ts] +var s = Symbol.for("bitwise"); +s & s; +s | s; +s ^ s; + +s & 0; +0 | s; + +//// [symbolType10.js] +var s = Symbol.for("bitwise"); +s & s; +s | s; +s ^ s; +s & 0; +0 | s; diff --git a/tests/baselines/reference/symbolType11.js b/tests/baselines/reference/symbolType11.js new file mode 100644 index 00000000000..3328be28d15 --- /dev/null +++ b/tests/baselines/reference/symbolType11.js @@ -0,0 +1,17 @@ +//// [symbolType11.ts] +var s = Symbol.for("logical"); +s && s; +s && []; +0 && s; +s || s; +s || 1; +({}) || s; + +//// [symbolType11.js] +var s = Symbol.for("logical"); +s && s; +s && []; +0 && s; +s || s; +s || 1; +({}) || s; diff --git a/tests/baselines/reference/symbolType12.js b/tests/baselines/reference/symbolType12.js new file mode 100644 index 00000000000..05d7fa03eb6 --- /dev/null +++ b/tests/baselines/reference/symbolType12.js @@ -0,0 +1,55 @@ +//// [symbolType12.ts] +var s = Symbol.for("assign"); +var str = ""; +s *= s; +s *= 0; +s /= s; +s /= 0; +s %= s; +s %= 0; +s += s; +s += 0; +s += ""; +str += s; +s -= s; +s -= 0; +s <<= s; +s <<= 0; +s >>= s; +s >>= 0; +s >>>= s; +s >>>= 0; +s &= s; +s &= 0; +s ^= s; +s ^= 0; +s |= s; +s |= 0; + +//// [symbolType12.js] +var s = Symbol.for("assign"); +var str = ""; +s *= s; +s *= 0; +s /= s; +s /= 0; +s %= s; +s %= 0; +s += s; +s += 0; +s += ""; +str += s; +s -= s; +s -= 0; +s <<= s; +s <<= 0; +s >>= s; +s >>= 0; +s >>>= s; +s >>>= 0; +s &= s; +s &= 0; +s ^= s; +s ^= 0; +s |= s; +s |= 0; diff --git a/tests/baselines/reference/symbolType13.js b/tests/baselines/reference/symbolType13.js new file mode 100644 index 00000000000..56aef2cc8e6 --- /dev/null +++ b/tests/baselines/reference/symbolType13.js @@ -0,0 +1,17 @@ +//// [symbolType13.ts] +var s = Symbol(); +var x: any; + +for (s in {}) { } +for (x in s) { } +for (var y in s) { } + +//// [symbolType13.js] +var s = Symbol(); +var x; +for (s in {}) { +} +for (x in s) { +} +for (var y in s) { +} diff --git a/tests/baselines/reference/symbolType2.js b/tests/baselines/reference/symbolType2.js new file mode 100644 index 00000000000..e15e4da626e --- /dev/null +++ b/tests/baselines/reference/symbolType2.js @@ -0,0 +1,7 @@ +//// [symbolType2.ts] +Symbol.isConcatSpreadable in {}; +"" in Symbol.toPrimitive; + +//// [symbolType2.js] +Symbol.isConcatSpreadable in {}; +"" in Symbol.toPrimitive; diff --git a/tests/baselines/reference/symbolType3.js b/tests/baselines/reference/symbolType3.js new file mode 100644 index 00000000000..088449a3a89 --- /dev/null +++ b/tests/baselines/reference/symbolType3.js @@ -0,0 +1,23 @@ +//// [symbolType3.ts] +var s = Symbol(); +delete Symbol.iterator; +void Symbol.toPrimitive; +typeof Symbol.toStringTag; +++s; +--s; ++ Symbol(); +- Symbol(); +~ Symbol(); +! Symbol(); + +//// [symbolType3.js] +var s = Symbol(); +delete Symbol.iterator; +void Symbol.toPrimitive; +typeof Symbol.toStringTag; +++s; +--s; ++Symbol(); +-Symbol(); +~Symbol(); +!Symbol(); diff --git a/tests/baselines/reference/symbolType4.errors.txt b/tests/baselines/reference/symbolType4.errors.txt new file mode 100644 index 00000000000..210fe94b8d7 --- /dev/null +++ b/tests/baselines/reference/symbolType4.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/Symbols/symbolType4.ts(2,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType4.ts(3,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es6/Symbols/symbolType4.ts (2 errors) ==== + var s = Symbol.for("postfix"); + s++; + ~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + s--; + ~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType4.js b/tests/baselines/reference/symbolType4.js new file mode 100644 index 00000000000..321de5a3bf9 --- /dev/null +++ b/tests/baselines/reference/symbolType4.js @@ -0,0 +1,9 @@ +//// [symbolType4.ts] +var s = Symbol.for("postfix"); +s++; +s--; + +//// [symbolType4.js] +var s = Symbol.for("postfix"); +s++; +s--; diff --git a/tests/baselines/reference/symbolType5.errors.txt b/tests/baselines/reference/symbolType5.errors.txt new file mode 100644 index 00000000000..af70aad0f26 --- /dev/null +++ b/tests/baselines/reference/symbolType5.errors.txt @@ -0,0 +1,34 @@ +tests/cases/conformance/es6/Symbols/symbolType5.ts(2,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(2,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(3,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(3,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(4,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType5.ts(7,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es6/Symbols/symbolType5.ts (8 errors) ==== + var s = Symbol.for("multiply"); + s * s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s / s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s % s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + s * 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 0 / s; + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType5.js b/tests/baselines/reference/symbolType5.js new file mode 100644 index 00000000000..ce76e034bd9 --- /dev/null +++ b/tests/baselines/reference/symbolType5.js @@ -0,0 +1,16 @@ +//// [symbolType5.ts] +var s = Symbol.for("multiply"); +s * s; +s / s; +s % s; + +s * 0; +0 / s; + +//// [symbolType5.js] +var s = Symbol.for("multiply"); +s * s; +s / s; +s % s; +s * 0; +0 / s; diff --git a/tests/baselines/reference/symbolType6.js b/tests/baselines/reference/symbolType6.js new file mode 100644 index 00000000000..ad16baa28b4 --- /dev/null +++ b/tests/baselines/reference/symbolType6.js @@ -0,0 +1,21 @@ +//// [symbolType6.ts] +var s = Symbol.for("add"); +s + s; +s - s; +s + ""; +s + 0; +"" + s; +0 + s; +s - 0; +0 - s; + +//// [symbolType6.js] +var s = Symbol.for("add"); +s + s; +s - s; +s + ""; +s + 0; +"" + s; +0 + s; +s - 0; +0 - s; diff --git a/tests/baselines/reference/symbolType7.errors.txt b/tests/baselines/reference/symbolType7.errors.txt new file mode 100644 index 00000000000..80ecd2486ff --- /dev/null +++ b/tests/baselines/reference/symbolType7.errors.txt @@ -0,0 +1,37 @@ +tests/cases/conformance/es6/Symbols/symbolType7.ts(2,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(2,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(3,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(4,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(5,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(6,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType7.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + +==== tests/cases/conformance/es6/Symbols/symbolType7.ts (9 errors) ==== + var s = Symbol.for("shift"); + s << s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s << 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >> s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >> 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >>> s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >>> 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType7.js b/tests/baselines/reference/symbolType7.js new file mode 100644 index 00000000000..47ace567a3d --- /dev/null +++ b/tests/baselines/reference/symbolType7.js @@ -0,0 +1,17 @@ +//// [symbolType7.ts] +var s = Symbol.for("shift"); +s << s; +s << 0; +s >> s; +s >> 0; +s >>> s; +s >>> 0; + +//// [symbolType7.js] +var s = Symbol.for("shift"); +s << s; +s << 0; +s >> s; +s >> 0; +s >>> s; +s >>> 0; diff --git a/tests/baselines/reference/symbolType8.js b/tests/baselines/reference/symbolType8.js new file mode 100644 index 00000000000..e80dea220b9 --- /dev/null +++ b/tests/baselines/reference/symbolType8.js @@ -0,0 +1,21 @@ +//// [symbolType8.ts] +var s = Symbol.for("compare"); +s < s; +s < 0; +s > s; +s > 0; +s <= s; +s <= 0; +s >= s; +s >= 0; + +//// [symbolType8.js] +var s = Symbol.for("compare"); +s < s; +s < 0; +s > s; +s > 0; +s <= s; +s <= 0; +s >= s; +s >= 0; diff --git a/tests/baselines/reference/symbolType9.js b/tests/baselines/reference/symbolType9.js new file mode 100644 index 00000000000..c9b0c801cc8 --- /dev/null +++ b/tests/baselines/reference/symbolType9.js @@ -0,0 +1,21 @@ +//// [symbolType9.ts] +var s = Symbol.for("equal"); +s == s; +s == true; +s != s; +0 != s; +s === s; +s === 1; +s !== s; +false !== s; + +//// [symbolType9.js] +var s = Symbol.for("equal"); +s == s; +s == true; +s != s; +0 != s; +s === s; +s === 1; +s !== s; +false !== s; diff --git a/tests/baselines/reference/symbolType9.types b/tests/baselines/reference/symbolType9.types new file mode 100644 index 00000000000..f2d1af709ac --- /dev/null +++ b/tests/baselines/reference/symbolType9.types @@ -0,0 +1,44 @@ +=== tests/cases/conformance/es6/Symbols/symbolType9.ts === +var s = Symbol.for("equal"); +>s : Symbol +>Symbol.for("equal") : Symbol +>Symbol.for : (key: string) => Symbol +>Symbol : SymbolConstructor +>for : (key: string) => Symbol + +s == s; +>s == s : boolean +>s : Symbol +>s : Symbol + +s == true; +>s == true : boolean +>s : Symbol + +s != s; +>s != s : boolean +>s : Symbol +>s : Symbol + +0 != s; +>0 != s : boolean +>s : Symbol + +s === s; +>s === s : boolean +>s : Symbol +>s : Symbol + +s === 1; +>s === 1 : boolean +>s : Symbol + +s !== s; +>s !== s : boolean +>s : Symbol +>s : Symbol + +false !== s; +>false !== s : boolean +>s : Symbol + diff --git a/tests/cases/conformance/es6/Symbols/symbolType1.ts b/tests/cases/conformance/es6/Symbols/symbolType1.ts new file mode 100644 index 00000000000..3945ecc76e8 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType1.ts @@ -0,0 +1,3 @@ +//@target: ES6 +Symbol() instanceof Symbol; +Symbol instanceof Symbol(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType10.ts b/tests/cases/conformance/es6/Symbols/symbolType10.ts new file mode 100644 index 00000000000..a1ee87de159 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType10.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var s = Symbol.for("bitwise"); +s & s; +s | s; +s ^ s; + +s & 0; +0 | s; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType11.ts b/tests/cases/conformance/es6/Symbols/symbolType11.ts new file mode 100644 index 00000000000..8b9661bb046 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType11.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var s = Symbol.for("logical"); +s && s; +s && []; +0 && s; +s || s; +s || 1; +({}) || s; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType12.ts b/tests/cases/conformance/es6/Symbols/symbolType12.ts new file mode 100644 index 00000000000..7197c13497d --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType12.ts @@ -0,0 +1,27 @@ +//@target: ES6 +var s = Symbol.for("assign"); +var str = ""; +s *= s; +s *= 0; +s /= s; +s /= 0; +s %= s; +s %= 0; +s += s; +s += 0; +s += ""; +str += s; +s -= s; +s -= 0; +s <<= s; +s <<= 0; +s >>= s; +s >>= 0; +s >>>= s; +s >>>= 0; +s &= s; +s &= 0; +s ^= s; +s ^= 0; +s |= s; +s |= 0; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType13.ts b/tests/cases/conformance/es6/Symbols/symbolType13.ts new file mode 100644 index 00000000000..4b657c4c37a --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType13.ts @@ -0,0 +1,7 @@ +//@target: ES6 +var s = Symbol(); +var x: any; + +for (s in {}) { } +for (x in s) { } +for (var y in s) { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType2.ts b/tests/cases/conformance/es6/Symbols/symbolType2.ts new file mode 100644 index 00000000000..54954c17bd3 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType2.ts @@ -0,0 +1,3 @@ +//@target: ES6 +Symbol.isConcatSpreadable in {}; +"" in Symbol.toPrimitive; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType3.ts b/tests/cases/conformance/es6/Symbols/symbolType3.ts new file mode 100644 index 00000000000..ca098fe0695 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType3.ts @@ -0,0 +1,11 @@ +//@target: ES6 +var s = Symbol(); +delete Symbol.iterator; +void Symbol.toPrimitive; +typeof Symbol.toStringTag; +++s; +--s; ++ Symbol(); +- Symbol(); +~ Symbol(); +! Symbol(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType4.ts b/tests/cases/conformance/es6/Symbols/symbolType4.ts new file mode 100644 index 00000000000..bd5b5ba1a06 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType4.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var s = Symbol.for("postfix"); +s++; +s--; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType5.ts b/tests/cases/conformance/es6/Symbols/symbolType5.ts new file mode 100644 index 00000000000..302cfcafdf3 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType5.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var s = Symbol.for("multiply"); +s * s; +s / s; +s % s; + +s * 0; +0 / s; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType6.ts b/tests/cases/conformance/es6/Symbols/symbolType6.ts new file mode 100644 index 00000000000..b6f58ac5b29 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType6.ts @@ -0,0 +1,10 @@ +//@target: ES6 +var s = Symbol.for("add"); +s + s; +s - s; +s + ""; +s + 0; +"" + s; +0 + s; +s - 0; +0 - s; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType7.ts b/tests/cases/conformance/es6/Symbols/symbolType7.ts new file mode 100644 index 00000000000..841ca9e8b10 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType7.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var s = Symbol.for("shift"); +s << s; +s << 0; +s >> s; +s >> 0; +s >>> s; +s >>> 0; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType8.ts b/tests/cases/conformance/es6/Symbols/symbolType8.ts new file mode 100644 index 00000000000..4970ae0a9ca --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType8.ts @@ -0,0 +1,10 @@ +//@target: ES6 +var s = Symbol.for("compare"); +s < s; +s < 0; +s > s; +s > 0; +s <= s; +s <= 0; +s >= s; +s >= 0; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType9.ts b/tests/cases/conformance/es6/Symbols/symbolType9.ts new file mode 100644 index 00000000000..1fa43143640 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType9.ts @@ -0,0 +1,10 @@ +//@target: ES6 +var s = Symbol.for("equal"); +s == s; +s == true; +s != s; +0 != s; +s === s; +s === 1; +s !== s; +false !== s; \ No newline at end of file From 779661c8dafd36e2cbd70dc4d7ac645369c4f1e0 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Mon, 2 Feb 2015 12:48:18 -0800 Subject: [PATCH 020/162] Add tests for symbol properties --- .../conformance/es6/Symbols/symbolProperty10.ts | 11 +++++++++++ .../conformance/es6/Symbols/symbolProperty11.ts | 9 +++++++++ .../conformance/es6/Symbols/symbolProperty12.ts | 11 +++++++++++ .../conformance/es6/Symbols/symbolProperty13.ts | 17 +++++++++++++++++ .../conformance/es6/Symbols/symbolProperty14.ts | 17 +++++++++++++++++ .../conformance/es6/Symbols/symbolProperty15.ts | 15 +++++++++++++++ .../conformance/es6/Symbols/symbolProperty16.ts | 17 +++++++++++++++++ .../conformance/es6/Symbols/symbolProperty17.ts | 9 +++++++++ .../conformance/es6/Symbols/symbolProperty18.ts | 10 ++++++++++ .../conformance/es6/Symbols/symbolProperty19.ts | 8 ++++++++ .../conformance/es6/Symbols/symbolProperty20.ts | 10 ++++++++++ .../conformance/es6/Symbols/symbolProperty21.ts | 13 +++++++++++++ .../conformance/es6/Symbols/symbolProperty22.ts | 8 ++++++++ .../conformance/es6/Symbols/symbolProperty23.ts | 10 ++++++++++ .../conformance/es6/Symbols/symbolProperty24.ts | 10 ++++++++++ .../conformance/es6/Symbols/symbolProperty25.ts | 10 ++++++++++ .../conformance/es6/Symbols/symbolProperty26.ts | 12 ++++++++++++ .../conformance/es6/Symbols/symbolProperty27.ts | 12 ++++++++++++ .../conformance/es6/Symbols/symbolProperty28.ts | 11 +++++++++++ .../conformance/es6/Symbols/symbolProperty29.ts | 7 +++++++ .../conformance/es6/Symbols/symbolProperty30.ts | 7 +++++++ .../conformance/es6/Symbols/symbolProperty31.ts | 9 +++++++++ .../conformance/es6/Symbols/symbolProperty32.ts | 9 +++++++++ .../conformance/es6/Symbols/symbolProperty33.ts | 9 +++++++++ .../conformance/es6/Symbols/symbolProperty34.ts | 9 +++++++++ .../conformance/es6/Symbols/symbolProperty35.ts | 9 +++++++++ .../conformance/es6/Symbols/symbolProperty36.ts | 5 +++++ .../conformance/es6/Symbols/symbolProperty37.ts | 5 +++++ .../conformance/es6/Symbols/symbolProperty38.ts | 7 +++++++ .../conformance/es6/Symbols/symbolProperty39.ts | 11 +++++++++++ .../conformance/es6/Symbols/symbolProperty40.ts | 12 ++++++++++++ .../conformance/es6/Symbols/symbolProperty41.ts | 12 ++++++++++++ .../conformance/es6/Symbols/symbolProperty42.ts | 8 ++++++++ .../conformance/es6/Symbols/symbolProperty43.ts | 5 +++++ .../conformance/es6/Symbols/symbolProperty44.ts | 9 +++++++++ .../conformance/es6/Symbols/symbolProperty45.ts | 9 +++++++++ .../conformance/es6/Symbols/symbolProperty46.ts | 12 ++++++++++++ .../conformance/es6/Symbols/symbolProperty47.ts | 12 ++++++++++++ .../conformance/es6/Symbols/symbolProperty48.ts | 8 ++++++++ .../conformance/es6/Symbols/symbolProperty49.ts | 8 ++++++++ .../conformance/es6/Symbols/symbolProperty50.ts | 8 ++++++++ .../conformance/es6/Symbols/symbolProperty51.ts | 8 ++++++++ .../conformance/es6/Symbols/symbolProperty52.ts | 6 ++++++ .../conformance/es6/Symbols/symbolProperty53.ts | 4 ++++ .../conformance/es6/Symbols/symbolProperty54.ts | 4 ++++ .../conformance/es6/Symbols/symbolProperty9.ts | 11 +++++++++++ 46 files changed, 443 insertions(+) create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty10.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty11.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty12.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty13.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty14.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty15.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty16.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty17.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty18.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty19.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty20.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty21.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty22.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty23.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty24.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty25.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty26.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty27.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty28.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty29.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty30.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty31.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty32.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty33.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty34.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty35.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty36.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty37.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty38.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty39.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty40.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty41.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty42.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty43.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty44.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty45.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty46.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty47.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty48.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty49.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty50.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty51.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty52.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty53.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty54.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty9.ts diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty10.ts b/tests/cases/conformance/es6/Symbols/symbolProperty10.ts new file mode 100644 index 00000000000..0f63356eaf6 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty10.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]?: { x }; +} + +var i: I; +i = new C; +var c: C = i; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty11.ts b/tests/cases/conformance/es6/Symbols/symbolProperty11.ts new file mode 100644 index 00000000000..1377970613d --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty11.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { } +interface I { + [Symbol.iterator]?: { x }; +} + +var i: I; +i = new C; +var c: C = i; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty12.ts b/tests/cases/conformance/es6/Symbols/symbolProperty12.ts new file mode 100644 index 00000000000..5a835a34b62 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty12.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C { + private [Symbol.iterator]: { x }; +} +interface I { + [Symbol.iterator]: { x }; +} + +var i: I; +i = new C; +var c: C = i; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty13.ts b/tests/cases/conformance/es6/Symbols/symbolProperty13.ts new file mode 100644 index 00000000000..4b5023e1d06 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty13.ts @@ -0,0 +1,17 @@ +//@target: ES6 +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty14.ts b/tests/cases/conformance/es6/Symbols/symbolProperty14.ts new file mode 100644 index 00000000000..0109ec3be25 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty14.ts @@ -0,0 +1,17 @@ +//@target: ES6 +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]?: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty15.ts b/tests/cases/conformance/es6/Symbols/symbolProperty15.ts new file mode 100644 index 00000000000..3ec6c6ecc7a --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty15.ts @@ -0,0 +1,15 @@ +//@target: ES6 +class C { } +interface I { + [Symbol.iterator]?: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty16.ts b/tests/cases/conformance/es6/Symbols/symbolProperty16.ts new file mode 100644 index 00000000000..2b3a976df98 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty16.ts @@ -0,0 +1,17 @@ +//@target: ES6 +class C { + private [Symbol.iterator]: { x }; +} +interface I { + [Symbol.iterator]: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty17.ts b/tests/cases/conformance/es6/Symbols/symbolProperty17.ts new file mode 100644 index 00000000000..450fbb70dd6 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty17.ts @@ -0,0 +1,9 @@ +//@target: ES6 +interface I { + [Symbol.iterator]: number; + [s: Symbol]: string; + "__@iterator": string; +} + +var i: I; +var it = i[Symbol.iterator]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty18.ts b/tests/cases/conformance/es6/Symbols/symbolProperty18.ts new file mode 100644 index 00000000000..2fabea34960 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty18.ts @@ -0,0 +1,10 @@ +//@target: ES6 +var i = { + [Symbol.iterator]: 0, + [Symbol.toStringTag]() { return "" }, + set [Symbol.toPrimitive](p: boolean) { } +} + +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); +i[Symbol.toPrimitive] = false; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty19.ts b/tests/cases/conformance/es6/Symbols/symbolProperty19.ts new file mode 100644 index 00000000000..df9b99f5ca4 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty19.ts @@ -0,0 +1,8 @@ +//@target: ES6 +var i = { + [Symbol.iterator]: { p: null }, + [Symbol.toStringTag]() { return { p: undefined }; } +} + +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty20.ts b/tests/cases/conformance/es6/Symbols/symbolProperty20.ts new file mode 100644 index 00000000000..7180ceec87d --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty20.ts @@ -0,0 +1,10 @@ +//@target: ES6 +interface I { + [Symbol.iterator]: (s: string) => string; + [Symbol.toStringTag](s: number): number; +} + +var i: I = { + [Symbol.iterator]: s => s, + [Symbol.toStringTag](n) { return n; } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty21.ts b/tests/cases/conformance/es6/Symbols/symbolProperty21.ts new file mode 100644 index 00000000000..52e84a00425 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty21.ts @@ -0,0 +1,13 @@ +//@target: ES6 +interface I { + [Symbol.unscopables]: T; + [Symbol.isConcatSpreadable]: U; +} + +declare function foo(p: I): { t: T; u: U }; + +foo({ + [Symbol.isConcatSpreadable]: "", + [Symbol.isRegExp]: 0, + [Symbol.unscopables]: true +}); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty22.ts b/tests/cases/conformance/es6/Symbols/symbolProperty22.ts new file mode 100644 index 00000000000..a0eec6dd471 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty22.ts @@ -0,0 +1,8 @@ +//@target: ES6 +interface I { + [Symbol.unscopables](x: T): U; +} + +declare function foo(p1: T, p2: I): U; + +foo("", { [Symbol.unscopables]: s => s.length }); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty23.ts b/tests/cases/conformance/es6/Symbols/symbolProperty23.ts new file mode 100644 index 00000000000..6d8a2108720 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty23.ts @@ -0,0 +1,10 @@ +//@target: ES6 +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toPrimitive]() { + return true; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty24.ts b/tests/cases/conformance/es6/Symbols/symbolProperty24.ts new file mode 100644 index 00000000000..8e1c35879ab --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty24.ts @@ -0,0 +1,10 @@ +//@target: ES6 +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toPrimitive]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty25.ts b/tests/cases/conformance/es6/Symbols/symbolProperty25.ts new file mode 100644 index 00000000000..ee571174933 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty25.ts @@ -0,0 +1,10 @@ +//@target: ES6 +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toStringTag]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty26.ts b/tests/cases/conformance/es6/Symbols/symbolProperty26.ts new file mode 100644 index 00000000000..88b7d168d64 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty26.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return ""; + } +} + +class C2 extends C1 { + [Symbol.toStringTag]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty27.ts b/tests/cases/conformance/es6/Symbols/symbolProperty27.ts new file mode 100644 index 00000000000..c6283595575 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty27.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return {}; + } +} + +class C2 extends C1 { + [Symbol.toStringTag]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty28.ts b/tests/cases/conformance/es6/Symbols/symbolProperty28.ts new file mode 100644 index 00000000000..7f68444a75e --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty28.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} + +class C2 extends C1 { } + +var c: C2; +var obj = c[Symbol.toStringTag]().x; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty29.ts b/tests/cases/conformance/es6/Symbols/symbolProperty29.ts new file mode 100644 index 00000000000..43701b715f9 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty29.ts @@ -0,0 +1,7 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: Symbol]: () => { x: string }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty30.ts b/tests/cases/conformance/es6/Symbols/symbolProperty30.ts new file mode 100644 index 00000000000..e2460604a87 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty30.ts @@ -0,0 +1,7 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: Symbol]: () => { x: number }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty31.ts b/tests/cases/conformance/es6/Symbols/symbolProperty31.ts new file mode 100644 index 00000000000..6d39675bf52 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty31.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 extends C1 { + [s: Symbol]: () => { x: string }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty32.ts b/tests/cases/conformance/es6/Symbols/symbolProperty32.ts new file mode 100644 index 00000000000..873187ff614 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty32.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 extends C1 { + [s: Symbol]: () => { x: number }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty33.ts b/tests/cases/conformance/es6/Symbols/symbolProperty33.ts new file mode 100644 index 00000000000..12669f89d6f --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty33.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 { + [s: Symbol]: () => { x: string }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty34.ts b/tests/cases/conformance/es6/Symbols/symbolProperty34.ts new file mode 100644 index 00000000000..5d41b87002d --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty34.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 { + [s: Symbol]: () => { x: number }; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty35.ts b/tests/cases/conformance/es6/Symbols/symbolProperty35.ts new file mode 100644 index 00000000000..2d9527e2fd4 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty35.ts @@ -0,0 +1,9 @@ +//@target: ES6 +interface I1 { + [Symbol.toStringTag](): { x: string } +} +interface I2 { + [Symbol.toStringTag](): { x: number } +} + +interface I3 extends I1, I2 { } \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty36.ts b/tests/cases/conformance/es6/Symbols/symbolProperty36.ts new file mode 100644 index 00000000000..709ea39cd5d --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty36.ts @@ -0,0 +1,5 @@ +//@target: ES6 +var x = { + [Symbol.isConcatSpreadable]: 0, + [Symbol.isConcatSpreadable]: 1 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty37.ts b/tests/cases/conformance/es6/Symbols/symbolProperty37.ts new file mode 100644 index 00000000000..7a6c86a7bea --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty37.ts @@ -0,0 +1,5 @@ +//@target: ES6 +interface I { + [Symbol.isConcatSpreadable]: string; + [Symbol.isConcatSpreadable]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty38.ts b/tests/cases/conformance/es6/Symbols/symbolProperty38.ts new file mode 100644 index 00000000000..c8683344edc --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty38.ts @@ -0,0 +1,7 @@ +//@target: ES6 +interface I { + [Symbol.isConcatSpreadable]: string; +} +interface I { + [Symbol.isConcatSpreadable]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty39.ts b/tests/cases/conformance/es6/Symbols/symbolProperty39.ts new file mode 100644 index 00000000000..af3a95eb155 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty39.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } + [Symbol.iterator](x: any) { + return undefined; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty40.ts b/tests/cases/conformance/es6/Symbols/symbolProperty40.ts new file mode 100644 index 00000000000..91fd953a4d7 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty40.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } +} + +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator](0); diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty41.ts b/tests/cases/conformance/es6/Symbols/symbolProperty41.ts new file mode 100644 index 00000000000..9c9583264cd --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty41.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): { x: string }; + [Symbol.iterator](x: "hello"): { x: string; hello: string }; + [Symbol.iterator](x: any) { + return undefined; + } +} + +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator]("hello"); diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty42.ts b/tests/cases/conformance/es6/Symbols/symbolProperty42.ts new file mode 100644 index 00000000000..79fbce7bb90 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty42.ts @@ -0,0 +1,8 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): string; + static [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty43.ts b/tests/cases/conformance/es6/Symbols/symbolProperty43.ts new file mode 100644 index 00000000000..c524b6423a5 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty43.ts @@ -0,0 +1,5 @@ +//@target: ES6 +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty44.ts b/tests/cases/conformance/es6/Symbols/symbolProperty44.ts new file mode 100644 index 00000000000..a6281592605 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty44.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { + get [Symbol.hasInstance]() { + return ""; + } + get [Symbol.hasInstance]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty45.ts b/tests/cases/conformance/es6/Symbols/symbolProperty45.ts new file mode 100644 index 00000000000..cfdcc317646 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty45.ts @@ -0,0 +1,9 @@ +//@target: ES6 +class C { + get [Symbol.hasInstance]() { + return ""; + } + get [Symbol.toPrimitive]() { + return ""; + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty46.ts b/tests/cases/conformance/es6/Symbols/symbolProperty46.ts new file mode 100644 index 00000000000..84ce050ac1c --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty46.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x) { + } +} + +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty47.ts b/tests/cases/conformance/es6/Symbols/symbolProperty47.ts new file mode 100644 index 00000000000..05e46aaee75 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty47.ts @@ -0,0 +1,12 @@ +//@target: ES6 +class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x: number) { + } +} + +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty48.ts b/tests/cases/conformance/es6/Symbols/symbolProperty48.ts new file mode 100644 index 00000000000..77ce9303b44 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty48.ts @@ -0,0 +1,8 @@ +//@target: ES6 +module M { + var Symbol; + + class C { + [Symbol.iterator]() { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty49.ts b/tests/cases/conformance/es6/Symbols/symbolProperty49.ts new file mode 100644 index 00000000000..bc34e146f2c --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty49.ts @@ -0,0 +1,8 @@ +//@target: ES6 +module M { + export var Symbol; + + class C { + [Symbol.iterator]() { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty50.ts b/tests/cases/conformance/es6/Symbols/symbolProperty50.ts new file mode 100644 index 00000000000..8bcf25fab29 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty50.ts @@ -0,0 +1,8 @@ +//@target: ES6 +module M { + interface Symbol { } + + class C { + [Symbol.iterator]() { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty51.ts b/tests/cases/conformance/es6/Symbols/symbolProperty51.ts new file mode 100644 index 00000000000..3da5d45bf84 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty51.ts @@ -0,0 +1,8 @@ +//@target: ES6 +module M { + module Symbol { } + + class C { + [Symbol.iterator]() { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty52.ts b/tests/cases/conformance/es6/Symbols/symbolProperty52.ts new file mode 100644 index 00000000000..324278ea804 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty52.ts @@ -0,0 +1,6 @@ +//@target: ES6 +var obj = { + [Symbol.nonsense]: 0 +}; + +obj = {}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty53.ts b/tests/cases/conformance/es6/Symbols/symbolProperty53.ts new file mode 100644 index 00000000000..04cdf21a67e --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty53.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var obj = { + [Symbol.for]: 0 +}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty54.ts b/tests/cases/conformance/es6/Symbols/symbolProperty54.ts new file mode 100644 index 00000000000..b3eab2a54a1 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty54.ts @@ -0,0 +1,4 @@ +//@target: ES6 +var obj = { + [Symbol.prototype]: 0 +}; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty9.ts b/tests/cases/conformance/es6/Symbols/symbolProperty9.ts new file mode 100644 index 00000000000..33ffcb5ee25 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty9.ts @@ -0,0 +1,11 @@ +//@target: ES6 +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]: { x }; +} + +var i: I; +i = new C; +var c: C = i; \ No newline at end of file From 95af9978e19551b6ce94eac64dfcbd1acb9203bf Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Mon, 2 Feb 2015 17:19:27 -0800 Subject: [PATCH 021/162] Accept correct baselines for symbol property tests --- .../reference/symbolProperty10.errors.txt | 22 ++++++++ tests/baselines/reference/symbolProperty10.js | 21 +++++++ tests/baselines/reference/symbolProperty11.js | 19 +++++++ .../reference/symbolProperty11.types | 29 ++++++++++ .../reference/symbolProperty12.errors.txt | 23 ++++++++ tests/baselines/reference/symbolProperty12.js | 21 +++++++ tests/baselines/reference/symbolProperty13.js | 27 +++++++++ .../reference/symbolProperty13.types | 56 +++++++++++++++++++ tests/baselines/reference/symbolProperty14.js | 27 +++++++++ .../reference/symbolProperty14.types | 56 +++++++++++++++++++ tests/baselines/reference/symbolProperty15.js | 25 +++++++++ .../reference/symbolProperty15.types | 49 ++++++++++++++++ tests/baselines/reference/symbolProperty16.js | 27 +++++++++ .../reference/symbolProperty16.types | 55 ++++++++++++++++++ tests/baselines/reference/symbolProperty17.js | 13 +++++ tests/baselines/reference/symbolProperty18.js | 23 ++++++++ tests/baselines/reference/symbolProperty19.js | 18 ++++++ tests/baselines/reference/symbolProperty20.js | 18 ++++++ .../reference/symbolProperty20.types | 37 ++++++++++++ tests/baselines/reference/symbolProperty21.js | 20 +++++++ .../reference/symbolProperty21.types | 53 ++++++++++++++++++ tests/baselines/reference/symbolProperty22.js | 11 ++++ .../reference/symbolProperty22.types | 40 +++++++++++++ tests/baselines/reference/symbolProperty23.js | 20 +++++++ .../reference/symbolProperty23.types | 22 ++++++++ .../reference/symbolProperty24.errors.txt | 21 +++++++ tests/baselines/reference/symbolProperty24.js | 20 +++++++ .../reference/symbolProperty25.errors.txt | 17 ++++++ tests/baselines/reference/symbolProperty25.js | 20 +++++++ tests/baselines/reference/symbolProperty26.js | 38 +++++++++++++ .../reference/symbolProperty26.types | 25 +++++++++ tests/baselines/reference/symbolProperty27.js | 38 +++++++++++++ .../reference/symbolProperty27.types | 26 +++++++++ tests/baselines/reference/symbolProperty28.js | 36 ++++++++++++ tests/baselines/reference/symbolProperty29.js | 17 ++++++ .../reference/symbolProperty29.types | 18 ++++++ tests/baselines/reference/symbolProperty30.js | 17 ++++++ tests/baselines/reference/symbolProperty31.js | 32 +++++++++++ .../reference/symbolProperty31.types | 23 ++++++++ tests/baselines/reference/symbolProperty32.js | 32 +++++++++++ tests/baselines/reference/symbolProperty33.js | 32 +++++++++++ .../reference/symbolProperty33.types | 23 ++++++++ tests/baselines/reference/symbolProperty34.js | 32 +++++++++++ tests/baselines/reference/symbolProperty35.js | 11 ++++ .../reference/symbolProperty36.errors.txt | 13 +++++ tests/baselines/reference/symbolProperty36.js | 11 ++++ .../reference/symbolProperty37.errors.txt | 13 +++++ tests/baselines/reference/symbolProperty37.js | 7 +++ .../reference/symbolProperty38.errors.txt | 15 +++++ tests/baselines/reference/symbolProperty38.js | 9 +++ .../reference/symbolProperty39.errors.txt | 25 +++++++++ tests/baselines/reference/symbolProperty39.js | 24 ++++++++ tests/baselines/reference/symbolProperty40.js | 26 +++++++++ tests/baselines/reference/symbolProperty41.js | 26 +++++++++ .../reference/symbolProperty42.errors.txt | 16 ++++++ tests/baselines/reference/symbolProperty42.js | 18 ++++++ .../reference/symbolProperty43.errors.txt | 10 ++++ tests/baselines/reference/symbolProperty43.js | 12 ++++ .../reference/symbolProperty44.errors.txt | 17 ++++++ tests/baselines/reference/symbolProperty44.js | 30 ++++++++++ tests/baselines/reference/symbolProperty45.js | 30 ++++++++++ .../reference/symbolProperty45.types | 19 +++++++ tests/baselines/reference/symbolProperty46.js | 35 ++++++++++++ .../reference/symbolProperty47.errors.txt | 17 ++++++ tests/baselines/reference/symbolProperty47.js | 35 ++++++++++++ tests/baselines/reference/symbolProperty48.js | 21 +++++++ tests/baselines/reference/symbolProperty49.js | 21 +++++++ tests/baselines/reference/symbolProperty50.js | 20 +++++++ .../reference/symbolProperty50.types | 16 ++++++ tests/baselines/reference/symbolProperty51.js | 20 +++++++ .../reference/symbolProperty51.types | 16 ++++++ .../reference/symbolProperty52.errors.txt | 16 ++++++ tests/baselines/reference/symbolProperty52.js | 12 ++++ .../reference/symbolProperty53.errors.txt | 9 +++ tests/baselines/reference/symbolProperty53.js | 9 +++ tests/baselines/reference/symbolProperty54.js | 9 +++ .../reference/symbolProperty9.errors.txt | 22 ++++++++ tests/baselines/reference/symbolProperty9.js | 21 +++++++ 78 files changed, 1830 insertions(+) create mode 100644 tests/baselines/reference/symbolProperty10.errors.txt create mode 100644 tests/baselines/reference/symbolProperty10.js create mode 100644 tests/baselines/reference/symbolProperty11.js create mode 100644 tests/baselines/reference/symbolProperty11.types create mode 100644 tests/baselines/reference/symbolProperty12.errors.txt create mode 100644 tests/baselines/reference/symbolProperty12.js create mode 100644 tests/baselines/reference/symbolProperty13.js create mode 100644 tests/baselines/reference/symbolProperty13.types create mode 100644 tests/baselines/reference/symbolProperty14.js create mode 100644 tests/baselines/reference/symbolProperty14.types create mode 100644 tests/baselines/reference/symbolProperty15.js create mode 100644 tests/baselines/reference/symbolProperty15.types create mode 100644 tests/baselines/reference/symbolProperty16.js create mode 100644 tests/baselines/reference/symbolProperty16.types create mode 100644 tests/baselines/reference/symbolProperty17.js create mode 100644 tests/baselines/reference/symbolProperty18.js create mode 100644 tests/baselines/reference/symbolProperty19.js create mode 100644 tests/baselines/reference/symbolProperty20.js create mode 100644 tests/baselines/reference/symbolProperty20.types create mode 100644 tests/baselines/reference/symbolProperty21.js create mode 100644 tests/baselines/reference/symbolProperty21.types create mode 100644 tests/baselines/reference/symbolProperty22.js create mode 100644 tests/baselines/reference/symbolProperty22.types create mode 100644 tests/baselines/reference/symbolProperty23.js create mode 100644 tests/baselines/reference/symbolProperty23.types create mode 100644 tests/baselines/reference/symbolProperty24.errors.txt create mode 100644 tests/baselines/reference/symbolProperty24.js create mode 100644 tests/baselines/reference/symbolProperty25.errors.txt create mode 100644 tests/baselines/reference/symbolProperty25.js create mode 100644 tests/baselines/reference/symbolProperty26.js create mode 100644 tests/baselines/reference/symbolProperty26.types create mode 100644 tests/baselines/reference/symbolProperty27.js create mode 100644 tests/baselines/reference/symbolProperty27.types create mode 100644 tests/baselines/reference/symbolProperty28.js create mode 100644 tests/baselines/reference/symbolProperty29.js create mode 100644 tests/baselines/reference/symbolProperty29.types create mode 100644 tests/baselines/reference/symbolProperty30.js create mode 100644 tests/baselines/reference/symbolProperty31.js create mode 100644 tests/baselines/reference/symbolProperty31.types create mode 100644 tests/baselines/reference/symbolProperty32.js create mode 100644 tests/baselines/reference/symbolProperty33.js create mode 100644 tests/baselines/reference/symbolProperty33.types create mode 100644 tests/baselines/reference/symbolProperty34.js create mode 100644 tests/baselines/reference/symbolProperty35.js create mode 100644 tests/baselines/reference/symbolProperty36.errors.txt create mode 100644 tests/baselines/reference/symbolProperty36.js create mode 100644 tests/baselines/reference/symbolProperty37.errors.txt create mode 100644 tests/baselines/reference/symbolProperty37.js create mode 100644 tests/baselines/reference/symbolProperty38.errors.txt create mode 100644 tests/baselines/reference/symbolProperty38.js create mode 100644 tests/baselines/reference/symbolProperty39.errors.txt create mode 100644 tests/baselines/reference/symbolProperty39.js create mode 100644 tests/baselines/reference/symbolProperty40.js create mode 100644 tests/baselines/reference/symbolProperty41.js create mode 100644 tests/baselines/reference/symbolProperty42.errors.txt create mode 100644 tests/baselines/reference/symbolProperty42.js create mode 100644 tests/baselines/reference/symbolProperty43.errors.txt create mode 100644 tests/baselines/reference/symbolProperty43.js create mode 100644 tests/baselines/reference/symbolProperty44.errors.txt create mode 100644 tests/baselines/reference/symbolProperty44.js create mode 100644 tests/baselines/reference/symbolProperty45.js create mode 100644 tests/baselines/reference/symbolProperty45.types create mode 100644 tests/baselines/reference/symbolProperty46.js create mode 100644 tests/baselines/reference/symbolProperty47.errors.txt create mode 100644 tests/baselines/reference/symbolProperty47.js create mode 100644 tests/baselines/reference/symbolProperty48.js create mode 100644 tests/baselines/reference/symbolProperty49.js create mode 100644 tests/baselines/reference/symbolProperty50.js create mode 100644 tests/baselines/reference/symbolProperty50.types create mode 100644 tests/baselines/reference/symbolProperty51.js create mode 100644 tests/baselines/reference/symbolProperty51.types create mode 100644 tests/baselines/reference/symbolProperty52.errors.txt create mode 100644 tests/baselines/reference/symbolProperty52.js create mode 100644 tests/baselines/reference/symbolProperty53.errors.txt create mode 100644 tests/baselines/reference/symbolProperty53.js create mode 100644 tests/baselines/reference/symbolProperty54.js create mode 100644 tests/baselines/reference/symbolProperty9.errors.txt create mode 100644 tests/baselines/reference/symbolProperty9.js diff --git a/tests/baselines/reference/symbolProperty10.errors.txt b/tests/baselines/reference/symbolProperty10.errors.txt new file mode 100644 index 00000000000..513d5792c5e --- /dev/null +++ b/tests/baselines/reference/symbolProperty10.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/Symbols/symbolProperty10.ts(10,5): error TS2322: Type 'I' is not assignable to type 'C'. + Types of property '[Symbol.iterator]' are incompatible. + Type '{ x: any; }' is not assignable to type '{ x: any; y: any; }'. + Property 'y' is missing in type '{ x: any; }'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty10.ts (1 errors) ==== + class C { + [Symbol.iterator]: { x; y }; + } + interface I { + [Symbol.iterator]?: { x }; + } + + var i: I; + i = new C; + var c: C = i; + ~ +!!! error TS2322: Type 'I' is not assignable to type 'C'. +!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2322: Type '{ x: any; }' is not assignable to type '{ x: any; y: any; }'. +!!! error TS2322: Property 'y' is missing in type '{ x: any; }'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty10.js b/tests/baselines/reference/symbolProperty10.js new file mode 100644 index 00000000000..5b4e44f11ab --- /dev/null +++ b/tests/baselines/reference/symbolProperty10.js @@ -0,0 +1,21 @@ +//// [symbolProperty10.ts] +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]?: { x }; +} + +var i: I; +i = new C; +var c: C = i; + +//// [symbolProperty10.js] +var C = (function () { + function C() { + } + return C; +})(); +var i; +i = new C; +var c = i; diff --git a/tests/baselines/reference/symbolProperty11.js b/tests/baselines/reference/symbolProperty11.js new file mode 100644 index 00000000000..83a380c79e7 --- /dev/null +++ b/tests/baselines/reference/symbolProperty11.js @@ -0,0 +1,19 @@ +//// [symbolProperty11.ts] +class C { } +interface I { + [Symbol.iterator]?: { x }; +} + +var i: I; +i = new C; +var c: C = i; + +//// [symbolProperty11.js] +var C = (function () { + function C() { + } + return C; +})(); +var i; +i = new C; +var c = i; diff --git a/tests/baselines/reference/symbolProperty11.types b/tests/baselines/reference/symbolProperty11.types new file mode 100644 index 00000000000..9ba956293af --- /dev/null +++ b/tests/baselines/reference/symbolProperty11.types @@ -0,0 +1,29 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty11.ts === +class C { } +>C : C + +interface I { +>I : I + + [Symbol.iterator]?: { x }; +>Symbol.iterator : Symbol +>Symbol : SymbolConstructor +>iterator : Symbol +>x : any +} + +var i: I; +>i : I +>I : I + +i = new C; +>i = new C : C +>i : I +>new C : C +>C : typeof C + +var c: C = i; +>c : C +>C : C +>i : I + diff --git a/tests/baselines/reference/symbolProperty12.errors.txt b/tests/baselines/reference/symbolProperty12.errors.txt new file mode 100644 index 00000000000..5ec8d645203 --- /dev/null +++ b/tests/baselines/reference/symbolProperty12.errors.txt @@ -0,0 +1,23 @@ +tests/cases/conformance/es6/Symbols/symbolProperty12.ts(9,1): error TS2322: Type 'C' is not assignable to type 'I'. + Property '[Symbol.iterator]' is private in type 'C' but not in type 'I'. +tests/cases/conformance/es6/Symbols/symbolProperty12.ts(10,5): error TS2322: Type 'I' is not assignable to type 'C'. + Property '[Symbol.iterator]' is private in type 'C' but not in type 'I'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty12.ts (2 errors) ==== + class C { + private [Symbol.iterator]: { x }; + } + interface I { + [Symbol.iterator]: { x }; + } + + var i: I; + i = new C; + ~ +!!! error TS2322: Type 'C' is not assignable to type 'I'. +!!! error TS2322: Property '[Symbol.iterator]' is private in type 'C' but not in type 'I'. + var c: C = i; + ~ +!!! error TS2322: Type 'I' is not assignable to type 'C'. +!!! error TS2322: Property '[Symbol.iterator]' is private in type 'C' but not in type 'I'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty12.js b/tests/baselines/reference/symbolProperty12.js new file mode 100644 index 00000000000..9f63f86bc18 --- /dev/null +++ b/tests/baselines/reference/symbolProperty12.js @@ -0,0 +1,21 @@ +//// [symbolProperty12.ts] +class C { + private [Symbol.iterator]: { x }; +} +interface I { + [Symbol.iterator]: { x }; +} + +var i: I; +i = new C; +var c: C = i; + +//// [symbolProperty12.js] +var C = (function () { + function C() { + } + return C; +})(); +var i; +i = new C; +var c = i; diff --git a/tests/baselines/reference/symbolProperty13.js b/tests/baselines/reference/symbolProperty13.js new file mode 100644 index 00000000000..1cf24a49c7e --- /dev/null +++ b/tests/baselines/reference/symbolProperty13.js @@ -0,0 +1,27 @@ +//// [symbolProperty13.ts] +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); + +//// [symbolProperty13.js] +var C = (function () { + function C() { + } + return C; +})(); +foo(new C); +var i; +bar(i); diff --git a/tests/baselines/reference/symbolProperty13.types b/tests/baselines/reference/symbolProperty13.types new file mode 100644 index 00000000000..231b7905b68 --- /dev/null +++ b/tests/baselines/reference/symbolProperty13.types @@ -0,0 +1,56 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty13.ts === +class C { +>C : C + + [Symbol.iterator]: { x; y }; +>Symbol.iterator : Symbol +>Symbol : SymbolConstructor +>iterator : Symbol +>x : any +>y : any +} +interface I { +>I : I + + [Symbol.iterator]: { x }; +>Symbol.iterator : Symbol +>Symbol : SymbolConstructor +>iterator : Symbol +>x : any +} + +declare function foo(i: I): I; +>foo : { (i: I): I; (a: any): any; } +>i : I +>I : I +>I : I + +declare function foo(a: any): any; +>foo : { (i: I): I; (a: any): any; } +>a : any + +declare function bar(i: C): C; +>bar : { (i: C): C; (a: any): any; } +>i : C +>C : C +>C : C + +declare function bar(a: any): any; +>bar : { (i: C): C; (a: any): any; } +>a : any + +foo(new C); +>foo(new C) : I +>foo : { (i: I): I; (a: any): any; } +>new C : C +>C : typeof C + +var i: I; +>i : I +>I : I + +bar(i); +>bar(i) : any +>bar : { (i: C): C; (a: any): any; } +>i : I + diff --git a/tests/baselines/reference/symbolProperty14.js b/tests/baselines/reference/symbolProperty14.js new file mode 100644 index 00000000000..0283cb01b79 --- /dev/null +++ b/tests/baselines/reference/symbolProperty14.js @@ -0,0 +1,27 @@ +//// [symbolProperty14.ts] +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]?: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); + +//// [symbolProperty14.js] +var C = (function () { + function C() { + } + return C; +})(); +foo(new C); +var i; +bar(i); diff --git a/tests/baselines/reference/symbolProperty14.types b/tests/baselines/reference/symbolProperty14.types new file mode 100644 index 00000000000..1032e83644c --- /dev/null +++ b/tests/baselines/reference/symbolProperty14.types @@ -0,0 +1,56 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty14.ts === +class C { +>C : C + + [Symbol.iterator]: { x; y }; +>Symbol.iterator : Symbol +>Symbol : SymbolConstructor +>iterator : Symbol +>x : any +>y : any +} +interface I { +>I : I + + [Symbol.iterator]?: { x }; +>Symbol.iterator : Symbol +>Symbol : SymbolConstructor +>iterator : Symbol +>x : any +} + +declare function foo(i: I): I; +>foo : { (i: I): I; (a: any): any; } +>i : I +>I : I +>I : I + +declare function foo(a: any): any; +>foo : { (i: I): I; (a: any): any; } +>a : any + +declare function bar(i: C): C; +>bar : { (i: C): C; (a: any): any; } +>i : C +>C : C +>C : C + +declare function bar(a: any): any; +>bar : { (i: C): C; (a: any): any; } +>a : any + +foo(new C); +>foo(new C) : I +>foo : { (i: I): I; (a: any): any; } +>new C : C +>C : typeof C + +var i: I; +>i : I +>I : I + +bar(i); +>bar(i) : any +>bar : { (i: C): C; (a: any): any; } +>i : I + diff --git a/tests/baselines/reference/symbolProperty15.js b/tests/baselines/reference/symbolProperty15.js new file mode 100644 index 00000000000..0c198037093 --- /dev/null +++ b/tests/baselines/reference/symbolProperty15.js @@ -0,0 +1,25 @@ +//// [symbolProperty15.ts] +class C { } +interface I { + [Symbol.iterator]?: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); + +//// [symbolProperty15.js] +var C = (function () { + function C() { + } + return C; +})(); +foo(new C); +var i; +bar(i); diff --git a/tests/baselines/reference/symbolProperty15.types b/tests/baselines/reference/symbolProperty15.types new file mode 100644 index 00000000000..863872c29c0 --- /dev/null +++ b/tests/baselines/reference/symbolProperty15.types @@ -0,0 +1,49 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty15.ts === +class C { } +>C : C + +interface I { +>I : I + + [Symbol.iterator]?: { x }; +>Symbol.iterator : Symbol +>Symbol : SymbolConstructor +>iterator : Symbol +>x : any +} + +declare function foo(i: I): I; +>foo : { (i: I): I; (a: any): any; } +>i : I +>I : I +>I : I + +declare function foo(a: any): any; +>foo : { (i: I): I; (a: any): any; } +>a : any + +declare function bar(i: C): C; +>bar : { (i: C): C; (a: any): any; } +>i : C +>C : C +>C : C + +declare function bar(a: any): any; +>bar : { (i: C): C; (a: any): any; } +>a : any + +foo(new C); +>foo(new C) : any +>foo : { (i: I): I; (a: any): any; } +>new C : C +>C : typeof C + +var i: I; +>i : I +>I : I + +bar(i); +>bar(i) : C +>bar : { (i: C): C; (a: any): any; } +>i : I + diff --git a/tests/baselines/reference/symbolProperty16.js b/tests/baselines/reference/symbolProperty16.js new file mode 100644 index 00000000000..1a1f3f857af --- /dev/null +++ b/tests/baselines/reference/symbolProperty16.js @@ -0,0 +1,27 @@ +//// [symbolProperty16.ts] +class C { + private [Symbol.iterator]: { x }; +} +interface I { + [Symbol.iterator]: { x }; +} + +declare function foo(i: I): I; +declare function foo(a: any): any; + +declare function bar(i: C): C; +declare function bar(a: any): any; + +foo(new C); +var i: I; +bar(i); + +//// [symbolProperty16.js] +var C = (function () { + function C() { + } + return C; +})(); +foo(new C); +var i; +bar(i); diff --git a/tests/baselines/reference/symbolProperty16.types b/tests/baselines/reference/symbolProperty16.types new file mode 100644 index 00000000000..172c5a1ea10 --- /dev/null +++ b/tests/baselines/reference/symbolProperty16.types @@ -0,0 +1,55 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty16.ts === +class C { +>C : C + + private [Symbol.iterator]: { x }; +>Symbol.iterator : Symbol +>Symbol : SymbolConstructor +>iterator : Symbol +>x : any +} +interface I { +>I : I + + [Symbol.iterator]: { x }; +>Symbol.iterator : Symbol +>Symbol : SymbolConstructor +>iterator : Symbol +>x : any +} + +declare function foo(i: I): I; +>foo : { (i: I): I; (a: any): any; } +>i : I +>I : I +>I : I + +declare function foo(a: any): any; +>foo : { (i: I): I; (a: any): any; } +>a : any + +declare function bar(i: C): C; +>bar : { (i: C): C; (a: any): any; } +>i : C +>C : C +>C : C + +declare function bar(a: any): any; +>bar : { (i: C): C; (a: any): any; } +>a : any + +foo(new C); +>foo(new C) : any +>foo : { (i: I): I; (a: any): any; } +>new C : C +>C : typeof C + +var i: I; +>i : I +>I : I + +bar(i); +>bar(i) : any +>bar : { (i: C): C; (a: any): any; } +>i : I + diff --git a/tests/baselines/reference/symbolProperty17.js b/tests/baselines/reference/symbolProperty17.js new file mode 100644 index 00000000000..9aa603910cd --- /dev/null +++ b/tests/baselines/reference/symbolProperty17.js @@ -0,0 +1,13 @@ +//// [symbolProperty17.ts] +interface I { + [Symbol.iterator]: number; + [s: Symbol]: string; + "__@iterator": string; +} + +var i: I; +var it = i[Symbol.iterator]; + +//// [symbolProperty17.js] +var i; +var it = i[Symbol.iterator]; diff --git a/tests/baselines/reference/symbolProperty18.js b/tests/baselines/reference/symbolProperty18.js new file mode 100644 index 00000000000..ff69588be31 --- /dev/null +++ b/tests/baselines/reference/symbolProperty18.js @@ -0,0 +1,23 @@ +//// [symbolProperty18.ts] +var i = { + [Symbol.iterator]: 0, + [Symbol.toStringTag]() { return "" }, + set [Symbol.toPrimitive](p: boolean) { } +} + +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); +i[Symbol.toPrimitive] = false; + +//// [symbolProperty18.js] +var i = { + [Symbol.iterator]: 0, + [Symbol.toStringTag]() { + return ""; + }, + set [Symbol.toPrimitive](p) { + } +}; +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); +i[Symbol.toPrimitive] = false; diff --git a/tests/baselines/reference/symbolProperty19.js b/tests/baselines/reference/symbolProperty19.js new file mode 100644 index 00000000000..c64541691cc --- /dev/null +++ b/tests/baselines/reference/symbolProperty19.js @@ -0,0 +1,18 @@ +//// [symbolProperty19.ts] +var i = { + [Symbol.iterator]: { p: null }, + [Symbol.toStringTag]() { return { p: undefined }; } +} + +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); + +//// [symbolProperty19.js] +var i = { + [Symbol.iterator]: { p: null }, + [Symbol.toStringTag]() { + return { p: undefined }; + } +}; +var it = i[Symbol.iterator]; +var str = i[Symbol.toStringTag](); diff --git a/tests/baselines/reference/symbolProperty20.js b/tests/baselines/reference/symbolProperty20.js new file mode 100644 index 00000000000..558305a577d --- /dev/null +++ b/tests/baselines/reference/symbolProperty20.js @@ -0,0 +1,18 @@ +//// [symbolProperty20.ts] +interface I { + [Symbol.iterator]: (s: string) => string; + [Symbol.toStringTag](s: number): number; +} + +var i: I = { + [Symbol.iterator]: s => s, + [Symbol.toStringTag](n) { return n; } +} + +//// [symbolProperty20.js] +var i = { + [Symbol.iterator]: s => { return s; }, + [Symbol.toStringTag](n) { + return n; + } +}; diff --git a/tests/baselines/reference/symbolProperty20.types b/tests/baselines/reference/symbolProperty20.types new file mode 100644 index 00000000000..94ef4a0f2db --- /dev/null +++ b/tests/baselines/reference/symbolProperty20.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty20.ts === +interface I { +>I : I + + [Symbol.iterator]: (s: string) => string; +>Symbol.iterator : Symbol +>Symbol : SymbolConstructor +>iterator : Symbol +>s : string + + [Symbol.toStringTag](s: number): number; +>Symbol.toStringTag : Symbol +>Symbol : SymbolConstructor +>toStringTag : Symbol +>s : number +} + +var i: I = { +>i : I +>I : I +>{ [Symbol.iterator]: s => s, [Symbol.toStringTag](n) { return n; }} : { [Symbol.iterator]: (s: string) => string; [Symbol.toStringTag](n: number): number; } + + [Symbol.iterator]: s => s, +>Symbol.iterator : Symbol +>Symbol : SymbolConstructor +>iterator : Symbol +>s => s : (s: string) => string +>s : string +>s : string + + [Symbol.toStringTag](n) { return n; } +>Symbol.toStringTag : Symbol +>Symbol : SymbolConstructor +>toStringTag : Symbol +>n : number +>n : number +} diff --git a/tests/baselines/reference/symbolProperty21.js b/tests/baselines/reference/symbolProperty21.js new file mode 100644 index 00000000000..13eaf06a97b --- /dev/null +++ b/tests/baselines/reference/symbolProperty21.js @@ -0,0 +1,20 @@ +//// [symbolProperty21.ts] +interface I { + [Symbol.unscopables]: T; + [Symbol.isConcatSpreadable]: U; +} + +declare function foo(p: I): { t: T; u: U }; + +foo({ + [Symbol.isConcatSpreadable]: "", + [Symbol.isRegExp]: 0, + [Symbol.unscopables]: true +}); + +//// [symbolProperty21.js] +foo({ + [Symbol.isConcatSpreadable]: "", + [Symbol.isRegExp]: 0, + [Symbol.unscopables]: true +}); diff --git a/tests/baselines/reference/symbolProperty21.types b/tests/baselines/reference/symbolProperty21.types new file mode 100644 index 00000000000..f364b7e3599 --- /dev/null +++ b/tests/baselines/reference/symbolProperty21.types @@ -0,0 +1,53 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty21.ts === +interface I { +>I : I +>T : T +>U : U + + [Symbol.unscopables]: T; +>Symbol.unscopables : Symbol +>Symbol : SymbolConstructor +>unscopables : Symbol +>T : T + + [Symbol.isConcatSpreadable]: U; +>Symbol.isConcatSpreadable : Symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : Symbol +>U : U +} + +declare function foo(p: I): { t: T; u: U }; +>foo : (p: I) => { t: T; u: U; } +>T : T +>U : U +>p : I +>I : I +>T : T +>U : U +>t : T +>T : T +>u : U +>U : U + +foo({ +>foo({ [Symbol.isConcatSpreadable]: "", [Symbol.isRegExp]: 0, [Symbol.unscopables]: true}) : { t: boolean; u: string; } +>foo : (p: I) => { t: T; u: U; } +>{ [Symbol.isConcatSpreadable]: "", [Symbol.isRegExp]: 0, [Symbol.unscopables]: true} : { [Symbol.isConcatSpreadable]: string; [Symbol.isRegExp]: number; [Symbol.unscopables]: boolean; } + + [Symbol.isConcatSpreadable]: "", +>Symbol.isConcatSpreadable : Symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : Symbol + + [Symbol.isRegExp]: 0, +>Symbol.isRegExp : Symbol +>Symbol : SymbolConstructor +>isRegExp : Symbol + + [Symbol.unscopables]: true +>Symbol.unscopables : Symbol +>Symbol : SymbolConstructor +>unscopables : Symbol + +}); diff --git a/tests/baselines/reference/symbolProperty22.js b/tests/baselines/reference/symbolProperty22.js new file mode 100644 index 00000000000..35757182143 --- /dev/null +++ b/tests/baselines/reference/symbolProperty22.js @@ -0,0 +1,11 @@ +//// [symbolProperty22.ts] +interface I { + [Symbol.unscopables](x: T): U; +} + +declare function foo(p1: T, p2: I): U; + +foo("", { [Symbol.unscopables]: s => s.length }); + +//// [symbolProperty22.js] +foo("", { [Symbol.unscopables]: s => { return s.length; } }); diff --git a/tests/baselines/reference/symbolProperty22.types b/tests/baselines/reference/symbolProperty22.types new file mode 100644 index 00000000000..c89af9afbd5 --- /dev/null +++ b/tests/baselines/reference/symbolProperty22.types @@ -0,0 +1,40 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty22.ts === +interface I { +>I : I +>T : T +>U : U + + [Symbol.unscopables](x: T): U; +>Symbol.unscopables : Symbol +>Symbol : SymbolConstructor +>unscopables : Symbol +>x : T +>T : T +>U : U +} + +declare function foo(p1: T, p2: I): U; +>foo : (p1: T, p2: I) => U +>T : T +>U : U +>p1 : T +>T : T +>p2 : I +>I : I +>T : T +>U : U +>U : U + +foo("", { [Symbol.unscopables]: s => s.length }); +>foo("", { [Symbol.unscopables]: s => s.length }) : number +>foo : (p1: T, p2: I) => U +>{ [Symbol.unscopables]: s => s.length } : { [Symbol.unscopables]: (s: string) => number; } +>Symbol.unscopables : Symbol +>Symbol : SymbolConstructor +>unscopables : Symbol +>s => s.length : (s: string) => number +>s : string +>s.length : number +>s : string +>length : number + diff --git a/tests/baselines/reference/symbolProperty23.js b/tests/baselines/reference/symbolProperty23.js new file mode 100644 index 00000000000..b3291ad34e8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty23.js @@ -0,0 +1,20 @@ +//// [symbolProperty23.ts] +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toPrimitive]() { + return true; + } +} + +//// [symbolProperty23.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toPrimitive] = function () { + return true; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty23.types b/tests/baselines/reference/symbolProperty23.types new file mode 100644 index 00000000000..99480f03b01 --- /dev/null +++ b/tests/baselines/reference/symbolProperty23.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty23.ts === +interface I { +>I : I + + [Symbol.toPrimitive]: () => boolean; +>Symbol.toPrimitive : Symbol +>Symbol : SymbolConstructor +>toPrimitive : Symbol +} + +class C implements I { +>C : C +>I : I + + [Symbol.toPrimitive]() { +>Symbol.toPrimitive : Symbol +>Symbol : SymbolConstructor +>toPrimitive : Symbol + + return true; + } +} diff --git a/tests/baselines/reference/symbolProperty24.errors.txt b/tests/baselines/reference/symbolProperty24.errors.txt new file mode 100644 index 00000000000..25cba184e25 --- /dev/null +++ b/tests/baselines/reference/symbolProperty24.errors.txt @@ -0,0 +1,21 @@ +tests/cases/conformance/es6/Symbols/symbolProperty24.ts(5,7): error TS2420: Class 'C' incorrectly implements interface 'I'. + Types of property '[Symbol.toPrimitive]' are incompatible. + Type '() => string' is not assignable to type '() => boolean'. + Type 'string' is not assignable to type 'boolean'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty24.ts (1 errors) ==== + interface I { + [Symbol.toPrimitive]: () => boolean; + } + + class C implements I { + ~ +!!! error TS2420: Class 'C' incorrectly implements interface 'I'. +!!! error TS2420: Types of property '[Symbol.toPrimitive]' are incompatible. +!!! error TS2420: Type '() => string' is not assignable to type '() => boolean'. +!!! error TS2420: Type 'string' is not assignable to type 'boolean'. + [Symbol.toPrimitive]() { + return ""; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty24.js b/tests/baselines/reference/symbolProperty24.js new file mode 100644 index 00000000000..b5d059dd29f --- /dev/null +++ b/tests/baselines/reference/symbolProperty24.js @@ -0,0 +1,20 @@ +//// [symbolProperty24.ts] +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toPrimitive]() { + return ""; + } +} + +//// [symbolProperty24.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toPrimitive] = function () { + return ""; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty25.errors.txt b/tests/baselines/reference/symbolProperty25.errors.txt new file mode 100644 index 00000000000..a6cde31c1ad --- /dev/null +++ b/tests/baselines/reference/symbolProperty25.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/Symbols/symbolProperty25.ts(5,7): error TS2420: Class 'C' incorrectly implements interface 'I'. + Property '[Symbol.toPrimitive]' is missing in type 'C'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty25.ts (1 errors) ==== + interface I { + [Symbol.toPrimitive]: () => boolean; + } + + class C implements I { + ~ +!!! error TS2420: Class 'C' incorrectly implements interface 'I'. +!!! error TS2420: Property '[Symbol.toPrimitive]' is missing in type 'C'. + [Symbol.toStringTag]() { + return ""; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty25.js b/tests/baselines/reference/symbolProperty25.js new file mode 100644 index 00000000000..c932da1e3eb --- /dev/null +++ b/tests/baselines/reference/symbolProperty25.js @@ -0,0 +1,20 @@ +//// [symbolProperty25.ts] +interface I { + [Symbol.toPrimitive]: () => boolean; +} + +class C implements I { + [Symbol.toStringTag]() { + return ""; + } +} + +//// [symbolProperty25.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toStringTag] = function () { + return ""; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty26.js b/tests/baselines/reference/symbolProperty26.js new file mode 100644 index 00000000000..9e98027603d --- /dev/null +++ b/tests/baselines/reference/symbolProperty26.js @@ -0,0 +1,38 @@ +//// [symbolProperty26.ts] +class C1 { + [Symbol.toStringTag]() { + return ""; + } +} + +class C2 extends C1 { + [Symbol.toStringTag]() { + return ""; + } +} + +//// [symbolProperty26.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return ""; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + C2.prototype[Symbol.toStringTag] = function () { + return ""; + }; + return C2; +})(C1); diff --git a/tests/baselines/reference/symbolProperty26.types b/tests/baselines/reference/symbolProperty26.types new file mode 100644 index 00000000000..258347bd4fa --- /dev/null +++ b/tests/baselines/reference/symbolProperty26.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty26.ts === +class C1 { +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : Symbol +>Symbol : SymbolConstructor +>toStringTag : Symbol + + return ""; + } +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : Symbol +>Symbol : SymbolConstructor +>toStringTag : Symbol + + return ""; + } +} diff --git a/tests/baselines/reference/symbolProperty27.js b/tests/baselines/reference/symbolProperty27.js new file mode 100644 index 00000000000..f19d05233cb --- /dev/null +++ b/tests/baselines/reference/symbolProperty27.js @@ -0,0 +1,38 @@ +//// [symbolProperty27.ts] +class C1 { + [Symbol.toStringTag]() { + return {}; + } +} + +class C2 extends C1 { + [Symbol.toStringTag]() { + return ""; + } +} + +//// [symbolProperty27.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return {}; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + C2.prototype[Symbol.toStringTag] = function () { + return ""; + }; + return C2; +})(C1); diff --git a/tests/baselines/reference/symbolProperty27.types b/tests/baselines/reference/symbolProperty27.types new file mode 100644 index 00000000000..e6df5fa008f --- /dev/null +++ b/tests/baselines/reference/symbolProperty27.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty27.ts === +class C1 { +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : Symbol +>Symbol : SymbolConstructor +>toStringTag : Symbol + + return {}; +>{} : {} + } +} + +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : Symbol +>Symbol : SymbolConstructor +>toStringTag : Symbol + + return ""; + } +} diff --git a/tests/baselines/reference/symbolProperty28.js b/tests/baselines/reference/symbolProperty28.js new file mode 100644 index 00000000000..219a192e381 --- /dev/null +++ b/tests/baselines/reference/symbolProperty28.js @@ -0,0 +1,36 @@ +//// [symbolProperty28.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} + +class C2 extends C1 { } + +var c: C2; +var obj = c[Symbol.toStringTag]().x; + +//// [symbolProperty28.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + return C2; +})(C1); +var c; +var obj = c[Symbol.toStringTag]().x; diff --git a/tests/baselines/reference/symbolProperty29.js b/tests/baselines/reference/symbolProperty29.js new file mode 100644 index 00000000000..87088daa0a4 --- /dev/null +++ b/tests/baselines/reference/symbolProperty29.js @@ -0,0 +1,17 @@ +//// [symbolProperty29.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: Symbol]: () => { x: string }; +} + +//// [symbolProperty29.js] +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); diff --git a/tests/baselines/reference/symbolProperty29.types b/tests/baselines/reference/symbolProperty29.types new file mode 100644 index 00000000000..8ea46a1ac72 --- /dev/null +++ b/tests/baselines/reference/symbolProperty29.types @@ -0,0 +1,18 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty29.ts === +class C1 { +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : Symbol +>Symbol : SymbolConstructor +>toStringTag : Symbol + + return { x: "" }; +>{ x: "" } : { x: string; } +>x : string + } + [s: Symbol]: () => { x: string }; +>s : Symbol +>Symbol : Symbol +>x : string +} diff --git a/tests/baselines/reference/symbolProperty30.js b/tests/baselines/reference/symbolProperty30.js new file mode 100644 index 00000000000..daa08c51af1 --- /dev/null +++ b/tests/baselines/reference/symbolProperty30.js @@ -0,0 +1,17 @@ +//// [symbolProperty30.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: Symbol]: () => { x: number }; +} + +//// [symbolProperty30.js] +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); diff --git a/tests/baselines/reference/symbolProperty31.js b/tests/baselines/reference/symbolProperty31.js new file mode 100644 index 00000000000..986f49ad6ff --- /dev/null +++ b/tests/baselines/reference/symbolProperty31.js @@ -0,0 +1,32 @@ +//// [symbolProperty31.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 extends C1 { + [s: Symbol]: () => { x: string }; +} + +//// [symbolProperty31.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + return C2; +})(C1); diff --git a/tests/baselines/reference/symbolProperty31.types b/tests/baselines/reference/symbolProperty31.types new file mode 100644 index 00000000000..460bf4f62ec --- /dev/null +++ b/tests/baselines/reference/symbolProperty31.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty31.ts === +class C1 { +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : Symbol +>Symbol : SymbolConstructor +>toStringTag : Symbol + + return { x: "" }; +>{ x: "" } : { x: string; } +>x : string + } +} +class C2 extends C1 { +>C2 : C2 +>C1 : C1 + + [s: Symbol]: () => { x: string }; +>s : Symbol +>Symbol : Symbol +>x : string +} diff --git a/tests/baselines/reference/symbolProperty32.js b/tests/baselines/reference/symbolProperty32.js new file mode 100644 index 00000000000..260a88b41dd --- /dev/null +++ b/tests/baselines/reference/symbolProperty32.js @@ -0,0 +1,32 @@ +//// [symbolProperty32.ts] +class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 extends C1 { + [s: Symbol]: () => { x: number }; +} + +//// [symbolProperty32.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function () { + function C1() { + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(); +var C2 = (function (_super) { + __extends(C2, _super); + function C2() { + _super.apply(this, arguments); + } + return C2; +})(C1); diff --git a/tests/baselines/reference/symbolProperty33.js b/tests/baselines/reference/symbolProperty33.js new file mode 100644 index 00000000000..f891ba271d1 --- /dev/null +++ b/tests/baselines/reference/symbolProperty33.js @@ -0,0 +1,32 @@ +//// [symbolProperty33.ts] +class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 { + [s: Symbol]: () => { x: string }; +} + +//// [symbolProperty33.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function (_super) { + __extends(C1, _super); + function C1() { + _super.apply(this, arguments); + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(C2); +var C2 = (function () { + function C2() { + } + return C2; +})(); diff --git a/tests/baselines/reference/symbolProperty33.types b/tests/baselines/reference/symbolProperty33.types new file mode 100644 index 00000000000..cc2c1687622 --- /dev/null +++ b/tests/baselines/reference/symbolProperty33.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty33.ts === +class C1 extends C2 { +>C1 : C1 +>C2 : C2 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : Symbol +>Symbol : SymbolConstructor +>toStringTag : Symbol + + return { x: "" }; +>{ x: "" } : { x: string; } +>x : string + } +} +class C2 { +>C2 : C2 + + [s: Symbol]: () => { x: string }; +>s : Symbol +>Symbol : Symbol +>x : string +} diff --git a/tests/baselines/reference/symbolProperty34.js b/tests/baselines/reference/symbolProperty34.js new file mode 100644 index 00000000000..9a35db2c20f --- /dev/null +++ b/tests/baselines/reference/symbolProperty34.js @@ -0,0 +1,32 @@ +//// [symbolProperty34.ts] +class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } +} +class C2 { + [s: Symbol]: () => { x: number }; +} + +//// [symbolProperty34.js] +var __extends = this.__extends || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + __.prototype = b.prototype; + d.prototype = new __(); +}; +var C1 = (function (_super) { + __extends(C1, _super); + function C1() { + _super.apply(this, arguments); + } + C1.prototype[Symbol.toStringTag] = function () { + return { x: "" }; + }; + return C1; +})(C2); +var C2 = (function () { + function C2() { + } + return C2; +})(); diff --git a/tests/baselines/reference/symbolProperty35.js b/tests/baselines/reference/symbolProperty35.js new file mode 100644 index 00000000000..c96e4ce28b1 --- /dev/null +++ b/tests/baselines/reference/symbolProperty35.js @@ -0,0 +1,11 @@ +//// [symbolProperty35.ts] +interface I1 { + [Symbol.toStringTag](): { x: string } +} +interface I2 { + [Symbol.toStringTag](): { x: number } +} + +interface I3 extends I1, I2 { } + +//// [symbolProperty35.js] diff --git a/tests/baselines/reference/symbolProperty36.errors.txt b/tests/baselines/reference/symbolProperty36.errors.txt new file mode 100644 index 00000000000..6fe3299ab90 --- /dev/null +++ b/tests/baselines/reference/symbolProperty36.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty36.ts(2,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. +tests/cases/conformance/es6/Symbols/symbolProperty36.ts(3,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty36.ts (2 errors) ==== + var x = { + [Symbol.isConcatSpreadable]: 0, + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + [Symbol.isConcatSpreadable]: 1 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty36.js b/tests/baselines/reference/symbolProperty36.js new file mode 100644 index 00000000000..35d29d4892d --- /dev/null +++ b/tests/baselines/reference/symbolProperty36.js @@ -0,0 +1,11 @@ +//// [symbolProperty36.ts] +var x = { + [Symbol.isConcatSpreadable]: 0, + [Symbol.isConcatSpreadable]: 1 +} + +//// [symbolProperty36.js] +var x = { + [Symbol.isConcatSpreadable]: 0, + [Symbol.isConcatSpreadable]: 1 +}; diff --git a/tests/baselines/reference/symbolProperty37.errors.txt b/tests/baselines/reference/symbolProperty37.errors.txt new file mode 100644 index 00000000000..96e10e7f2a4 --- /dev/null +++ b/tests/baselines/reference/symbolProperty37.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty37.ts(2,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. +tests/cases/conformance/es6/Symbols/symbolProperty37.ts(3,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty37.ts (2 errors) ==== + interface I { + [Symbol.isConcatSpreadable]: string; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + [Symbol.isConcatSpreadable]: string; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty37.js b/tests/baselines/reference/symbolProperty37.js new file mode 100644 index 00000000000..2aaf97ef300 --- /dev/null +++ b/tests/baselines/reference/symbolProperty37.js @@ -0,0 +1,7 @@ +//// [symbolProperty37.ts] +interface I { + [Symbol.isConcatSpreadable]: string; + [Symbol.isConcatSpreadable]: string; +} + +//// [symbolProperty37.js] diff --git a/tests/baselines/reference/symbolProperty38.errors.txt b/tests/baselines/reference/symbolProperty38.errors.txt new file mode 100644 index 00000000000..a519f7eb9a3 --- /dev/null +++ b/tests/baselines/reference/symbolProperty38.errors.txt @@ -0,0 +1,15 @@ +tests/cases/conformance/es6/Symbols/symbolProperty38.ts(2,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. +tests/cases/conformance/es6/Symbols/symbolProperty38.ts(5,5): error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty38.ts (2 errors) ==== + interface I { + [Symbol.isConcatSpreadable]: string; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + } + interface I { + [Symbol.isConcatSpreadable]: string; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.isConcatSpreadable]'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty38.js b/tests/baselines/reference/symbolProperty38.js new file mode 100644 index 00000000000..b90b4d8081d --- /dev/null +++ b/tests/baselines/reference/symbolProperty38.js @@ -0,0 +1,9 @@ +//// [symbolProperty38.ts] +interface I { + [Symbol.isConcatSpreadable]: string; +} +interface I { + [Symbol.isConcatSpreadable]: string; +} + +//// [symbolProperty38.js] diff --git a/tests/baselines/reference/symbolProperty39.errors.txt b/tests/baselines/reference/symbolProperty39.errors.txt new file mode 100644 index 00000000000..62dbdfc591c --- /dev/null +++ b/tests/baselines/reference/symbolProperty39.errors.txt @@ -0,0 +1,25 @@ +tests/cases/conformance/es6/Symbols/symbolProperty39.ts(2,5): error TS2393: Duplicate function implementation. +tests/cases/conformance/es6/Symbols/symbolProperty39.ts(3,5): error TS2393: Duplicate function implementation. +tests/cases/conformance/es6/Symbols/symbolProperty39.ts(4,5): error TS2393: Duplicate function implementation. +tests/cases/conformance/es6/Symbols/symbolProperty39.ts(7,5): error TS2393: Duplicate function implementation. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty39.ts (4 errors) ==== + class C { + [Symbol.iterator](x: string): string; + ~~~~~~~~~~~~~~~~~ +!!! error TS2393: Duplicate function implementation. + [Symbol.iterator](x: number): number; + ~~~~~~~~~~~~~~~~~ +!!! error TS2393: Duplicate function implementation. + [Symbol.iterator](x: any) { + ~~~~~~~~~~~~~~~~~ +!!! error TS2393: Duplicate function implementation. + return undefined; + } + [Symbol.iterator](x: any) { + ~~~~~~~~~~~~~~~~~ +!!! error TS2393: Duplicate function implementation. + return undefined; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty39.js b/tests/baselines/reference/symbolProperty39.js new file mode 100644 index 00000000000..18551d20c0b --- /dev/null +++ b/tests/baselines/reference/symbolProperty39.js @@ -0,0 +1,24 @@ +//// [symbolProperty39.ts] +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } + [Symbol.iterator](x: any) { + return undefined; + } +} + +//// [symbolProperty39.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty40.js b/tests/baselines/reference/symbolProperty40.js new file mode 100644 index 00000000000..15d8c5c6fba --- /dev/null +++ b/tests/baselines/reference/symbolProperty40.js @@ -0,0 +1,26 @@ +//// [symbolProperty40.ts] +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } +} + +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator](0); + + +//// [symbolProperty40.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + return C; +})(); +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator](0); diff --git a/tests/baselines/reference/symbolProperty41.js b/tests/baselines/reference/symbolProperty41.js new file mode 100644 index 00000000000..d26b2c7682a --- /dev/null +++ b/tests/baselines/reference/symbolProperty41.js @@ -0,0 +1,26 @@ +//// [symbolProperty41.ts] +class C { + [Symbol.iterator](x: string): { x: string }; + [Symbol.iterator](x: "hello"): { x: string; hello: string }; + [Symbol.iterator](x: any) { + return undefined; + } +} + +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator]("hello"); + + +//// [symbolProperty41.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + return C; +})(); +var c = new C; +c[Symbol.iterator](""); +c[Symbol.iterator]("hello"); diff --git a/tests/baselines/reference/symbolProperty42.errors.txt b/tests/baselines/reference/symbolProperty42.errors.txt new file mode 100644 index 00000000000..291c1c1cc50 --- /dev/null +++ b/tests/baselines/reference/symbolProperty42.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/Symbols/symbolProperty42.ts(3,12): error TS2388: Function overload must not be static. +tests/cases/conformance/es6/Symbols/symbolProperty42.ts(4,5): error TS2387: Function overload must be static. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty42.ts (2 errors) ==== + class C { + [Symbol.iterator](x: string): string; + static [Symbol.iterator](x: number): number; + ~~~~~~~~~~~~~~~~~ +!!! error TS2388: Function overload must not be static. + [Symbol.iterator](x: any) { + ~~~~~~~~~~~~~~~~~ +!!! error TS2387: Function overload must be static. + return undefined; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty42.js b/tests/baselines/reference/symbolProperty42.js new file mode 100644 index 00000000000..1990f54066c --- /dev/null +++ b/tests/baselines/reference/symbolProperty42.js @@ -0,0 +1,18 @@ +//// [symbolProperty42.ts] +class C { + [Symbol.iterator](x: string): string; + static [Symbol.iterator](x: number): number; + [Symbol.iterator](x: any) { + return undefined; + } +} + +//// [symbolProperty42.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function (x) { + return undefined; + }; + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty43.errors.txt b/tests/baselines/reference/symbolProperty43.errors.txt new file mode 100644 index 00000000000..c5124c4cd22 --- /dev/null +++ b/tests/baselines/reference/symbolProperty43.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/es6/Symbols/symbolProperty43.ts(3,5): error TS2391: Function implementation is missing or not immediately following the declaration. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty43.ts (1 errors) ==== + class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; + ~~~~~~~~~~~~~~~~~ +!!! error TS2391: Function implementation is missing or not immediately following the declaration. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty43.js b/tests/baselines/reference/symbolProperty43.js new file mode 100644 index 00000000000..fcb1fd3f8e5 --- /dev/null +++ b/tests/baselines/reference/symbolProperty43.js @@ -0,0 +1,12 @@ +//// [symbolProperty43.ts] +class C { + [Symbol.iterator](x: string): string; + [Symbol.iterator](x: number): number; +} + +//// [symbolProperty43.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty44.errors.txt b/tests/baselines/reference/symbolProperty44.errors.txt new file mode 100644 index 00000000000..2cef480e736 --- /dev/null +++ b/tests/baselines/reference/symbolProperty44.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/Symbols/symbolProperty44.ts(2,9): error TS2300: Duplicate identifier '[Symbol.hasInstance]'. +tests/cases/conformance/es6/Symbols/symbolProperty44.ts(5,9): error TS2300: Duplicate identifier '[Symbol.hasInstance]'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty44.ts (2 errors) ==== + class C { + get [Symbol.hasInstance]() { + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.hasInstance]'. + return ""; + } + get [Symbol.hasInstance]() { + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2300: Duplicate identifier '[Symbol.hasInstance]'. + return ""; + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty44.js b/tests/baselines/reference/symbolProperty44.js new file mode 100644 index 00000000000..ff3dc81a6fa --- /dev/null +++ b/tests/baselines/reference/symbolProperty44.js @@ -0,0 +1,30 @@ +//// [symbolProperty44.ts] +class C { + get [Symbol.hasInstance]() { + return ""; + } + get [Symbol.hasInstance]() { + return ""; + } +} + +//// [symbolProperty44.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.hasInstance, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, Symbol.hasInstance, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty45.js b/tests/baselines/reference/symbolProperty45.js new file mode 100644 index 00000000000..d056aba9f56 --- /dev/null +++ b/tests/baselines/reference/symbolProperty45.js @@ -0,0 +1,30 @@ +//// [symbolProperty45.ts] +class C { + get [Symbol.hasInstance]() { + return ""; + } + get [Symbol.toPrimitive]() { + return ""; + } +} + +//// [symbolProperty45.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.hasInstance, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, Symbol.toPrimitive, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/baselines/reference/symbolProperty45.types b/tests/baselines/reference/symbolProperty45.types new file mode 100644 index 00000000000..41e50387f00 --- /dev/null +++ b/tests/baselines/reference/symbolProperty45.types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty45.ts === +class C { +>C : C + + get [Symbol.hasInstance]() { +>Symbol.hasInstance : Symbol +>Symbol : SymbolConstructor +>hasInstance : Symbol + + return ""; + } + get [Symbol.toPrimitive]() { +>Symbol.toPrimitive : Symbol +>Symbol : SymbolConstructor +>toPrimitive : Symbol + + return ""; + } +} diff --git a/tests/baselines/reference/symbolProperty46.js b/tests/baselines/reference/symbolProperty46.js new file mode 100644 index 00000000000..eb21e584941 --- /dev/null +++ b/tests/baselines/reference/symbolProperty46.js @@ -0,0 +1,35 @@ +//// [symbolProperty46.ts] +class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x) { + } +} + +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; + +//// [symbolProperty46.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.hasInstance, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, Symbol.hasInstance, { + // Should take a string + set: function (x) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; diff --git a/tests/baselines/reference/symbolProperty47.errors.txt b/tests/baselines/reference/symbolProperty47.errors.txt new file mode 100644 index 00000000000..8d16be2fd57 --- /dev/null +++ b/tests/baselines/reference/symbolProperty47.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/Symbols/symbolProperty47.ts(3,16): error TS2322: Type 'string' is not assignable to type 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty47.ts (1 errors) ==== + class C { + get [Symbol.hasInstance]() { + return ""; + ~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. + } + // Should take a string + set [Symbol.hasInstance](x: number) { + } + } + + (new C)[Symbol.hasInstance] = 0; + (new C)[Symbol.hasInstance] = ""; \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty47.js b/tests/baselines/reference/symbolProperty47.js new file mode 100644 index 00000000000..9dbd03e90a1 --- /dev/null +++ b/tests/baselines/reference/symbolProperty47.js @@ -0,0 +1,35 @@ +//// [symbolProperty47.ts] +class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x: number) { + } +} + +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; + +//// [symbolProperty47.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.hasInstance, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, Symbol.hasInstance, { + // Should take a string + set: function (x) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); +(new C)[Symbol.hasInstance] = 0; +(new C)[Symbol.hasInstance] = ""; diff --git a/tests/baselines/reference/symbolProperty48.js b/tests/baselines/reference/symbolProperty48.js new file mode 100644 index 00000000000..b0dc2b46dba --- /dev/null +++ b/tests/baselines/reference/symbolProperty48.js @@ -0,0 +1,21 @@ +//// [symbolProperty48.ts] +module M { + var Symbol; + + class C { + [Symbol.iterator]() { } + } +} + +//// [symbolProperty48.js] +var M; +(function (M) { + var Symbol; + var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { + }; + return C; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty49.js b/tests/baselines/reference/symbolProperty49.js new file mode 100644 index 00000000000..ea6e6f2c523 --- /dev/null +++ b/tests/baselines/reference/symbolProperty49.js @@ -0,0 +1,21 @@ +//// [symbolProperty49.ts] +module M { + export var Symbol; + + class C { + [Symbol.iterator]() { } + } +} + +//// [symbolProperty49.js] +var M; +(function (M) { + M.Symbol; + var C = (function () { + function C() { + } + C.prototype[M.Symbol.iterator] = function () { + }; + return C; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty50.js b/tests/baselines/reference/symbolProperty50.js new file mode 100644 index 00000000000..0a668e95509 --- /dev/null +++ b/tests/baselines/reference/symbolProperty50.js @@ -0,0 +1,20 @@ +//// [symbolProperty50.ts] +module M { + interface Symbol { } + + class C { + [Symbol.iterator]() { } + } +} + +//// [symbolProperty50.js] +var M; +(function (M) { + var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { + }; + return C; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty50.types b/tests/baselines/reference/symbolProperty50.types new file mode 100644 index 00000000000..6715f8bce2f --- /dev/null +++ b/tests/baselines/reference/symbolProperty50.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty50.ts === +module M { +>M : typeof M + + interface Symbol { } +>Symbol : Symbol + + class C { +>C : C + + [Symbol.iterator]() { } +>Symbol.iterator : Symbol +>Symbol : SymbolConstructor +>iterator : Symbol + } +} diff --git a/tests/baselines/reference/symbolProperty51.js b/tests/baselines/reference/symbolProperty51.js new file mode 100644 index 00000000000..b3b9902fcd6 --- /dev/null +++ b/tests/baselines/reference/symbolProperty51.js @@ -0,0 +1,20 @@ +//// [symbolProperty51.ts] +module M { + module Symbol { } + + class C { + [Symbol.iterator]() { } + } +} + +//// [symbolProperty51.js] +var M; +(function (M) { + var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { + }; + return C; + })(); +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty51.types b/tests/baselines/reference/symbolProperty51.types new file mode 100644 index 00000000000..b039e3e3b80 --- /dev/null +++ b/tests/baselines/reference/symbolProperty51.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty51.ts === +module M { +>M : typeof M + + module Symbol { } +>Symbol : unknown + + class C { +>C : C + + [Symbol.iterator]() { } +>Symbol.iterator : Symbol +>Symbol : SymbolConstructor +>iterator : Symbol + } +} diff --git a/tests/baselines/reference/symbolProperty52.errors.txt b/tests/baselines/reference/symbolProperty52.errors.txt new file mode 100644 index 00000000000..484dffbea96 --- /dev/null +++ b/tests/baselines/reference/symbolProperty52.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/Symbols/symbolProperty52.ts(2,13): error TS2339: Property 'nonsense' does not exist on type 'SymbolConstructor'. +tests/cases/conformance/es6/Symbols/symbolProperty52.ts(5,1): error TS2322: Type '{}' is not assignable to type '{ [Symbol.nonsense]: number; }'. + Property '[Symbol.nonsense]' is missing in type '{}'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty52.ts (2 errors) ==== + var obj = { + [Symbol.nonsense]: 0 + ~~~~~~~~ +!!! error TS2339: Property 'nonsense' does not exist on type 'SymbolConstructor'. + }; + + obj = {}; + ~~~ +!!! error TS2322: Type '{}' is not assignable to type '{ [Symbol.nonsense]: number; }'. +!!! error TS2322: Property '[Symbol.nonsense]' is missing in type '{}'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty52.js b/tests/baselines/reference/symbolProperty52.js new file mode 100644 index 00000000000..e3542b5a85f --- /dev/null +++ b/tests/baselines/reference/symbolProperty52.js @@ -0,0 +1,12 @@ +//// [symbolProperty52.ts] +var obj = { + [Symbol.nonsense]: 0 +}; + +obj = {}; + +//// [symbolProperty52.js] +var obj = { + [Symbol.nonsense]: 0 +}; +obj = {}; diff --git a/tests/baselines/reference/symbolProperty53.errors.txt b/tests/baselines/reference/symbolProperty53.errors.txt new file mode 100644 index 00000000000..87ec693263e --- /dev/null +++ b/tests/baselines/reference/symbolProperty53.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/Symbols/symbolProperty53.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty53.ts (1 errors) ==== + var obj = { + [Symbol.for]: 0 + ~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. + }; \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty53.js b/tests/baselines/reference/symbolProperty53.js new file mode 100644 index 00000000000..f302dff8924 --- /dev/null +++ b/tests/baselines/reference/symbolProperty53.js @@ -0,0 +1,9 @@ +//// [symbolProperty53.ts] +var obj = { + [Symbol.for]: 0 +}; + +//// [symbolProperty53.js] +var obj = { + [Symbol.for]: 0 +}; diff --git a/tests/baselines/reference/symbolProperty54.js b/tests/baselines/reference/symbolProperty54.js new file mode 100644 index 00000000000..ace8a7ca926 --- /dev/null +++ b/tests/baselines/reference/symbolProperty54.js @@ -0,0 +1,9 @@ +//// [symbolProperty54.ts] +var obj = { + [Symbol.prototype]: 0 +}; + +//// [symbolProperty54.js] +var obj = { + [Symbol.prototype]: 0 +}; diff --git a/tests/baselines/reference/symbolProperty9.errors.txt b/tests/baselines/reference/symbolProperty9.errors.txt new file mode 100644 index 00000000000..e621ab6c5a6 --- /dev/null +++ b/tests/baselines/reference/symbolProperty9.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/es6/Symbols/symbolProperty9.ts(10,5): error TS2322: Type 'I' is not assignable to type 'C'. + Types of property '[Symbol.iterator]' are incompatible. + Type '{ x: any; }' is not assignable to type '{ x: any; y: any; }'. + Property 'y' is missing in type '{ x: any; }'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty9.ts (1 errors) ==== + class C { + [Symbol.iterator]: { x; y }; + } + interface I { + [Symbol.iterator]: { x }; + } + + var i: I; + i = new C; + var c: C = i; + ~ +!!! error TS2322: Type 'I' is not assignable to type 'C'. +!!! error TS2322: Types of property '[Symbol.iterator]' are incompatible. +!!! error TS2322: Type '{ x: any; }' is not assignable to type '{ x: any; y: any; }'. +!!! error TS2322: Property 'y' is missing in type '{ x: any; }'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty9.js b/tests/baselines/reference/symbolProperty9.js new file mode 100644 index 00000000000..f97a1d44a21 --- /dev/null +++ b/tests/baselines/reference/symbolProperty9.js @@ -0,0 +1,21 @@ +//// [symbolProperty9.ts] +class C { + [Symbol.iterator]: { x; y }; +} +interface I { + [Symbol.iterator]: { x }; +} + +var i: I; +i = new C; +var c: C = i; + +//// [symbolProperty9.js] +var C = (function () { + function C() { + } + return C; +})(); +var i; +i = new C; +var c = i; From e508bf7e86939819a11a3591ba2bf204e6ac19e1 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 3 Feb 2015 15:50:56 -0800 Subject: [PATCH 022/162] Add symbol keyword --- src/compiler/checker.ts | 3 ++- src/compiler/emitter.ts | 1 + src/compiler/parser.ts | 2 ++ src/compiler/scanner.ts | 1 + src/compiler/types.ts | 1 + src/compiler/utilities.ts | 6 ------ src/services/formatting/tokenRange.ts | 2 +- src/services/services.ts | 3 ++- 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 68d41199de2..fde878c0533 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9751,6 +9751,7 @@ module ts { case SyntaxKind.NumberKeyword: case SyntaxKind.StringKeyword: case SyntaxKind.BooleanKeyword: + case SyntaxKind.SymbolKeyword: return true; case SyntaxKind.VoidKeyword: return node.parent.kind !== SyntaxKind.VoidExpression; @@ -10529,7 +10530,7 @@ module ts { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } if (parameter.type.kind !== SyntaxKind.StringKeyword && parameter.type.kind !== SyntaxKind.NumberKeyword) { - if (isESSymbolTypeNode(parameter.type)) { + if (parameter.type.kind === SyntaxKind.SymbolKeyword) { if (languageVersion < ScriptTarget.ES6) { return grammarErrorOnNode(parameter.type, Diagnostics.Symbol_indexers_are_only_available_when_targeting_ECMAScript_6_and_higher); } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 5acaf560273..4d7c7f9d3b0 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -579,6 +579,7 @@ module ts { case SyntaxKind.StringKeyword: case SyntaxKind.NumberKeyword: case SyntaxKind.BooleanKeyword: + case SyntaxKind.SymbolKeyword: case SyntaxKind.VoidKeyword: case SyntaxKind.StringLiteral: return writeTextOfNode(currentSourceFile, type); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 6942be3cf13..642821ffbcd 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -2515,6 +2515,7 @@ module ts { case SyntaxKind.StringKeyword: case SyntaxKind.NumberKeyword: case SyntaxKind.BooleanKeyword: + case SyntaxKind.SymbolKeyword: // If these are followed by a dot, then parse these out as a dotted type reference instead. var node = tryParse(parseKeywordAndNoDot); return node || parseTypeReference(); @@ -2539,6 +2540,7 @@ module ts { case SyntaxKind.StringKeyword: case SyntaxKind.NumberKeyword: case SyntaxKind.BooleanKeyword: + case SyntaxKind.SymbolKeyword: case SyntaxKind.VoidKeyword: case SyntaxKind.TypeOfKeyword: case SyntaxKind.OpenBraceToken: diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index fbbd69bbd69..f85df69f026 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -82,6 +82,7 @@ module ts { "string": SyntaxKind.StringKeyword, "super": SyntaxKind.SuperKeyword, "switch": SyntaxKind.SwitchKeyword, + "symbol": SyntaxKind.SymbolKeyword, "this": SyntaxKind.ThisKeyword, "throw": SyntaxKind.ThrowKeyword, "true": SyntaxKind.TrueKeyword, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 1c79ef169e9..96689afba1d 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -140,6 +140,7 @@ module ts { NumberKeyword, SetKeyword, StringKeyword, + SymbolKeyword, TypeKeyword, // Parse tree nodes diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index abf902d5fd1..9d8f5f9b563 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -852,12 +852,6 @@ module ts { return node.kind === SyntaxKind.PropertyAccessExpression && isESSymbolIdentifier((node).expression); } - export function isESSymbolTypeNode(node: Node): boolean { - return node.kind === SyntaxKind.TypeReference && - (node).typeArguments === undefined && - isESSymbolIdentifier((node).typeName); - } - /** * Includes the word "Symbol" with unicode escapes */ diff --git a/src/services/formatting/tokenRange.ts b/src/services/formatting/tokenRange.ts index 61fcb26dc9b..6dace543eab 100644 --- a/src/services/formatting/tokenRange.ts +++ b/src/services/formatting/tokenRange.ts @@ -134,7 +134,7 @@ module ts.formatting { static UnaryPredecrementExpressions = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.OpenParenToken, SyntaxKind.ThisKeyword, SyntaxKind.NewKeyword]); static UnaryPostdecrementExpressions = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.CloseParenToken, SyntaxKind.CloseBracketToken, SyntaxKind.NewKeyword]); static Comments = TokenRange.FromTokens([SyntaxKind.SingleLineCommentTrivia, SyntaxKind.MultiLineCommentTrivia]); - static TypeNames = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.NumberKeyword, SyntaxKind.StringKeyword, SyntaxKind.BooleanKeyword, SyntaxKind.VoidKeyword, SyntaxKind.AnyKeyword]); + static TypeNames = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.NumberKeyword, SyntaxKind.StringKeyword, SyntaxKind.BooleanKeyword, SyntaxKind.SymbolKeyword, SyntaxKind.VoidKeyword, SyntaxKind.AnyKeyword]); } } } \ No newline at end of file diff --git a/src/services/services.ts b/src/services/services.ts index fcb5c696a38..277f574578a 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -5754,7 +5754,8 @@ module ts { else if (token === SyntaxKind.AnyKeyword || token === SyntaxKind.StringKeyword || token === SyntaxKind.NumberKeyword || - token === SyntaxKind.BooleanKeyword) { + token === SyntaxKind.BooleanKeyword || + token === SyntaxKind.SymbolKeyword) { if (angleBracketStack > 0 && !classifyKeywordsInGenerics) { // If it looks like we're could be in something generic, don't classify this // as a keyword. We may just get overwritten by the syntactic classifier, From ebdd96bacf7f4b5d34cee0a8c9a262e4100a153e Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 3 Feb 2015 15:52:06 -0800 Subject: [PATCH 023/162] Update tests to use new symbol keyword --- .../baselines/reference/APISample_compile.js | 191 ++++++++-------- .../reference/APISample_compile.types | 193 ++++++++-------- tests/baselines/reference/APISample_linter.js | 209 +++++++++--------- .../reference/APISample_linter.types | 193 ++++++++-------- .../reference/APISample_transform.js | 191 ++++++++-------- .../reference/APISample_transform.types | 193 ++++++++-------- .../baselines/reference/APISample_watcher.js | 191 ++++++++-------- .../reference/APISample_watcher.types | 193 ++++++++-------- .../parserES5SymbolIndexer1.errors.txt | 7 +- .../reference/parserES5SymbolIndexer1.js | 6 + .../parserES5SymbolIndexer2.errors.txt | 7 +- .../reference/parserES5SymbolIndexer2.js | 11 + .../parserES5SymbolIndexer3.errors.txt | 7 +- .../reference/parserES5SymbolIndexer3.js | 7 + .../reference/parserES5SymbolProperty1.js | 6 + .../reference/parserES5SymbolProperty2.js | 6 + .../reference/parserES5SymbolProperty3.js | 6 + .../reference/parserES5SymbolProperty4.js | 6 + .../reference/parserES5SymbolProperty5.js | 11 + .../reference/parserES5SymbolProperty6.js | 12 + .../reference/parserES5SymbolProperty7.js | 13 ++ .../reference/parserES5SymbolProperty8.js | 7 + .../reference/parserES5SymbolProperty9.js | 7 + .../reference/parserSymbolIndexer1.js | 2 +- .../reference/parserSymbolIndexer2.js | 2 +- .../reference/parserSymbolIndexer3.errors.txt | 2 +- .../reference/parserSymbolIndexer3.js | 11 + .../reference/parserSymbolIndexer4.js | 2 +- .../reference/parserSymbolIndexer5.errors.txt | 7 +- .../reference/parserSymbolIndexer5.js | 10 + tests/baselines/reference/symbolProperty1.js | 2 +- tests/baselines/reference/symbolProperty17.js | 2 +- tests/baselines/reference/symbolProperty29.js | 2 +- tests/baselines/reference/symbolProperty30.js | 2 +- tests/baselines/reference/symbolProperty31.js | 2 +- tests/baselines/reference/symbolProperty32.js | 2 +- tests/baselines/reference/symbolProperty33.js | 2 +- tests/baselines/reference/symbolProperty34.js | 2 +- tests/baselines/reference/symbolProperty7.js | 26 +++ .../es6/Symbols/symbolProperty1.ts | 2 +- .../es6/Symbols/symbolProperty17.ts | 2 +- .../es6/Symbols/symbolProperty29.ts | 2 +- .../es6/Symbols/symbolProperty30.ts | 2 +- .../es6/Symbols/symbolProperty31.ts | 2 +- .../es6/Symbols/symbolProperty32.ts | 2 +- .../es6/Symbols/symbolProperty33.ts | 2 +- .../es6/Symbols/symbolProperty34.ts | 2 +- .../Symbols/parserES5SymbolIndexer1.ts | 2 +- .../Symbols/parserES5SymbolIndexer2.ts | 2 +- .../Symbols/parserES5SymbolIndexer3.ts | 2 +- .../Symbols/parserSymbolIndexer1.ts | 2 +- .../Symbols/parserSymbolIndexer2.ts | 2 +- .../Symbols/parserSymbolIndexer3.ts | 2 +- .../Symbols/parserSymbolIndexer4.ts | 2 +- .../Symbols/parserSymbolIndexer5.ts | 2 +- 55 files changed, 969 insertions(+), 814 deletions(-) create mode 100644 tests/baselines/reference/parserES5SymbolIndexer1.js create mode 100644 tests/baselines/reference/parserES5SymbolIndexer2.js create mode 100644 tests/baselines/reference/parserES5SymbolIndexer3.js create mode 100644 tests/baselines/reference/parserES5SymbolProperty1.js create mode 100644 tests/baselines/reference/parserES5SymbolProperty2.js create mode 100644 tests/baselines/reference/parserES5SymbolProperty3.js create mode 100644 tests/baselines/reference/parserES5SymbolProperty4.js create mode 100644 tests/baselines/reference/parserES5SymbolProperty5.js create mode 100644 tests/baselines/reference/parserES5SymbolProperty6.js create mode 100644 tests/baselines/reference/parserES5SymbolProperty7.js create mode 100644 tests/baselines/reference/parserES5SymbolProperty8.js create mode 100644 tests/baselines/reference/parserES5SymbolProperty9.js create mode 100644 tests/baselines/reference/parserSymbolIndexer3.js create mode 100644 tests/baselines/reference/parserSymbolIndexer5.js create mode 100644 tests/baselines/reference/symbolProperty7.js diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 6840f079972..cbf5cf290eb 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -179,110 +179,111 @@ declare module "typescript" { NumberKeyword = 117, SetKeyword = 118, StringKeyword = 119, - TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + SymbolKeyword = 120, + TypeKeyword = 121, + QualifiedName = 122, + ComputedPropertyName = 123, + TypeParameter = 124, + Parameter = 125, + PropertySignature = 126, + PropertyDeclaration = 127, + MethodSignature = 128, + MethodDeclaration = 129, + Constructor = 130, + GetAccessor = 131, + SetAccessor = 132, + CallSignature = 133, + ConstructSignature = 134, + IndexSignature = 135, + TypeReference = 136, + FunctionType = 137, + ConstructorType = 138, + TypeQuery = 139, + TypeLiteral = 140, + ArrayType = 141, + TupleType = 142, + UnionType = 143, + ParenthesizedType = 144, + ObjectBindingPattern = 145, + ArrayBindingPattern = 146, + BindingElement = 147, + ArrayLiteralExpression = 148, + ObjectLiteralExpression = 149, + PropertyAccessExpression = 150, + ElementAccessExpression = 151, + CallExpression = 152, + NewExpression = 153, + TaggedTemplateExpression = 154, + TypeAssertionExpression = 155, + ParenthesizedExpression = 156, + FunctionExpression = 157, + ArrowFunction = 158, + DeleteExpression = 159, + TypeOfExpression = 160, + VoidExpression = 161, + PrefixUnaryExpression = 162, + PostfixUnaryExpression = 163, + BinaryExpression = 164, + ConditionalExpression = 165, + TemplateExpression = 166, + YieldExpression = 167, + SpreadElementExpression = 168, + OmittedExpression = 169, + TemplateSpan = 170, + Block = 171, + VariableStatement = 172, + EmptyStatement = 173, + ExpressionStatement = 174, + IfStatement = 175, + DoStatement = 176, + WhileStatement = 177, + ForStatement = 178, + ForInStatement = 179, + ContinueStatement = 180, + BreakStatement = 181, + ReturnStatement = 182, + WithStatement = 183, + SwitchStatement = 184, + LabeledStatement = 185, + ThrowStatement = 186, + TryStatement = 187, + DebuggerStatement = 188, + VariableDeclaration = 189, + VariableDeclarationList = 190, + FunctionDeclaration = 191, + ClassDeclaration = 192, + InterfaceDeclaration = 193, + TypeAliasDeclaration = 194, + EnumDeclaration = 195, + ModuleDeclaration = 196, + ModuleBlock = 197, + ImportDeclaration = 198, + ExportAssignment = 199, + ExternalModuleReference = 200, + CaseClause = 201, + DefaultClause = 202, + HeritageClause = 203, + CatchClause = 204, + PropertyAssignment = 205, + ShorthandPropertyAssignment = 206, + EnumMember = 207, + SourceFile = 208, + SyntaxList = 209, + Count = 210, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 121, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 136, + LastTypeNode = 144, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 120, + LastToken = 121, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -291,7 +292,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 122, } const enum NodeFlags { Export = 1, diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index d70172377ca..7eff464a746 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -553,274 +553,277 @@ declare module "typescript" { StringKeyword = 119, >StringKeyword : SyntaxKind - TypeKeyword = 120, + SymbolKeyword = 120, +>SymbolKeyword : SyntaxKind + + TypeKeyword = 121, >TypeKeyword : SyntaxKind - QualifiedName = 121, + QualifiedName = 122, >QualifiedName : SyntaxKind - ComputedPropertyName = 122, + ComputedPropertyName = 123, >ComputedPropertyName : SyntaxKind - TypeParameter = 123, + TypeParameter = 124, >TypeParameter : SyntaxKind - Parameter = 124, + Parameter = 125, >Parameter : SyntaxKind - PropertySignature = 125, + PropertySignature = 126, >PropertySignature : SyntaxKind - PropertyDeclaration = 126, + PropertyDeclaration = 127, >PropertyDeclaration : SyntaxKind - MethodSignature = 127, + MethodSignature = 128, >MethodSignature : SyntaxKind - MethodDeclaration = 128, + MethodDeclaration = 129, >MethodDeclaration : SyntaxKind - Constructor = 129, + Constructor = 130, >Constructor : SyntaxKind - GetAccessor = 130, + GetAccessor = 131, >GetAccessor : SyntaxKind - SetAccessor = 131, + SetAccessor = 132, >SetAccessor : SyntaxKind - CallSignature = 132, + CallSignature = 133, >CallSignature : SyntaxKind - ConstructSignature = 133, + ConstructSignature = 134, >ConstructSignature : SyntaxKind - IndexSignature = 134, + IndexSignature = 135, >IndexSignature : SyntaxKind - TypeReference = 135, + TypeReference = 136, >TypeReference : SyntaxKind - FunctionType = 136, + FunctionType = 137, >FunctionType : SyntaxKind - ConstructorType = 137, + ConstructorType = 138, >ConstructorType : SyntaxKind - TypeQuery = 138, + TypeQuery = 139, >TypeQuery : SyntaxKind - TypeLiteral = 139, + TypeLiteral = 140, >TypeLiteral : SyntaxKind - ArrayType = 140, + ArrayType = 141, >ArrayType : SyntaxKind - TupleType = 141, + TupleType = 142, >TupleType : SyntaxKind - UnionType = 142, + UnionType = 143, >UnionType : SyntaxKind - ParenthesizedType = 143, + ParenthesizedType = 144, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 144, + ObjectBindingPattern = 145, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 145, + ArrayBindingPattern = 146, >ArrayBindingPattern : SyntaxKind - BindingElement = 146, + BindingElement = 147, >BindingElement : SyntaxKind - ArrayLiteralExpression = 147, + ArrayLiteralExpression = 148, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 148, + ObjectLiteralExpression = 149, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 149, + PropertyAccessExpression = 150, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 150, + ElementAccessExpression = 151, >ElementAccessExpression : SyntaxKind - CallExpression = 151, + CallExpression = 152, >CallExpression : SyntaxKind - NewExpression = 152, + NewExpression = 153, >NewExpression : SyntaxKind - TaggedTemplateExpression = 153, + TaggedTemplateExpression = 154, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 154, + TypeAssertionExpression = 155, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 155, + ParenthesizedExpression = 156, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 156, + FunctionExpression = 157, >FunctionExpression : SyntaxKind - ArrowFunction = 157, + ArrowFunction = 158, >ArrowFunction : SyntaxKind - DeleteExpression = 158, + DeleteExpression = 159, >DeleteExpression : SyntaxKind - TypeOfExpression = 159, + TypeOfExpression = 160, >TypeOfExpression : SyntaxKind - VoidExpression = 160, + VoidExpression = 161, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 161, + PrefixUnaryExpression = 162, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 162, + PostfixUnaryExpression = 163, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 163, + BinaryExpression = 164, >BinaryExpression : SyntaxKind - ConditionalExpression = 164, + ConditionalExpression = 165, >ConditionalExpression : SyntaxKind - TemplateExpression = 165, + TemplateExpression = 166, >TemplateExpression : SyntaxKind - YieldExpression = 166, + YieldExpression = 167, >YieldExpression : SyntaxKind - SpreadElementExpression = 167, + SpreadElementExpression = 168, >SpreadElementExpression : SyntaxKind - OmittedExpression = 168, + OmittedExpression = 169, >OmittedExpression : SyntaxKind - TemplateSpan = 169, + TemplateSpan = 170, >TemplateSpan : SyntaxKind - Block = 170, + Block = 171, >Block : SyntaxKind - VariableStatement = 171, + VariableStatement = 172, >VariableStatement : SyntaxKind - EmptyStatement = 172, + EmptyStatement = 173, >EmptyStatement : SyntaxKind - ExpressionStatement = 173, + ExpressionStatement = 174, >ExpressionStatement : SyntaxKind - IfStatement = 174, + IfStatement = 175, >IfStatement : SyntaxKind - DoStatement = 175, + DoStatement = 176, >DoStatement : SyntaxKind - WhileStatement = 176, + WhileStatement = 177, >WhileStatement : SyntaxKind - ForStatement = 177, + ForStatement = 178, >ForStatement : SyntaxKind - ForInStatement = 178, + ForInStatement = 179, >ForInStatement : SyntaxKind - ContinueStatement = 179, + ContinueStatement = 180, >ContinueStatement : SyntaxKind - BreakStatement = 180, + BreakStatement = 181, >BreakStatement : SyntaxKind - ReturnStatement = 181, + ReturnStatement = 182, >ReturnStatement : SyntaxKind - WithStatement = 182, + WithStatement = 183, >WithStatement : SyntaxKind - SwitchStatement = 183, + SwitchStatement = 184, >SwitchStatement : SyntaxKind - LabeledStatement = 184, + LabeledStatement = 185, >LabeledStatement : SyntaxKind - ThrowStatement = 185, + ThrowStatement = 186, >ThrowStatement : SyntaxKind - TryStatement = 186, + TryStatement = 187, >TryStatement : SyntaxKind - DebuggerStatement = 187, + DebuggerStatement = 188, >DebuggerStatement : SyntaxKind - VariableDeclaration = 188, + VariableDeclaration = 189, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 189, + VariableDeclarationList = 190, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 190, + FunctionDeclaration = 191, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 191, + ClassDeclaration = 192, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 192, + InterfaceDeclaration = 193, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 193, + TypeAliasDeclaration = 194, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 194, + EnumDeclaration = 195, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 195, + ModuleDeclaration = 196, >ModuleDeclaration : SyntaxKind - ModuleBlock = 196, + ModuleBlock = 197, >ModuleBlock : SyntaxKind - ImportDeclaration = 197, + ImportDeclaration = 198, >ImportDeclaration : SyntaxKind - ExportAssignment = 198, + ExportAssignment = 199, >ExportAssignment : SyntaxKind - ExternalModuleReference = 199, + ExternalModuleReference = 200, >ExternalModuleReference : SyntaxKind - CaseClause = 200, + CaseClause = 201, >CaseClause : SyntaxKind - DefaultClause = 201, + DefaultClause = 202, >DefaultClause : SyntaxKind - HeritageClause = 202, + HeritageClause = 203, >HeritageClause : SyntaxKind - CatchClause = 203, + CatchClause = 204, >CatchClause : SyntaxKind - PropertyAssignment = 204, + PropertyAssignment = 205, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 205, + ShorthandPropertyAssignment = 206, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 206, + EnumMember = 207, >EnumMember : SyntaxKind - SourceFile = 207, + SourceFile = 208, >SourceFile : SyntaxKind - SyntaxList = 208, + SyntaxList = 209, >SyntaxList : SyntaxKind - Count = 209, + Count = 210, >Count : SyntaxKind FirstAssignment = 52, @@ -838,7 +841,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 120, + LastKeyword = 121, >LastKeyword : SyntaxKind FirstFutureReservedWord = 101, @@ -847,10 +850,10 @@ declare module "typescript" { LastFutureReservedWord = 109, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 135, + FirstTypeNode = 136, >FirstTypeNode : SyntaxKind - LastTypeNode = 143, + LastTypeNode = 144, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -862,7 +865,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 120, + LastToken = 121, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -889,7 +892,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 121, + FirstNode = 122, >FirstNode : SyntaxKind } const enum NodeFlags { diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index c8bec722309..eab931162ad 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -210,110 +210,111 @@ declare module "typescript" { NumberKeyword = 117, SetKeyword = 118, StringKeyword = 119, - TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + SymbolKeyword = 120, + TypeKeyword = 121, + QualifiedName = 122, + ComputedPropertyName = 123, + TypeParameter = 124, + Parameter = 125, + PropertySignature = 126, + PropertyDeclaration = 127, + MethodSignature = 128, + MethodDeclaration = 129, + Constructor = 130, + GetAccessor = 131, + SetAccessor = 132, + CallSignature = 133, + ConstructSignature = 134, + IndexSignature = 135, + TypeReference = 136, + FunctionType = 137, + ConstructorType = 138, + TypeQuery = 139, + TypeLiteral = 140, + ArrayType = 141, + TupleType = 142, + UnionType = 143, + ParenthesizedType = 144, + ObjectBindingPattern = 145, + ArrayBindingPattern = 146, + BindingElement = 147, + ArrayLiteralExpression = 148, + ObjectLiteralExpression = 149, + PropertyAccessExpression = 150, + ElementAccessExpression = 151, + CallExpression = 152, + NewExpression = 153, + TaggedTemplateExpression = 154, + TypeAssertionExpression = 155, + ParenthesizedExpression = 156, + FunctionExpression = 157, + ArrowFunction = 158, + DeleteExpression = 159, + TypeOfExpression = 160, + VoidExpression = 161, + PrefixUnaryExpression = 162, + PostfixUnaryExpression = 163, + BinaryExpression = 164, + ConditionalExpression = 165, + TemplateExpression = 166, + YieldExpression = 167, + SpreadElementExpression = 168, + OmittedExpression = 169, + TemplateSpan = 170, + Block = 171, + VariableStatement = 172, + EmptyStatement = 173, + ExpressionStatement = 174, + IfStatement = 175, + DoStatement = 176, + WhileStatement = 177, + ForStatement = 178, + ForInStatement = 179, + ContinueStatement = 180, + BreakStatement = 181, + ReturnStatement = 182, + WithStatement = 183, + SwitchStatement = 184, + LabeledStatement = 185, + ThrowStatement = 186, + TryStatement = 187, + DebuggerStatement = 188, + VariableDeclaration = 189, + VariableDeclarationList = 190, + FunctionDeclaration = 191, + ClassDeclaration = 192, + InterfaceDeclaration = 193, + TypeAliasDeclaration = 194, + EnumDeclaration = 195, + ModuleDeclaration = 196, + ModuleBlock = 197, + ImportDeclaration = 198, + ExportAssignment = 199, + ExternalModuleReference = 200, + CaseClause = 201, + DefaultClause = 202, + HeritageClause = 203, + CatchClause = 204, + PropertyAssignment = 205, + ShorthandPropertyAssignment = 206, + EnumMember = 207, + SourceFile = 208, + SyntaxList = 209, + Count = 210, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 121, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 136, + LastTypeNode = 144, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 120, + LastToken = 121, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -322,7 +323,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 122, } const enum NodeFlags { Export = 1, @@ -1951,24 +1952,24 @@ function delint(sourceFile) { delintNode(sourceFile); function delintNode(node) { switch (node.kind) { - case 177 /* ForStatement */: - case 178 /* ForInStatement */: - case 176 /* WhileStatement */: - case 175 /* DoStatement */: - if (node.statement.kind !== 170 /* Block */) { + case 178 /* ForStatement */: + case 179 /* ForInStatement */: + case 177 /* WhileStatement */: + case 176 /* DoStatement */: + if (node.statement.kind !== 171 /* Block */) { report(node, "A looping statement's contents should be wrapped in a block body."); } break; - case 174 /* IfStatement */: + case 175 /* IfStatement */: var ifStatement = node; - if (ifStatement.thenStatement.kind !== 170 /* Block */) { + if (ifStatement.thenStatement.kind !== 171 /* Block */) { report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body."); } - if (ifStatement.elseStatement && ifStatement.elseStatement.kind !== 170 /* Block */ && ifStatement.elseStatement.kind !== 174 /* IfStatement */) { + if (ifStatement.elseStatement && ifStatement.elseStatement.kind !== 171 /* Block */ && ifStatement.elseStatement.kind !== 175 /* IfStatement */) { report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body."); } break; - case 163 /* BinaryExpression */: + case 164 /* BinaryExpression */: var op = node.operator; if (op === 28 /* EqualsEqualsToken */ || op === 29 /* ExclamationEqualsToken */) { report(node, "Use '===' and '!=='."); diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 26254c69d54..fcdbb57add6 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -697,274 +697,277 @@ declare module "typescript" { StringKeyword = 119, >StringKeyword : SyntaxKind - TypeKeyword = 120, + SymbolKeyword = 120, +>SymbolKeyword : SyntaxKind + + TypeKeyword = 121, >TypeKeyword : SyntaxKind - QualifiedName = 121, + QualifiedName = 122, >QualifiedName : SyntaxKind - ComputedPropertyName = 122, + ComputedPropertyName = 123, >ComputedPropertyName : SyntaxKind - TypeParameter = 123, + TypeParameter = 124, >TypeParameter : SyntaxKind - Parameter = 124, + Parameter = 125, >Parameter : SyntaxKind - PropertySignature = 125, + PropertySignature = 126, >PropertySignature : SyntaxKind - PropertyDeclaration = 126, + PropertyDeclaration = 127, >PropertyDeclaration : SyntaxKind - MethodSignature = 127, + MethodSignature = 128, >MethodSignature : SyntaxKind - MethodDeclaration = 128, + MethodDeclaration = 129, >MethodDeclaration : SyntaxKind - Constructor = 129, + Constructor = 130, >Constructor : SyntaxKind - GetAccessor = 130, + GetAccessor = 131, >GetAccessor : SyntaxKind - SetAccessor = 131, + SetAccessor = 132, >SetAccessor : SyntaxKind - CallSignature = 132, + CallSignature = 133, >CallSignature : SyntaxKind - ConstructSignature = 133, + ConstructSignature = 134, >ConstructSignature : SyntaxKind - IndexSignature = 134, + IndexSignature = 135, >IndexSignature : SyntaxKind - TypeReference = 135, + TypeReference = 136, >TypeReference : SyntaxKind - FunctionType = 136, + FunctionType = 137, >FunctionType : SyntaxKind - ConstructorType = 137, + ConstructorType = 138, >ConstructorType : SyntaxKind - TypeQuery = 138, + TypeQuery = 139, >TypeQuery : SyntaxKind - TypeLiteral = 139, + TypeLiteral = 140, >TypeLiteral : SyntaxKind - ArrayType = 140, + ArrayType = 141, >ArrayType : SyntaxKind - TupleType = 141, + TupleType = 142, >TupleType : SyntaxKind - UnionType = 142, + UnionType = 143, >UnionType : SyntaxKind - ParenthesizedType = 143, + ParenthesizedType = 144, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 144, + ObjectBindingPattern = 145, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 145, + ArrayBindingPattern = 146, >ArrayBindingPattern : SyntaxKind - BindingElement = 146, + BindingElement = 147, >BindingElement : SyntaxKind - ArrayLiteralExpression = 147, + ArrayLiteralExpression = 148, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 148, + ObjectLiteralExpression = 149, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 149, + PropertyAccessExpression = 150, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 150, + ElementAccessExpression = 151, >ElementAccessExpression : SyntaxKind - CallExpression = 151, + CallExpression = 152, >CallExpression : SyntaxKind - NewExpression = 152, + NewExpression = 153, >NewExpression : SyntaxKind - TaggedTemplateExpression = 153, + TaggedTemplateExpression = 154, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 154, + TypeAssertionExpression = 155, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 155, + ParenthesizedExpression = 156, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 156, + FunctionExpression = 157, >FunctionExpression : SyntaxKind - ArrowFunction = 157, + ArrowFunction = 158, >ArrowFunction : SyntaxKind - DeleteExpression = 158, + DeleteExpression = 159, >DeleteExpression : SyntaxKind - TypeOfExpression = 159, + TypeOfExpression = 160, >TypeOfExpression : SyntaxKind - VoidExpression = 160, + VoidExpression = 161, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 161, + PrefixUnaryExpression = 162, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 162, + PostfixUnaryExpression = 163, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 163, + BinaryExpression = 164, >BinaryExpression : SyntaxKind - ConditionalExpression = 164, + ConditionalExpression = 165, >ConditionalExpression : SyntaxKind - TemplateExpression = 165, + TemplateExpression = 166, >TemplateExpression : SyntaxKind - YieldExpression = 166, + YieldExpression = 167, >YieldExpression : SyntaxKind - SpreadElementExpression = 167, + SpreadElementExpression = 168, >SpreadElementExpression : SyntaxKind - OmittedExpression = 168, + OmittedExpression = 169, >OmittedExpression : SyntaxKind - TemplateSpan = 169, + TemplateSpan = 170, >TemplateSpan : SyntaxKind - Block = 170, + Block = 171, >Block : SyntaxKind - VariableStatement = 171, + VariableStatement = 172, >VariableStatement : SyntaxKind - EmptyStatement = 172, + EmptyStatement = 173, >EmptyStatement : SyntaxKind - ExpressionStatement = 173, + ExpressionStatement = 174, >ExpressionStatement : SyntaxKind - IfStatement = 174, + IfStatement = 175, >IfStatement : SyntaxKind - DoStatement = 175, + DoStatement = 176, >DoStatement : SyntaxKind - WhileStatement = 176, + WhileStatement = 177, >WhileStatement : SyntaxKind - ForStatement = 177, + ForStatement = 178, >ForStatement : SyntaxKind - ForInStatement = 178, + ForInStatement = 179, >ForInStatement : SyntaxKind - ContinueStatement = 179, + ContinueStatement = 180, >ContinueStatement : SyntaxKind - BreakStatement = 180, + BreakStatement = 181, >BreakStatement : SyntaxKind - ReturnStatement = 181, + ReturnStatement = 182, >ReturnStatement : SyntaxKind - WithStatement = 182, + WithStatement = 183, >WithStatement : SyntaxKind - SwitchStatement = 183, + SwitchStatement = 184, >SwitchStatement : SyntaxKind - LabeledStatement = 184, + LabeledStatement = 185, >LabeledStatement : SyntaxKind - ThrowStatement = 185, + ThrowStatement = 186, >ThrowStatement : SyntaxKind - TryStatement = 186, + TryStatement = 187, >TryStatement : SyntaxKind - DebuggerStatement = 187, + DebuggerStatement = 188, >DebuggerStatement : SyntaxKind - VariableDeclaration = 188, + VariableDeclaration = 189, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 189, + VariableDeclarationList = 190, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 190, + FunctionDeclaration = 191, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 191, + ClassDeclaration = 192, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 192, + InterfaceDeclaration = 193, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 193, + TypeAliasDeclaration = 194, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 194, + EnumDeclaration = 195, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 195, + ModuleDeclaration = 196, >ModuleDeclaration : SyntaxKind - ModuleBlock = 196, + ModuleBlock = 197, >ModuleBlock : SyntaxKind - ImportDeclaration = 197, + ImportDeclaration = 198, >ImportDeclaration : SyntaxKind - ExportAssignment = 198, + ExportAssignment = 199, >ExportAssignment : SyntaxKind - ExternalModuleReference = 199, + ExternalModuleReference = 200, >ExternalModuleReference : SyntaxKind - CaseClause = 200, + CaseClause = 201, >CaseClause : SyntaxKind - DefaultClause = 201, + DefaultClause = 202, >DefaultClause : SyntaxKind - HeritageClause = 202, + HeritageClause = 203, >HeritageClause : SyntaxKind - CatchClause = 203, + CatchClause = 204, >CatchClause : SyntaxKind - PropertyAssignment = 204, + PropertyAssignment = 205, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 205, + ShorthandPropertyAssignment = 206, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 206, + EnumMember = 207, >EnumMember : SyntaxKind - SourceFile = 207, + SourceFile = 208, >SourceFile : SyntaxKind - SyntaxList = 208, + SyntaxList = 209, >SyntaxList : SyntaxKind - Count = 209, + Count = 210, >Count : SyntaxKind FirstAssignment = 52, @@ -982,7 +985,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 120, + LastKeyword = 121, >LastKeyword : SyntaxKind FirstFutureReservedWord = 101, @@ -991,10 +994,10 @@ declare module "typescript" { LastFutureReservedWord = 109, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 135, + FirstTypeNode = 136, >FirstTypeNode : SyntaxKind - LastTypeNode = 143, + LastTypeNode = 144, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -1006,7 +1009,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 120, + LastToken = 121, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -1033,7 +1036,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 121, + FirstNode = 122, >FirstNode : SyntaxKind } const enum NodeFlags { diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index ad66d289eb7..e9c8d6fc0fd 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -211,110 +211,111 @@ declare module "typescript" { NumberKeyword = 117, SetKeyword = 118, StringKeyword = 119, - TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + SymbolKeyword = 120, + TypeKeyword = 121, + QualifiedName = 122, + ComputedPropertyName = 123, + TypeParameter = 124, + Parameter = 125, + PropertySignature = 126, + PropertyDeclaration = 127, + MethodSignature = 128, + MethodDeclaration = 129, + Constructor = 130, + GetAccessor = 131, + SetAccessor = 132, + CallSignature = 133, + ConstructSignature = 134, + IndexSignature = 135, + TypeReference = 136, + FunctionType = 137, + ConstructorType = 138, + TypeQuery = 139, + TypeLiteral = 140, + ArrayType = 141, + TupleType = 142, + UnionType = 143, + ParenthesizedType = 144, + ObjectBindingPattern = 145, + ArrayBindingPattern = 146, + BindingElement = 147, + ArrayLiteralExpression = 148, + ObjectLiteralExpression = 149, + PropertyAccessExpression = 150, + ElementAccessExpression = 151, + CallExpression = 152, + NewExpression = 153, + TaggedTemplateExpression = 154, + TypeAssertionExpression = 155, + ParenthesizedExpression = 156, + FunctionExpression = 157, + ArrowFunction = 158, + DeleteExpression = 159, + TypeOfExpression = 160, + VoidExpression = 161, + PrefixUnaryExpression = 162, + PostfixUnaryExpression = 163, + BinaryExpression = 164, + ConditionalExpression = 165, + TemplateExpression = 166, + YieldExpression = 167, + SpreadElementExpression = 168, + OmittedExpression = 169, + TemplateSpan = 170, + Block = 171, + VariableStatement = 172, + EmptyStatement = 173, + ExpressionStatement = 174, + IfStatement = 175, + DoStatement = 176, + WhileStatement = 177, + ForStatement = 178, + ForInStatement = 179, + ContinueStatement = 180, + BreakStatement = 181, + ReturnStatement = 182, + WithStatement = 183, + SwitchStatement = 184, + LabeledStatement = 185, + ThrowStatement = 186, + TryStatement = 187, + DebuggerStatement = 188, + VariableDeclaration = 189, + VariableDeclarationList = 190, + FunctionDeclaration = 191, + ClassDeclaration = 192, + InterfaceDeclaration = 193, + TypeAliasDeclaration = 194, + EnumDeclaration = 195, + ModuleDeclaration = 196, + ModuleBlock = 197, + ImportDeclaration = 198, + ExportAssignment = 199, + ExternalModuleReference = 200, + CaseClause = 201, + DefaultClause = 202, + HeritageClause = 203, + CatchClause = 204, + PropertyAssignment = 205, + ShorthandPropertyAssignment = 206, + EnumMember = 207, + SourceFile = 208, + SyntaxList = 209, + Count = 210, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 121, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 136, + LastTypeNode = 144, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 120, + LastToken = 121, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -323,7 +324,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 122, } const enum NodeFlags { Export = 1, diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index c6d74cc811d..2a9c7902528 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -649,274 +649,277 @@ declare module "typescript" { StringKeyword = 119, >StringKeyword : SyntaxKind - TypeKeyword = 120, + SymbolKeyword = 120, +>SymbolKeyword : SyntaxKind + + TypeKeyword = 121, >TypeKeyword : SyntaxKind - QualifiedName = 121, + QualifiedName = 122, >QualifiedName : SyntaxKind - ComputedPropertyName = 122, + ComputedPropertyName = 123, >ComputedPropertyName : SyntaxKind - TypeParameter = 123, + TypeParameter = 124, >TypeParameter : SyntaxKind - Parameter = 124, + Parameter = 125, >Parameter : SyntaxKind - PropertySignature = 125, + PropertySignature = 126, >PropertySignature : SyntaxKind - PropertyDeclaration = 126, + PropertyDeclaration = 127, >PropertyDeclaration : SyntaxKind - MethodSignature = 127, + MethodSignature = 128, >MethodSignature : SyntaxKind - MethodDeclaration = 128, + MethodDeclaration = 129, >MethodDeclaration : SyntaxKind - Constructor = 129, + Constructor = 130, >Constructor : SyntaxKind - GetAccessor = 130, + GetAccessor = 131, >GetAccessor : SyntaxKind - SetAccessor = 131, + SetAccessor = 132, >SetAccessor : SyntaxKind - CallSignature = 132, + CallSignature = 133, >CallSignature : SyntaxKind - ConstructSignature = 133, + ConstructSignature = 134, >ConstructSignature : SyntaxKind - IndexSignature = 134, + IndexSignature = 135, >IndexSignature : SyntaxKind - TypeReference = 135, + TypeReference = 136, >TypeReference : SyntaxKind - FunctionType = 136, + FunctionType = 137, >FunctionType : SyntaxKind - ConstructorType = 137, + ConstructorType = 138, >ConstructorType : SyntaxKind - TypeQuery = 138, + TypeQuery = 139, >TypeQuery : SyntaxKind - TypeLiteral = 139, + TypeLiteral = 140, >TypeLiteral : SyntaxKind - ArrayType = 140, + ArrayType = 141, >ArrayType : SyntaxKind - TupleType = 141, + TupleType = 142, >TupleType : SyntaxKind - UnionType = 142, + UnionType = 143, >UnionType : SyntaxKind - ParenthesizedType = 143, + ParenthesizedType = 144, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 144, + ObjectBindingPattern = 145, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 145, + ArrayBindingPattern = 146, >ArrayBindingPattern : SyntaxKind - BindingElement = 146, + BindingElement = 147, >BindingElement : SyntaxKind - ArrayLiteralExpression = 147, + ArrayLiteralExpression = 148, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 148, + ObjectLiteralExpression = 149, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 149, + PropertyAccessExpression = 150, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 150, + ElementAccessExpression = 151, >ElementAccessExpression : SyntaxKind - CallExpression = 151, + CallExpression = 152, >CallExpression : SyntaxKind - NewExpression = 152, + NewExpression = 153, >NewExpression : SyntaxKind - TaggedTemplateExpression = 153, + TaggedTemplateExpression = 154, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 154, + TypeAssertionExpression = 155, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 155, + ParenthesizedExpression = 156, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 156, + FunctionExpression = 157, >FunctionExpression : SyntaxKind - ArrowFunction = 157, + ArrowFunction = 158, >ArrowFunction : SyntaxKind - DeleteExpression = 158, + DeleteExpression = 159, >DeleteExpression : SyntaxKind - TypeOfExpression = 159, + TypeOfExpression = 160, >TypeOfExpression : SyntaxKind - VoidExpression = 160, + VoidExpression = 161, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 161, + PrefixUnaryExpression = 162, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 162, + PostfixUnaryExpression = 163, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 163, + BinaryExpression = 164, >BinaryExpression : SyntaxKind - ConditionalExpression = 164, + ConditionalExpression = 165, >ConditionalExpression : SyntaxKind - TemplateExpression = 165, + TemplateExpression = 166, >TemplateExpression : SyntaxKind - YieldExpression = 166, + YieldExpression = 167, >YieldExpression : SyntaxKind - SpreadElementExpression = 167, + SpreadElementExpression = 168, >SpreadElementExpression : SyntaxKind - OmittedExpression = 168, + OmittedExpression = 169, >OmittedExpression : SyntaxKind - TemplateSpan = 169, + TemplateSpan = 170, >TemplateSpan : SyntaxKind - Block = 170, + Block = 171, >Block : SyntaxKind - VariableStatement = 171, + VariableStatement = 172, >VariableStatement : SyntaxKind - EmptyStatement = 172, + EmptyStatement = 173, >EmptyStatement : SyntaxKind - ExpressionStatement = 173, + ExpressionStatement = 174, >ExpressionStatement : SyntaxKind - IfStatement = 174, + IfStatement = 175, >IfStatement : SyntaxKind - DoStatement = 175, + DoStatement = 176, >DoStatement : SyntaxKind - WhileStatement = 176, + WhileStatement = 177, >WhileStatement : SyntaxKind - ForStatement = 177, + ForStatement = 178, >ForStatement : SyntaxKind - ForInStatement = 178, + ForInStatement = 179, >ForInStatement : SyntaxKind - ContinueStatement = 179, + ContinueStatement = 180, >ContinueStatement : SyntaxKind - BreakStatement = 180, + BreakStatement = 181, >BreakStatement : SyntaxKind - ReturnStatement = 181, + ReturnStatement = 182, >ReturnStatement : SyntaxKind - WithStatement = 182, + WithStatement = 183, >WithStatement : SyntaxKind - SwitchStatement = 183, + SwitchStatement = 184, >SwitchStatement : SyntaxKind - LabeledStatement = 184, + LabeledStatement = 185, >LabeledStatement : SyntaxKind - ThrowStatement = 185, + ThrowStatement = 186, >ThrowStatement : SyntaxKind - TryStatement = 186, + TryStatement = 187, >TryStatement : SyntaxKind - DebuggerStatement = 187, + DebuggerStatement = 188, >DebuggerStatement : SyntaxKind - VariableDeclaration = 188, + VariableDeclaration = 189, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 189, + VariableDeclarationList = 190, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 190, + FunctionDeclaration = 191, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 191, + ClassDeclaration = 192, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 192, + InterfaceDeclaration = 193, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 193, + TypeAliasDeclaration = 194, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 194, + EnumDeclaration = 195, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 195, + ModuleDeclaration = 196, >ModuleDeclaration : SyntaxKind - ModuleBlock = 196, + ModuleBlock = 197, >ModuleBlock : SyntaxKind - ImportDeclaration = 197, + ImportDeclaration = 198, >ImportDeclaration : SyntaxKind - ExportAssignment = 198, + ExportAssignment = 199, >ExportAssignment : SyntaxKind - ExternalModuleReference = 199, + ExternalModuleReference = 200, >ExternalModuleReference : SyntaxKind - CaseClause = 200, + CaseClause = 201, >CaseClause : SyntaxKind - DefaultClause = 201, + DefaultClause = 202, >DefaultClause : SyntaxKind - HeritageClause = 202, + HeritageClause = 203, >HeritageClause : SyntaxKind - CatchClause = 203, + CatchClause = 204, >CatchClause : SyntaxKind - PropertyAssignment = 204, + PropertyAssignment = 205, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 205, + ShorthandPropertyAssignment = 206, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 206, + EnumMember = 207, >EnumMember : SyntaxKind - SourceFile = 207, + SourceFile = 208, >SourceFile : SyntaxKind - SyntaxList = 208, + SyntaxList = 209, >SyntaxList : SyntaxKind - Count = 209, + Count = 210, >Count : SyntaxKind FirstAssignment = 52, @@ -934,7 +937,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 120, + LastKeyword = 121, >LastKeyword : SyntaxKind FirstFutureReservedWord = 101, @@ -943,10 +946,10 @@ declare module "typescript" { LastFutureReservedWord = 109, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 135, + FirstTypeNode = 136, >FirstTypeNode : SyntaxKind - LastTypeNode = 143, + LastTypeNode = 144, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -958,7 +961,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 120, + LastToken = 121, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -985,7 +988,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 121, + FirstNode = 122, >FirstNode : SyntaxKind } const enum NodeFlags { diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 2add8dfd45e..dae4936f7b0 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -248,110 +248,111 @@ declare module "typescript" { NumberKeyword = 117, SetKeyword = 118, StringKeyword = 119, - TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + SymbolKeyword = 120, + TypeKeyword = 121, + QualifiedName = 122, + ComputedPropertyName = 123, + TypeParameter = 124, + Parameter = 125, + PropertySignature = 126, + PropertyDeclaration = 127, + MethodSignature = 128, + MethodDeclaration = 129, + Constructor = 130, + GetAccessor = 131, + SetAccessor = 132, + CallSignature = 133, + ConstructSignature = 134, + IndexSignature = 135, + TypeReference = 136, + FunctionType = 137, + ConstructorType = 138, + TypeQuery = 139, + TypeLiteral = 140, + ArrayType = 141, + TupleType = 142, + UnionType = 143, + ParenthesizedType = 144, + ObjectBindingPattern = 145, + ArrayBindingPattern = 146, + BindingElement = 147, + ArrayLiteralExpression = 148, + ObjectLiteralExpression = 149, + PropertyAccessExpression = 150, + ElementAccessExpression = 151, + CallExpression = 152, + NewExpression = 153, + TaggedTemplateExpression = 154, + TypeAssertionExpression = 155, + ParenthesizedExpression = 156, + FunctionExpression = 157, + ArrowFunction = 158, + DeleteExpression = 159, + TypeOfExpression = 160, + VoidExpression = 161, + PrefixUnaryExpression = 162, + PostfixUnaryExpression = 163, + BinaryExpression = 164, + ConditionalExpression = 165, + TemplateExpression = 166, + YieldExpression = 167, + SpreadElementExpression = 168, + OmittedExpression = 169, + TemplateSpan = 170, + Block = 171, + VariableStatement = 172, + EmptyStatement = 173, + ExpressionStatement = 174, + IfStatement = 175, + DoStatement = 176, + WhileStatement = 177, + ForStatement = 178, + ForInStatement = 179, + ContinueStatement = 180, + BreakStatement = 181, + ReturnStatement = 182, + WithStatement = 183, + SwitchStatement = 184, + LabeledStatement = 185, + ThrowStatement = 186, + TryStatement = 187, + DebuggerStatement = 188, + VariableDeclaration = 189, + VariableDeclarationList = 190, + FunctionDeclaration = 191, + ClassDeclaration = 192, + InterfaceDeclaration = 193, + TypeAliasDeclaration = 194, + EnumDeclaration = 195, + ModuleDeclaration = 196, + ModuleBlock = 197, + ImportDeclaration = 198, + ExportAssignment = 199, + ExternalModuleReference = 200, + CaseClause = 201, + DefaultClause = 202, + HeritageClause = 203, + CatchClause = 204, + PropertyAssignment = 205, + ShorthandPropertyAssignment = 206, + EnumMember = 207, + SourceFile = 208, + SyntaxList = 209, + Count = 210, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 121, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 136, + LastTypeNode = 144, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 120, + LastToken = 121, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, @@ -360,7 +361,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 122, } const enum NodeFlags { Export = 1, diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 3af8537fdb7..a8d9197f753 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -822,274 +822,277 @@ declare module "typescript" { StringKeyword = 119, >StringKeyword : SyntaxKind - TypeKeyword = 120, + SymbolKeyword = 120, +>SymbolKeyword : SyntaxKind + + TypeKeyword = 121, >TypeKeyword : SyntaxKind - QualifiedName = 121, + QualifiedName = 122, >QualifiedName : SyntaxKind - ComputedPropertyName = 122, + ComputedPropertyName = 123, >ComputedPropertyName : SyntaxKind - TypeParameter = 123, + TypeParameter = 124, >TypeParameter : SyntaxKind - Parameter = 124, + Parameter = 125, >Parameter : SyntaxKind - PropertySignature = 125, + PropertySignature = 126, >PropertySignature : SyntaxKind - PropertyDeclaration = 126, + PropertyDeclaration = 127, >PropertyDeclaration : SyntaxKind - MethodSignature = 127, + MethodSignature = 128, >MethodSignature : SyntaxKind - MethodDeclaration = 128, + MethodDeclaration = 129, >MethodDeclaration : SyntaxKind - Constructor = 129, + Constructor = 130, >Constructor : SyntaxKind - GetAccessor = 130, + GetAccessor = 131, >GetAccessor : SyntaxKind - SetAccessor = 131, + SetAccessor = 132, >SetAccessor : SyntaxKind - CallSignature = 132, + CallSignature = 133, >CallSignature : SyntaxKind - ConstructSignature = 133, + ConstructSignature = 134, >ConstructSignature : SyntaxKind - IndexSignature = 134, + IndexSignature = 135, >IndexSignature : SyntaxKind - TypeReference = 135, + TypeReference = 136, >TypeReference : SyntaxKind - FunctionType = 136, + FunctionType = 137, >FunctionType : SyntaxKind - ConstructorType = 137, + ConstructorType = 138, >ConstructorType : SyntaxKind - TypeQuery = 138, + TypeQuery = 139, >TypeQuery : SyntaxKind - TypeLiteral = 139, + TypeLiteral = 140, >TypeLiteral : SyntaxKind - ArrayType = 140, + ArrayType = 141, >ArrayType : SyntaxKind - TupleType = 141, + TupleType = 142, >TupleType : SyntaxKind - UnionType = 142, + UnionType = 143, >UnionType : SyntaxKind - ParenthesizedType = 143, + ParenthesizedType = 144, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 144, + ObjectBindingPattern = 145, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 145, + ArrayBindingPattern = 146, >ArrayBindingPattern : SyntaxKind - BindingElement = 146, + BindingElement = 147, >BindingElement : SyntaxKind - ArrayLiteralExpression = 147, + ArrayLiteralExpression = 148, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 148, + ObjectLiteralExpression = 149, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 149, + PropertyAccessExpression = 150, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 150, + ElementAccessExpression = 151, >ElementAccessExpression : SyntaxKind - CallExpression = 151, + CallExpression = 152, >CallExpression : SyntaxKind - NewExpression = 152, + NewExpression = 153, >NewExpression : SyntaxKind - TaggedTemplateExpression = 153, + TaggedTemplateExpression = 154, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 154, + TypeAssertionExpression = 155, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 155, + ParenthesizedExpression = 156, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 156, + FunctionExpression = 157, >FunctionExpression : SyntaxKind - ArrowFunction = 157, + ArrowFunction = 158, >ArrowFunction : SyntaxKind - DeleteExpression = 158, + DeleteExpression = 159, >DeleteExpression : SyntaxKind - TypeOfExpression = 159, + TypeOfExpression = 160, >TypeOfExpression : SyntaxKind - VoidExpression = 160, + VoidExpression = 161, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 161, + PrefixUnaryExpression = 162, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 162, + PostfixUnaryExpression = 163, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 163, + BinaryExpression = 164, >BinaryExpression : SyntaxKind - ConditionalExpression = 164, + ConditionalExpression = 165, >ConditionalExpression : SyntaxKind - TemplateExpression = 165, + TemplateExpression = 166, >TemplateExpression : SyntaxKind - YieldExpression = 166, + YieldExpression = 167, >YieldExpression : SyntaxKind - SpreadElementExpression = 167, + SpreadElementExpression = 168, >SpreadElementExpression : SyntaxKind - OmittedExpression = 168, + OmittedExpression = 169, >OmittedExpression : SyntaxKind - TemplateSpan = 169, + TemplateSpan = 170, >TemplateSpan : SyntaxKind - Block = 170, + Block = 171, >Block : SyntaxKind - VariableStatement = 171, + VariableStatement = 172, >VariableStatement : SyntaxKind - EmptyStatement = 172, + EmptyStatement = 173, >EmptyStatement : SyntaxKind - ExpressionStatement = 173, + ExpressionStatement = 174, >ExpressionStatement : SyntaxKind - IfStatement = 174, + IfStatement = 175, >IfStatement : SyntaxKind - DoStatement = 175, + DoStatement = 176, >DoStatement : SyntaxKind - WhileStatement = 176, + WhileStatement = 177, >WhileStatement : SyntaxKind - ForStatement = 177, + ForStatement = 178, >ForStatement : SyntaxKind - ForInStatement = 178, + ForInStatement = 179, >ForInStatement : SyntaxKind - ContinueStatement = 179, + ContinueStatement = 180, >ContinueStatement : SyntaxKind - BreakStatement = 180, + BreakStatement = 181, >BreakStatement : SyntaxKind - ReturnStatement = 181, + ReturnStatement = 182, >ReturnStatement : SyntaxKind - WithStatement = 182, + WithStatement = 183, >WithStatement : SyntaxKind - SwitchStatement = 183, + SwitchStatement = 184, >SwitchStatement : SyntaxKind - LabeledStatement = 184, + LabeledStatement = 185, >LabeledStatement : SyntaxKind - ThrowStatement = 185, + ThrowStatement = 186, >ThrowStatement : SyntaxKind - TryStatement = 186, + TryStatement = 187, >TryStatement : SyntaxKind - DebuggerStatement = 187, + DebuggerStatement = 188, >DebuggerStatement : SyntaxKind - VariableDeclaration = 188, + VariableDeclaration = 189, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 189, + VariableDeclarationList = 190, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 190, + FunctionDeclaration = 191, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 191, + ClassDeclaration = 192, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 192, + InterfaceDeclaration = 193, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 193, + TypeAliasDeclaration = 194, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 194, + EnumDeclaration = 195, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 195, + ModuleDeclaration = 196, >ModuleDeclaration : SyntaxKind - ModuleBlock = 196, + ModuleBlock = 197, >ModuleBlock : SyntaxKind - ImportDeclaration = 197, + ImportDeclaration = 198, >ImportDeclaration : SyntaxKind - ExportAssignment = 198, + ExportAssignment = 199, >ExportAssignment : SyntaxKind - ExternalModuleReference = 199, + ExternalModuleReference = 200, >ExternalModuleReference : SyntaxKind - CaseClause = 200, + CaseClause = 201, >CaseClause : SyntaxKind - DefaultClause = 201, + DefaultClause = 202, >DefaultClause : SyntaxKind - HeritageClause = 202, + HeritageClause = 203, >HeritageClause : SyntaxKind - CatchClause = 203, + CatchClause = 204, >CatchClause : SyntaxKind - PropertyAssignment = 204, + PropertyAssignment = 205, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 205, + ShorthandPropertyAssignment = 206, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 206, + EnumMember = 207, >EnumMember : SyntaxKind - SourceFile = 207, + SourceFile = 208, >SourceFile : SyntaxKind - SyntaxList = 208, + SyntaxList = 209, >SyntaxList : SyntaxKind - Count = 209, + Count = 210, >Count : SyntaxKind FirstAssignment = 52, @@ -1107,7 +1110,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 120, + LastKeyword = 121, >LastKeyword : SyntaxKind FirstFutureReservedWord = 101, @@ -1116,10 +1119,10 @@ declare module "typescript" { LastFutureReservedWord = 109, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 135, + FirstTypeNode = 136, >FirstTypeNode : SyntaxKind - LastTypeNode = 143, + LastTypeNode = 144, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -1131,7 +1134,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 120, + LastToken = 121, >LastToken : SyntaxKind FirstTriviaToken = 2, @@ -1158,7 +1161,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 121, + FirstNode = 122, >FirstNode : SyntaxKind } const enum NodeFlags { diff --git a/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt index 8128f95d3b6..a5ff176db61 100644 --- a/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt +++ b/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt @@ -1,12 +1,9 @@ tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts(2,9): error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts(2,9): error TS2304: Cannot find name 'Symbol'. -==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts (1 errors) ==== interface I { - [s: Symbol]: string; + [s: symbol]: string; ~~~~~~ !!! error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher. - ~~~~~~ -!!! error TS2304: Cannot find name 'Symbol'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer1.js b/tests/baselines/reference/parserES5SymbolIndexer1.js new file mode 100644 index 00000000000..641d93b1170 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer1.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolIndexer1.ts] +interface I { + [s: symbol]: string; +} + +//// [parserES5SymbolIndexer1.js] diff --git a/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt index b1904d0fe53..de4c97aae29 100644 --- a/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt +++ b/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt @@ -1,12 +1,9 @@ tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts(2,9): error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts(2,9): error TS2304: Cannot find name 'Symbol'. -==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts (1 errors) ==== class C { - [s: Symbol]: string; + [s: symbol]: string; ~~~~~~ !!! error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher. - ~~~~~~ -!!! error TS2304: Cannot find name 'Symbol'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer2.js b/tests/baselines/reference/parserES5SymbolIndexer2.js new file mode 100644 index 00000000000..c511b6acafa --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer2.js @@ -0,0 +1,11 @@ +//// [parserES5SymbolIndexer2.ts] +class C { + [s: symbol]: string; +} + +//// [parserES5SymbolIndexer2.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt index bc1bc64aeda..e839338e772 100644 --- a/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt +++ b/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt @@ -1,12 +1,9 @@ tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts(2,9): error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher. -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts(2,9): error TS2304: Cannot find name 'Symbol'. -==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts (1 errors) ==== var x: { - [s: Symbol]: string; + [s: symbol]: string; ~~~~~~ !!! error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher. - ~~~~~~ -!!! error TS2304: Cannot find name 'Symbol'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer3.js b/tests/baselines/reference/parserES5SymbolIndexer3.js new file mode 100644 index 00000000000..daffb51a6d7 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolIndexer3.js @@ -0,0 +1,7 @@ +//// [parserES5SymbolIndexer3.ts] +var x: { + [s: symbol]: string; +} + +//// [parserES5SymbolIndexer3.js] +var x; diff --git a/tests/baselines/reference/parserES5SymbolProperty1.js b/tests/baselines/reference/parserES5SymbolProperty1.js new file mode 100644 index 00000000000..36030aec105 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty1.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolProperty1.ts] +interface I { + [Symbol.iterator]: string; +} + +//// [parserES5SymbolProperty1.js] diff --git a/tests/baselines/reference/parserES5SymbolProperty2.js b/tests/baselines/reference/parserES5SymbolProperty2.js new file mode 100644 index 00000000000..d600b05ea52 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty2.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolProperty2.ts] +interface I { + [Symbol.unscopables](): string; +} + +//// [parserES5SymbolProperty2.js] diff --git a/tests/baselines/reference/parserES5SymbolProperty3.js b/tests/baselines/reference/parserES5SymbolProperty3.js new file mode 100644 index 00000000000..0d0fb18313f --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty3.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolProperty3.ts] +declare class C { + [Symbol.unscopables](): string; +} + +//// [parserES5SymbolProperty3.js] diff --git a/tests/baselines/reference/parserES5SymbolProperty4.js b/tests/baselines/reference/parserES5SymbolProperty4.js new file mode 100644 index 00000000000..d8f55358e73 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty4.js @@ -0,0 +1,6 @@ +//// [parserES5SymbolProperty4.ts] +declare class C { + [Symbol.isRegExp]: string; +} + +//// [parserES5SymbolProperty4.js] diff --git a/tests/baselines/reference/parserES5SymbolProperty5.js b/tests/baselines/reference/parserES5SymbolProperty5.js new file mode 100644 index 00000000000..e2448432542 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty5.js @@ -0,0 +1,11 @@ +//// [parserES5SymbolProperty5.ts] +class C { + [Symbol.isRegExp]: string; +} + +//// [parserES5SymbolProperty5.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserES5SymbolProperty6.js b/tests/baselines/reference/parserES5SymbolProperty6.js new file mode 100644 index 00000000000..ce2050688c3 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty6.js @@ -0,0 +1,12 @@ +//// [parserES5SymbolProperty6.ts] +class C { + [Symbol.toStringTag]: string = ""; +} + +//// [parserES5SymbolProperty6.js] +var C = (function () { + function C() { + this[Symbol.toStringTag] = ""; + } + return C; +})(); diff --git a/tests/baselines/reference/parserES5SymbolProperty7.js b/tests/baselines/reference/parserES5SymbolProperty7.js new file mode 100644 index 00000000000..b6096b798df --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty7.js @@ -0,0 +1,13 @@ +//// [parserES5SymbolProperty7.ts] +class C { + [Symbol.toStringTag](): void { } +} + +//// [parserES5SymbolProperty7.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.toStringTag] = function () { + }; + return C; +})(); diff --git a/tests/baselines/reference/parserES5SymbolProperty8.js b/tests/baselines/reference/parserES5SymbolProperty8.js new file mode 100644 index 00000000000..ed3a55db0f2 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty8.js @@ -0,0 +1,7 @@ +//// [parserES5SymbolProperty8.ts] +var x: { + [Symbol.toPrimitive](): string +} + +//// [parserES5SymbolProperty8.js] +var x; diff --git a/tests/baselines/reference/parserES5SymbolProperty9.js b/tests/baselines/reference/parserES5SymbolProperty9.js new file mode 100644 index 00000000000..4728765e553 --- /dev/null +++ b/tests/baselines/reference/parserES5SymbolProperty9.js @@ -0,0 +1,7 @@ +//// [parserES5SymbolProperty9.ts] +var x: { + [Symbol.toPrimitive]: string +} + +//// [parserES5SymbolProperty9.js] +var x; diff --git a/tests/baselines/reference/parserSymbolIndexer1.js b/tests/baselines/reference/parserSymbolIndexer1.js index 4c99edda168..752391dad53 100644 --- a/tests/baselines/reference/parserSymbolIndexer1.js +++ b/tests/baselines/reference/parserSymbolIndexer1.js @@ -1,6 +1,6 @@ //// [parserSymbolIndexer1.ts] interface I { - [s: Symbol]: string; + [s: symbol]: string; } //// [parserSymbolIndexer1.js] diff --git a/tests/baselines/reference/parserSymbolIndexer2.js b/tests/baselines/reference/parserSymbolIndexer2.js index 1acae44ae2a..563614e1c8c 100644 --- a/tests/baselines/reference/parserSymbolIndexer2.js +++ b/tests/baselines/reference/parserSymbolIndexer2.js @@ -1,6 +1,6 @@ //// [parserSymbolIndexer2.ts] class C { - [s: Symbol]: string; + [s: symbol]: string; } //// [parserSymbolIndexer2.js] diff --git a/tests/baselines/reference/parserSymbolIndexer3.errors.txt b/tests/baselines/reference/parserSymbolIndexer3.errors.txt index f5066a09ee9..df3b9596f79 100644 --- a/tests/baselines/reference/parserSymbolIndexer3.errors.txt +++ b/tests/baselines/reference/parserSymbolIndexer3.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts(2,5): ==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts (1 errors) ==== class C { - static [s: Symbol]: string; + static [s: symbol]: string; ~~~~~~ !!! error TS1145: Modifiers not permitted on index signature members. } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer3.js b/tests/baselines/reference/parserSymbolIndexer3.js new file mode 100644 index 00000000000..917945193ae --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer3.js @@ -0,0 +1,11 @@ +//// [parserSymbolIndexer3.ts] +class C { + static [s: symbol]: string; +} + +//// [parserSymbolIndexer3.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/parserSymbolIndexer4.js b/tests/baselines/reference/parserSymbolIndexer4.js index 607b1ada481..21367ca5969 100644 --- a/tests/baselines/reference/parserSymbolIndexer4.js +++ b/tests/baselines/reference/parserSymbolIndexer4.js @@ -1,6 +1,6 @@ //// [parserSymbolIndexer4.ts] var x: { - [s: Symbol]: string; + [s: symbol]: string; } //// [parserSymbolIndexer4.js] diff --git a/tests/baselines/reference/parserSymbolIndexer5.errors.txt b/tests/baselines/reference/parserSymbolIndexer5.errors.txt index 611ad109a34..a8c19338e01 100644 --- a/tests/baselines/reference/parserSymbolIndexer5.errors.txt +++ b/tests/baselines/reference/parserSymbolIndexer5.errors.txt @@ -1,17 +1,20 @@ tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,6): error TS2304: Cannot find name 's'. tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,7): error TS1005: ']' expected. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,9): error TS2304: Cannot find name 'symbol'. tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,15): error TS1005: ',' expected. tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(2,16): error TS1136: Property assignment expected. tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts(3,1): error TS1005: ':' expected. -==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts (5 errors) ==== +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts (6 errors) ==== var x = { - [s: Symbol]: "" + [s: symbol]: "" ~ !!! error TS2304: Cannot find name 's'. ~ !!! error TS1005: ']' expected. + ~~~~~~ +!!! error TS2304: Cannot find name 'symbol'. ~ !!! error TS1005: ',' expected. ~ diff --git a/tests/baselines/reference/parserSymbolIndexer5.js b/tests/baselines/reference/parserSymbolIndexer5.js new file mode 100644 index 00000000000..43c456b64aa --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer5.js @@ -0,0 +1,10 @@ +//// [parserSymbolIndexer5.ts] +var x = { + [s: symbol]: "" +} + +//// [parserSymbolIndexer5.js] +var x = { + [s]: symbol, + "": +}; diff --git a/tests/baselines/reference/symbolProperty1.js b/tests/baselines/reference/symbolProperty1.js index e5189d0c88f..1537883f4ec 100644 --- a/tests/baselines/reference/symbolProperty1.js +++ b/tests/baselines/reference/symbolProperty1.js @@ -1,5 +1,5 @@ //// [symbolProperty1.ts] -var s: Symbol; +var s: symbol; var x = { [s]: 0, [s]() { }, diff --git a/tests/baselines/reference/symbolProperty17.js b/tests/baselines/reference/symbolProperty17.js index 9aa603910cd..549577c8d6c 100644 --- a/tests/baselines/reference/symbolProperty17.js +++ b/tests/baselines/reference/symbolProperty17.js @@ -1,7 +1,7 @@ //// [symbolProperty17.ts] interface I { [Symbol.iterator]: number; - [s: Symbol]: string; + [s: symbol]: string; "__@iterator": string; } diff --git a/tests/baselines/reference/symbolProperty29.js b/tests/baselines/reference/symbolProperty29.js index 87088daa0a4..f7fee99f6a1 100644 --- a/tests/baselines/reference/symbolProperty29.js +++ b/tests/baselines/reference/symbolProperty29.js @@ -3,7 +3,7 @@ class C1 { [Symbol.toStringTag]() { return { x: "" }; } - [s: Symbol]: () => { x: string }; + [s: symbol]: () => { x: string }; } //// [symbolProperty29.js] diff --git a/tests/baselines/reference/symbolProperty30.js b/tests/baselines/reference/symbolProperty30.js index daa08c51af1..bdb108015cf 100644 --- a/tests/baselines/reference/symbolProperty30.js +++ b/tests/baselines/reference/symbolProperty30.js @@ -3,7 +3,7 @@ class C1 { [Symbol.toStringTag]() { return { x: "" }; } - [s: Symbol]: () => { x: number }; + [s: symbol]: () => { x: number }; } //// [symbolProperty30.js] diff --git a/tests/baselines/reference/symbolProperty31.js b/tests/baselines/reference/symbolProperty31.js index 986f49ad6ff..cf532774652 100644 --- a/tests/baselines/reference/symbolProperty31.js +++ b/tests/baselines/reference/symbolProperty31.js @@ -5,7 +5,7 @@ class C1 { } } class C2 extends C1 { - [s: Symbol]: () => { x: string }; + [s: symbol]: () => { x: string }; } //// [symbolProperty31.js] diff --git a/tests/baselines/reference/symbolProperty32.js b/tests/baselines/reference/symbolProperty32.js index 260a88b41dd..73e4bffdc01 100644 --- a/tests/baselines/reference/symbolProperty32.js +++ b/tests/baselines/reference/symbolProperty32.js @@ -5,7 +5,7 @@ class C1 { } } class C2 extends C1 { - [s: Symbol]: () => { x: number }; + [s: symbol]: () => { x: number }; } //// [symbolProperty32.js] diff --git a/tests/baselines/reference/symbolProperty33.js b/tests/baselines/reference/symbolProperty33.js index f891ba271d1..f5a08010338 100644 --- a/tests/baselines/reference/symbolProperty33.js +++ b/tests/baselines/reference/symbolProperty33.js @@ -5,7 +5,7 @@ class C1 extends C2 { } } class C2 { - [s: Symbol]: () => { x: string }; + [s: symbol]: () => { x: string }; } //// [symbolProperty33.js] diff --git a/tests/baselines/reference/symbolProperty34.js b/tests/baselines/reference/symbolProperty34.js index 9a35db2c20f..5b25f487fbf 100644 --- a/tests/baselines/reference/symbolProperty34.js +++ b/tests/baselines/reference/symbolProperty34.js @@ -5,7 +5,7 @@ class C1 extends C2 { } } class C2 { - [s: Symbol]: () => { x: number }; + [s: symbol]: () => { x: number }; } //// [symbolProperty34.js] diff --git a/tests/baselines/reference/symbolProperty7.js b/tests/baselines/reference/symbolProperty7.js new file mode 100644 index 00000000000..42d19616ce3 --- /dev/null +++ b/tests/baselines/reference/symbolProperty7.js @@ -0,0 +1,26 @@ +//// [symbolProperty7.ts] +class C { + [Symbol()] = 0; + [Symbol()]: number; + [Symbol()]() { } + get [Symbol()]() { + return 0; + } +} + +//// [symbolProperty7.js] +var C = (function () { + function C() { + this[Symbol()] = 0; + } + C.prototype[Symbol()] = function () { + }; + Object.defineProperty(C.prototype, Symbol(), { + get: function () { + return 0; + }, + enumerable: true, + configurable: true + }); + return C; +})(); diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty1.ts b/tests/cases/conformance/es6/Symbols/symbolProperty1.ts index 033f1b5cbda..0e008511be3 100644 --- a/tests/cases/conformance/es6/Symbols/symbolProperty1.ts +++ b/tests/cases/conformance/es6/Symbols/symbolProperty1.ts @@ -1,5 +1,5 @@ //@target: ES6 -var s: Symbol; +var s: symbol; var x = { [s]: 0, [s]() { }, diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty17.ts b/tests/cases/conformance/es6/Symbols/symbolProperty17.ts index 450fbb70dd6..737059d0e3b 100644 --- a/tests/cases/conformance/es6/Symbols/symbolProperty17.ts +++ b/tests/cases/conformance/es6/Symbols/symbolProperty17.ts @@ -1,7 +1,7 @@ //@target: ES6 interface I { [Symbol.iterator]: number; - [s: Symbol]: string; + [s: symbol]: string; "__@iterator": string; } diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty29.ts b/tests/cases/conformance/es6/Symbols/symbolProperty29.ts index 43701b715f9..8d1b8491d37 100644 --- a/tests/cases/conformance/es6/Symbols/symbolProperty29.ts +++ b/tests/cases/conformance/es6/Symbols/symbolProperty29.ts @@ -3,5 +3,5 @@ class C1 { [Symbol.toStringTag]() { return { x: "" }; } - [s: Symbol]: () => { x: string }; + [s: symbol]: () => { x: string }; } \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty30.ts b/tests/cases/conformance/es6/Symbols/symbolProperty30.ts index e2460604a87..a75f77d6056 100644 --- a/tests/cases/conformance/es6/Symbols/symbolProperty30.ts +++ b/tests/cases/conformance/es6/Symbols/symbolProperty30.ts @@ -3,5 +3,5 @@ class C1 { [Symbol.toStringTag]() { return { x: "" }; } - [s: Symbol]: () => { x: number }; + [s: symbol]: () => { x: number }; } \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty31.ts b/tests/cases/conformance/es6/Symbols/symbolProperty31.ts index 6d39675bf52..d41f5d6b0fe 100644 --- a/tests/cases/conformance/es6/Symbols/symbolProperty31.ts +++ b/tests/cases/conformance/es6/Symbols/symbolProperty31.ts @@ -5,5 +5,5 @@ class C1 { } } class C2 extends C1 { - [s: Symbol]: () => { x: string }; + [s: symbol]: () => { x: string }; } \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty32.ts b/tests/cases/conformance/es6/Symbols/symbolProperty32.ts index 873187ff614..52da68fc57c 100644 --- a/tests/cases/conformance/es6/Symbols/symbolProperty32.ts +++ b/tests/cases/conformance/es6/Symbols/symbolProperty32.ts @@ -5,5 +5,5 @@ class C1 { } } class C2 extends C1 { - [s: Symbol]: () => { x: number }; + [s: symbol]: () => { x: number }; } \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty33.ts b/tests/cases/conformance/es6/Symbols/symbolProperty33.ts index 12669f89d6f..8c7a4d274f3 100644 --- a/tests/cases/conformance/es6/Symbols/symbolProperty33.ts +++ b/tests/cases/conformance/es6/Symbols/symbolProperty33.ts @@ -5,5 +5,5 @@ class C1 extends C2 { } } class C2 { - [s: Symbol]: () => { x: string }; + [s: symbol]: () => { x: string }; } \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty34.ts b/tests/cases/conformance/es6/Symbols/symbolProperty34.ts index 5d41b87002d..6e8bb521f0a 100644 --- a/tests/cases/conformance/es6/Symbols/symbolProperty34.ts +++ b/tests/cases/conformance/es6/Symbols/symbolProperty34.ts @@ -5,5 +5,5 @@ class C1 extends C2 { } } class C2 { - [s: Symbol]: () => { x: number }; + [s: symbol]: () => { x: number }; } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts index f90f804a615..5c10e2d487b 100644 --- a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts @@ -1,4 +1,4 @@ //@target: ES5 interface I { - [s: Symbol]: string; + [s: symbol]: string; } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts index 1f13320f5d1..e5d29c08f7d 100644 --- a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts @@ -1,4 +1,4 @@ //@target: ES5 class C { - [s: Symbol]: string; + [s: symbol]: string; } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts index 1e3829f9e40..d4bd13aa1d6 100644 --- a/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts +++ b/tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts @@ -1,4 +1,4 @@ //@target: ES5 var x: { - [s: Symbol]: string; + [s: symbol]: string; } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts index 668ebb496f4..805584ef078 100644 --- a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts @@ -1,4 +1,4 @@ //@target: ES6 interface I { - [s: Symbol]: string; + [s: symbol]: string; } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts index cf4ee50974e..c593d0a4b0a 100644 --- a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts @@ -1,4 +1,4 @@ //@target: ES6 class C { - [s: Symbol]: string; + [s: symbol]: string; } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts index f7f7154af35..183ecea6e63 100644 --- a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts @@ -1,4 +1,4 @@ //@target: ES6 class C { - static [s: Symbol]: string; + static [s: symbol]: string; } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts index 99e8112ce55..c6f9077f648 100644 --- a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts @@ -1,4 +1,4 @@ //@target: ES6 var x: { - [s: Symbol]: string; + [s: symbol]: string; } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts index 8c468043a8f..a028a3b6488 100644 --- a/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts +++ b/tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer5.ts @@ -1,4 +1,4 @@ //@target: ES6 var x = { - [s: Symbol]: "" + [s: symbol]: "" } \ No newline at end of file From e346b7001303723e904888645cdb1e655d9ea879 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 3 Feb 2015 17:12:23 -0800 Subject: [PATCH 024/162] Change isTypeOfKind calls to pass symbol TypeFlag when needed --- src/compiler/checker.ts | 52 ++++++++++++++++++----------------------- src/compiler/types.ts | 5 ++-- 2 files changed, 26 insertions(+), 31 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index fde878c0533..95af0816902 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -67,6 +67,7 @@ module ts { var stringType = createIntrinsicType(TypeFlags.String, "string"); var numberType = createIntrinsicType(TypeFlags.Number, "number"); var booleanType = createIntrinsicType(TypeFlags.Boolean, "boolean"); + var esSymbolType = createIntrinsicType(TypeFlags.ESSymbol, "symbol"); var voidType = createIntrinsicType(TypeFlags.Void, "void"); var undefinedType = createIntrinsicType(TypeFlags.Undefined | TypeFlags.ContainsUndefinedOrNull, "undefined"); var nullType = createIntrinsicType(TypeFlags.Null | TypeFlags.ContainsUndefinedOrNull, "null"); @@ -123,6 +124,10 @@ module ts { "boolean": { type: booleanType, flags: TypeFlags.Boolean + }, + "symbol": { + type: esSymbolType, + flags: TypeFlags.ESSymbol } }; @@ -3191,6 +3196,8 @@ module ts { return numberType; case SyntaxKind.BooleanKeyword: return booleanType; + case SyntaxKind.SymbolKeyword: + return esSymbolType; case SyntaxKind.VoidKeyword: return voidType; case SyntaxKind.StringLiteral: @@ -5492,7 +5499,7 @@ module ts { function isNumericComputedName(name: ComputedPropertyName): boolean { // It seems odd to consider an expression of type Any to result in a numeric name, // but this behavior is consistent with checkIndexedAccess - return isTypeOfKind(checkComputedPropertyName(name), TypeFlags.Any | TypeFlags.NumberLike, /*includeESSymbols*/ false); + return isTypeOfKind(checkComputedPropertyName(name), TypeFlags.Any | TypeFlags.NumberLike); } function isNumericLiteralName(name: string) { @@ -5527,7 +5534,7 @@ module ts { // This will allow types number, string, Symbol or any. It will also allow enums, the unknown // type, and any union of these types (like string | number). - if (!isTypeOfKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike, /*includeESSymbols*/ true)) { + if (!isTypeOfKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.ESSymbol)) { error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_Symbol_or_any); } } @@ -5792,10 +5799,10 @@ module ts { } // Check for compatible indexer types. - if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike, /*includeESSymbols*/ true)) { + if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) { // Try to use a number indexer. - if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.NumberLike, /*includeESSymbols*/ false)) { + if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.NumberLike)) { var numberIndexType = getIndexTypeOfType(objectType, IndexKind.Number); if (numberIndexType) { return numberIndexType; @@ -6733,7 +6740,7 @@ module ts { } function checkArithmeticOperandType(operand: Node, type: Type, diagnostic: DiagnosticMessage): boolean { - if (!isTypeOfKind(type, TypeFlags.Any | TypeFlags.NumberLike, /*includeESSymbols*/ false)) { + if (!isTypeOfKind(type, TypeFlags.Any | TypeFlags.NumberLike)) { error(operand, diagnostic); return false; } @@ -6884,29 +6891,20 @@ module ts { return numberType; } - // Return true if type has the given flags, or is a union type composed of types that all have those flags - // If include includeESSymbols is true, then check if the type (or union constituents) is an ESSymbol - // if it does not match the kind. This is necessary because ESSymbol has no corresponding flag. - function isTypeOfKind(type: Type, kind: TypeFlags, includeESSymbols: boolean): boolean { + // Return true if type has the given flags, or is a union type composed of types that all have those flags. + function isTypeOfKind(type: Type, kind: TypeFlags): boolean { if (type.flags & kind) { return true; } if (type.flags & TypeFlags.Union) { var types = (type).types; for (var i = 0; i < types.length; i++) { - if (types[i].flags & kind) { - continue; + if (!(types[i].flags & kind)) { + return false; } - if (includeESSymbols && types[i] === globalESSymbolType) { - continue; - } - return false; } return true; } - if (includeESSymbols) { - return type === globalESSymbolType; - } return false; } @@ -6924,11 +6922,7 @@ module ts { // and the right operand to be of type Any or a subtype of the 'Function' interface type. // The result is always of the Boolean primitive type. // NOTE: do not raise error if leftType is unknown as related error was already reported - // - // The reason for globalESSymbolType !== unknownType is that if the type is unknownType, we don't want to error. - // If the globalESSymbolType is also unknownType, then by including globalESSymbolType, we will error - // on unknownType, because transitively, type will be the same as globalESSymbolType. - if (isTypeOfKind(leftType, TypeFlags.Primitive, /*includeESSymbols*/ globalESSymbolType !== unknownType)) { + if (isTypeOfKind(leftType, TypeFlags.Primitive)) { error(node.left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported @@ -6943,10 +6937,10 @@ module ts { // The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type, // and the right operand to be of type Any, an object type, or a type parameter type. // The result is always of the Boolean primitive type. - if (!isTypeOfKind(leftType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike, /*includeESSymbols*/ true)) { + if (!isTypeOfKind(leftType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) { error(node.left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number); } - if (!isTypeOfKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter, /*includeESSymbols*/ false)) { + if (!isTypeOfKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { error(node.right, Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; @@ -7107,12 +7101,12 @@ module ts { if (rightType.flags & (TypeFlags.Undefined | TypeFlags.Null)) rightType = leftType; var resultType: Type; - if (isTypeOfKind(leftType, TypeFlags.NumberLike, /*includeESSymbols*/ false) && isTypeOfKind(rightType, TypeFlags.NumberLike, /*includeESSymbols*/ false)) { + if (isTypeOfKind(leftType, TypeFlags.NumberLike) && isTypeOfKind(rightType, TypeFlags.NumberLike)) { // Operands of an enum type are treated as having the primitive type Number. // If both operands are of the Number primitive type, the result is of the Number primitive type. resultType = numberType; } - else if (isTypeOfKind(leftType, TypeFlags.StringLike, /*includeESSymbols*/ false) || isTypeOfKind(rightType, TypeFlags.StringLike, /*includeESSymbols*/ false)) { + else if (isTypeOfKind(leftType, TypeFlags.StringLike) || isTypeOfKind(rightType, TypeFlags.StringLike)) { // If one or both operands are of the String primitive type, the result is of the String primitive type. resultType = stringType; } @@ -8478,7 +8472,7 @@ module ts { // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var exprType = checkExpression(varExpr); - if (!isTypeOfKind(exprType, TypeFlags.Any | TypeFlags.StringLike, /*includeESSymbols*/ true)) { + if (!isTypeOfKind(exprType, TypeFlags.Any | TypeFlags.StringLike)) { error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { @@ -8490,7 +8484,7 @@ module ts { var exprType = checkExpression(node.expression); // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one - if (!isTypeOfKind(exprType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter, /*includeESSymbols*/ false)) { + if (!isTypeOfKind(exprType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 96689afba1d..570fdfbe13f 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1299,9 +1299,10 @@ module ts { ObjectLiteral = 0x00020000, // Originates in an object literal ContainsUndefinedOrNull = 0x00040000, // Type is or contains Undefined or Null type ContainsObjectLiteral = 0x00080000, // Type is or contains object literal type + ESSymbol = 0x00100000, // Type of symbol primitive introduced in ES6 - Intrinsic = Any | String | Number | Boolean | Void | Undefined | Null, - Primitive = String | Number | Boolean | Void | Undefined | Null | StringLiteral | Enum, + Intrinsic = Any | String | Number | Boolean | ESSymbol | Void | Undefined | Null, + Primitive = String | Number | Boolean | ESSymbol | Void | Undefined | Null | StringLiteral | Enum, StringLike = String | StringLiteral, NumberLike = Number | Enum, ObjectType = Class | Interface | Reference | Tuple | Anonymous, From 59a704e7c1f8a40c705bf96220eefbafd4718668 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 3 Feb 2015 17:18:50 -0800 Subject: [PATCH 025/162] Rename references in es6.d.ts from Symbol to symbol --- src/lib/es6.d.ts | 26 +++++------ .../baselines/reference/APISample_compile.js | 5 ++- .../reference/APISample_compile.types | 7 ++- tests/baselines/reference/APISample_linter.js | 5 ++- .../reference/APISample_linter.types | 7 ++- .../reference/APISample_transform.js | 5 ++- .../reference/APISample_transform.types | 7 ++- .../baselines/reference/APISample_watcher.js | 5 ++- .../reference/APISample_watcher.types | 7 ++- .../reference/parserSymbolIndexer1.types | 5 +-- .../reference/parserSymbolIndexer2.types | 5 +-- .../reference/parserSymbolIndexer4.types | 5 +-- .../reference/parserSymbolProperty1.types | 4 +- .../reference/parserSymbolProperty2.types | 4 +- .../reference/parserSymbolProperty3.types | 4 +- .../reference/parserSymbolProperty4.types | 4 +- .../reference/parserSymbolProperty5.types | 4 +- .../reference/parserSymbolProperty6.types | 4 +- .../reference/parserSymbolProperty7.types | 4 +- .../reference/parserSymbolProperty8.types | 4 +- .../reference/parserSymbolProperty9.types | 4 +- .../baselines/reference/symbolProperty1.types | 11 +++-- .../reference/symbolProperty11.types | 4 +- .../reference/symbolProperty13.types | 8 ++-- .../reference/symbolProperty14.types | 8 ++-- .../reference/symbolProperty15.types | 4 +- .../reference/symbolProperty16.types | 8 ++-- .../baselines/reference/symbolProperty2.types | 10 ++--- .../reference/symbolProperty20.types | 16 +++---- .../reference/symbolProperty21.types | 20 ++++----- .../reference/symbolProperty22.types | 8 ++-- .../reference/symbolProperty23.types | 8 ++-- .../reference/symbolProperty26.types | 8 ++-- .../reference/symbolProperty27.types | 8 ++-- .../reference/symbolProperty29.types | 9 ++-- .../reference/symbolProperty31.types | 9 ++-- .../reference/symbolProperty33.types | 9 ++-- .../baselines/reference/symbolProperty4.types | 6 +-- .../reference/symbolProperty45.types | 8 ++-- .../baselines/reference/symbolProperty5.types | 12 ++--- .../reference/symbolProperty50.types | 4 +- .../reference/symbolProperty51.types | 4 +- .../baselines/reference/symbolProperty6.types | 16 +++---- .../baselines/reference/symbolProperty8.types | 8 ++-- .../reference/symbolType9.errors.txt | 24 ++++++++++ tests/baselines/reference/symbolType9.types | 44 ------------------- 46 files changed, 194 insertions(+), 205 deletions(-) create mode 100644 tests/baselines/reference/symbolType9.errors.txt delete mode 100644 tests/baselines/reference/symbolType9.types diff --git a/src/lib/es6.d.ts b/src/lib/es6.d.ts index b666b11b969..4d4f435145c 100644 --- a/src/lib/es6.d.ts +++ b/src/lib/es6.d.ts @@ -1,4 +1,4 @@ -declare type PropertyKey = string | number | Symbol; +declare type PropertyKey = string | number | symbol; interface Symbol { /** Returns a string representation of an object. */ @@ -20,21 +20,21 @@ interface SymbolConstructor { * Returns a new unique Symbol value. * @param description Description of the new Symbol object. */ - (description?: string|number): Symbol; + (description?: string|number): symbol; /** * Returns a Symbol object from the global symbol registry matching the given key if found. * Otherwise, returns a new symbol with this key. * @param key key to search for. */ - for(key: string): Symbol; + for(key: string): symbol; /** * Returns a key from the global symbol registry matching the given Symbol if found. * Otherwise, returns a undefined. * @param sym Symbol to find the key for. */ - keyFor(sym: Symbol): string; + keyFor(sym: symbol): string; // Well-known Symbols @@ -42,42 +42,42 @@ interface SymbolConstructor { * A method that determines if a constructor object recognizes an object as one of the * constructor’s instances. Called by the semantics of the instanceof operator. */ - hasInstance: Symbol; + hasInstance: symbol; /** * A Boolean value that if true indicates that an object should flatten to its array elements * by Array.prototype.concat. */ - isConcatSpreadable: Symbol; + isConcatSpreadable: symbol; /** * A Boolean value that if true indicates that an object may be used as a regular expression. */ - isRegExp: Symbol; + isRegExp: symbol; /** * A method that returns the default iterator for an object.Called by the semantics of the * for-of statement. */ - iterator: Symbol; + iterator: symbol; /** * A method that converts an object to a corresponding primitive value.Called by the ToPrimitive * abstract operation. */ - toPrimitive: Symbol; + toPrimitive: symbol; /** * A String value that is used in the creation of the default string description of an object. * Called by the built- in method Object.prototype.toString. */ - toStringTag: Symbol; + toStringTag: symbol; /** * An Object whose own property names are property names that are excluded from the with * environment bindings of the associated objects. */ - unscopables: Symbol; + unscopables: symbol; } declare var Symbol: SymbolConstructor; @@ -108,7 +108,7 @@ interface ObjectConstructor { * Returns an array of all symbol properties found directly on object o. * @param o Object to retrieve the symbols from. */ - getOwnPropertySymbols(o: any): Symbol[]; + getOwnPropertySymbols(o: any): symbol[]; /** * Returns true if the values are the same value, false otherwise. @@ -3521,7 +3521,7 @@ declare var Reflect: { getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor; getPrototypeOf(target: any): any; has(target: any, propertyKey: string): boolean; - has(target: any, propertyKey: Symbol): boolean; + has(target: any, propertyKey: symbol): boolean; isExtensible(target: any): boolean; ownKeys(target: any): Array; preventExtensions(target: any): boolean; diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index cbf5cf290eb..aaa7ad596e5 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -1029,8 +1029,9 @@ declare module "typescript" { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 7eff464a746..44f42085807 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -3314,10 +3314,13 @@ declare module "typescript" { ContainsObjectLiteral = 524288, >ContainsObjectLiteral : TypeFlags - Intrinsic = 127, + ESSymbol = 1048576, +>ESSymbol : TypeFlags + + Intrinsic = 1048703, >Intrinsic : TypeFlags - Primitive = 510, + Primitive = 1049086, >Primitive : TypeFlags StringLike = 258, diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index eab931162ad..629be085c3a 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -1060,8 +1060,9 @@ declare module "typescript" { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index fcdbb57add6..8f3a90c35d1 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -3458,10 +3458,13 @@ declare module "typescript" { ContainsObjectLiteral = 524288, >ContainsObjectLiteral : TypeFlags - Intrinsic = 127, + ESSymbol = 1048576, +>ESSymbol : TypeFlags + + Intrinsic = 1048703, >Intrinsic : TypeFlags - Primitive = 510, + Primitive = 1049086, >Primitive : TypeFlags StringLike = 258, diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index e9c8d6fc0fd..66b0182728d 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -1061,8 +1061,9 @@ declare module "typescript" { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 2a9c7902528..c8d2ec5bed3 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -3410,10 +3410,13 @@ declare module "typescript" { ContainsObjectLiteral = 524288, >ContainsObjectLiteral : TypeFlags - Intrinsic = 127, + ESSymbol = 1048576, +>ESSymbol : TypeFlags + + Intrinsic = 1048703, >Intrinsic : TypeFlags - Primitive = 510, + Primitive = 1049086, >Primitive : TypeFlags StringLike = 258, diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index dae4936f7b0..93bb9b16afb 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -1098,8 +1098,9 @@ declare module "typescript" { ObjectLiteral = 131072, ContainsUndefinedOrNull = 262144, ContainsObjectLiteral = 524288, - Intrinsic = 127, - Primitive = 510, + ESSymbol = 1048576, + Intrinsic = 1048703, + Primitive = 1049086, StringLike = 258, NumberLike = 132, ObjectType = 48128, diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index a8d9197f753..27acbb0a726 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -3583,10 +3583,13 @@ declare module "typescript" { ContainsObjectLiteral = 524288, >ContainsObjectLiteral : TypeFlags - Intrinsic = 127, + ESSymbol = 1048576, +>ESSymbol : TypeFlags + + Intrinsic = 1048703, >Intrinsic : TypeFlags - Primitive = 510, + Primitive = 1049086, >Primitive : TypeFlags StringLike = 258, diff --git a/tests/baselines/reference/parserSymbolIndexer1.types b/tests/baselines/reference/parserSymbolIndexer1.types index 86020c8cbdd..6723ef12726 100644 --- a/tests/baselines/reference/parserSymbolIndexer1.types +++ b/tests/baselines/reference/parserSymbolIndexer1.types @@ -2,7 +2,6 @@ interface I { >I : I - [s: Symbol]: string; ->s : Symbol ->Symbol : Symbol + [s: symbol]: string; +>s : symbol } diff --git a/tests/baselines/reference/parserSymbolIndexer2.types b/tests/baselines/reference/parserSymbolIndexer2.types index ffa9ff96346..d8d620c7def 100644 --- a/tests/baselines/reference/parserSymbolIndexer2.types +++ b/tests/baselines/reference/parserSymbolIndexer2.types @@ -2,7 +2,6 @@ class C { >C : C - [s: Symbol]: string; ->s : Symbol ->Symbol : Symbol + [s: symbol]: string; +>s : symbol } diff --git a/tests/baselines/reference/parserSymbolIndexer4.types b/tests/baselines/reference/parserSymbolIndexer4.types index 0f632e5dc32..7509072a12c 100644 --- a/tests/baselines/reference/parserSymbolIndexer4.types +++ b/tests/baselines/reference/parserSymbolIndexer4.types @@ -2,7 +2,6 @@ var x: { >x : {} - [s: Symbol]: string; ->s : Symbol ->Symbol : Symbol + [s: symbol]: string; +>s : symbol } diff --git a/tests/baselines/reference/parserSymbolProperty1.types b/tests/baselines/reference/parserSymbolProperty1.types index ab68b0bc7ac..6c0cd75cf59 100644 --- a/tests/baselines/reference/parserSymbolProperty1.types +++ b/tests/baselines/reference/parserSymbolProperty1.types @@ -3,7 +3,7 @@ interface I { >I : I [Symbol.iterator]: string; ->Symbol.iterator : Symbol +>Symbol.iterator : symbol >Symbol : SymbolConstructor ->iterator : Symbol +>iterator : symbol } diff --git a/tests/baselines/reference/parserSymbolProperty2.types b/tests/baselines/reference/parserSymbolProperty2.types index 02ba4c21a8a..bcf14b83a2a 100644 --- a/tests/baselines/reference/parserSymbolProperty2.types +++ b/tests/baselines/reference/parserSymbolProperty2.types @@ -3,7 +3,7 @@ interface I { >I : I [Symbol.unscopables](): string; ->Symbol.unscopables : Symbol +>Symbol.unscopables : symbol >Symbol : SymbolConstructor ->unscopables : Symbol +>unscopables : symbol } diff --git a/tests/baselines/reference/parserSymbolProperty3.types b/tests/baselines/reference/parserSymbolProperty3.types index 4f0245cee6f..977375d7393 100644 --- a/tests/baselines/reference/parserSymbolProperty3.types +++ b/tests/baselines/reference/parserSymbolProperty3.types @@ -3,7 +3,7 @@ declare class C { >C : C [Symbol.unscopables](): string; ->Symbol.unscopables : Symbol +>Symbol.unscopables : symbol >Symbol : SymbolConstructor ->unscopables : Symbol +>unscopables : symbol } diff --git a/tests/baselines/reference/parserSymbolProperty4.types b/tests/baselines/reference/parserSymbolProperty4.types index 9fcd6c4a29e..a9070897fa8 100644 --- a/tests/baselines/reference/parserSymbolProperty4.types +++ b/tests/baselines/reference/parserSymbolProperty4.types @@ -3,7 +3,7 @@ declare class C { >C : C [Symbol.isRegExp]: string; ->Symbol.isRegExp : Symbol +>Symbol.isRegExp : symbol >Symbol : SymbolConstructor ->isRegExp : Symbol +>isRegExp : symbol } diff --git a/tests/baselines/reference/parserSymbolProperty5.types b/tests/baselines/reference/parserSymbolProperty5.types index 1cdaa6ec694..8a171598e83 100644 --- a/tests/baselines/reference/parserSymbolProperty5.types +++ b/tests/baselines/reference/parserSymbolProperty5.types @@ -3,7 +3,7 @@ class C { >C : C [Symbol.isRegExp]: string; ->Symbol.isRegExp : Symbol +>Symbol.isRegExp : symbol >Symbol : SymbolConstructor ->isRegExp : Symbol +>isRegExp : symbol } diff --git a/tests/baselines/reference/parserSymbolProperty6.types b/tests/baselines/reference/parserSymbolProperty6.types index 7f14f36d28d..660cbf4e545 100644 --- a/tests/baselines/reference/parserSymbolProperty6.types +++ b/tests/baselines/reference/parserSymbolProperty6.types @@ -3,7 +3,7 @@ class C { >C : C [Symbol.toStringTag]: string = ""; ->Symbol.toStringTag : Symbol +>Symbol.toStringTag : symbol >Symbol : SymbolConstructor ->toStringTag : Symbol +>toStringTag : symbol } diff --git a/tests/baselines/reference/parserSymbolProperty7.types b/tests/baselines/reference/parserSymbolProperty7.types index ce62cd93498..f8dc2523692 100644 --- a/tests/baselines/reference/parserSymbolProperty7.types +++ b/tests/baselines/reference/parserSymbolProperty7.types @@ -3,7 +3,7 @@ class C { >C : C [Symbol.toStringTag](): void { } ->Symbol.toStringTag : Symbol +>Symbol.toStringTag : symbol >Symbol : SymbolConstructor ->toStringTag : Symbol +>toStringTag : symbol } diff --git a/tests/baselines/reference/parserSymbolProperty8.types b/tests/baselines/reference/parserSymbolProperty8.types index 048885dfd38..06387c9c231 100644 --- a/tests/baselines/reference/parserSymbolProperty8.types +++ b/tests/baselines/reference/parserSymbolProperty8.types @@ -3,7 +3,7 @@ var x: { >x : { [Symbol.toPrimitive](): string; } [Symbol.toPrimitive](): string ->Symbol.toPrimitive : Symbol +>Symbol.toPrimitive : symbol >Symbol : SymbolConstructor ->toPrimitive : Symbol +>toPrimitive : symbol } diff --git a/tests/baselines/reference/parserSymbolProperty9.types b/tests/baselines/reference/parserSymbolProperty9.types index cc3b35d3302..40fbde2acff 100644 --- a/tests/baselines/reference/parserSymbolProperty9.types +++ b/tests/baselines/reference/parserSymbolProperty9.types @@ -3,7 +3,7 @@ var x: { >x : { [Symbol.toPrimitive]: string; } [Symbol.toPrimitive]: string ->Symbol.toPrimitive : Symbol +>Symbol.toPrimitive : symbol >Symbol : SymbolConstructor ->toPrimitive : Symbol +>toPrimitive : symbol } diff --git a/tests/baselines/reference/symbolProperty1.types b/tests/baselines/reference/symbolProperty1.types index 9c24051449e..55c86c14f6e 100644 --- a/tests/baselines/reference/symbolProperty1.types +++ b/tests/baselines/reference/symbolProperty1.types @@ -1,20 +1,19 @@ === tests/cases/conformance/es6/Symbols/symbolProperty1.ts === -var s: Symbol; ->s : Symbol ->Symbol : Symbol +var s: symbol; +>s : symbol var x = { >x : {} >{ [s]: 0, [s]() { }, get [s]() { return 0; }} : {} [s]: 0, ->s : Symbol +>s : symbol [s]() { }, ->s : Symbol +>s : symbol get [s]() { ->s : Symbol +>s : symbol return 0; } diff --git a/tests/baselines/reference/symbolProperty11.types b/tests/baselines/reference/symbolProperty11.types index 9ba956293af..109bd969d55 100644 --- a/tests/baselines/reference/symbolProperty11.types +++ b/tests/baselines/reference/symbolProperty11.types @@ -6,9 +6,9 @@ interface I { >I : I [Symbol.iterator]?: { x }; ->Symbol.iterator : Symbol +>Symbol.iterator : symbol >Symbol : SymbolConstructor ->iterator : Symbol +>iterator : symbol >x : any } diff --git a/tests/baselines/reference/symbolProperty13.types b/tests/baselines/reference/symbolProperty13.types index 231b7905b68..1e890a91085 100644 --- a/tests/baselines/reference/symbolProperty13.types +++ b/tests/baselines/reference/symbolProperty13.types @@ -3,9 +3,9 @@ class C { >C : C [Symbol.iterator]: { x; y }; ->Symbol.iterator : Symbol +>Symbol.iterator : symbol >Symbol : SymbolConstructor ->iterator : Symbol +>iterator : symbol >x : any >y : any } @@ -13,9 +13,9 @@ interface I { >I : I [Symbol.iterator]: { x }; ->Symbol.iterator : Symbol +>Symbol.iterator : symbol >Symbol : SymbolConstructor ->iterator : Symbol +>iterator : symbol >x : any } diff --git a/tests/baselines/reference/symbolProperty14.types b/tests/baselines/reference/symbolProperty14.types index 1032e83644c..5e5469ad915 100644 --- a/tests/baselines/reference/symbolProperty14.types +++ b/tests/baselines/reference/symbolProperty14.types @@ -3,9 +3,9 @@ class C { >C : C [Symbol.iterator]: { x; y }; ->Symbol.iterator : Symbol +>Symbol.iterator : symbol >Symbol : SymbolConstructor ->iterator : Symbol +>iterator : symbol >x : any >y : any } @@ -13,9 +13,9 @@ interface I { >I : I [Symbol.iterator]?: { x }; ->Symbol.iterator : Symbol +>Symbol.iterator : symbol >Symbol : SymbolConstructor ->iterator : Symbol +>iterator : symbol >x : any } diff --git a/tests/baselines/reference/symbolProperty15.types b/tests/baselines/reference/symbolProperty15.types index 863872c29c0..b2baa3fccee 100644 --- a/tests/baselines/reference/symbolProperty15.types +++ b/tests/baselines/reference/symbolProperty15.types @@ -6,9 +6,9 @@ interface I { >I : I [Symbol.iterator]?: { x }; ->Symbol.iterator : Symbol +>Symbol.iterator : symbol >Symbol : SymbolConstructor ->iterator : Symbol +>iterator : symbol >x : any } diff --git a/tests/baselines/reference/symbolProperty16.types b/tests/baselines/reference/symbolProperty16.types index 172c5a1ea10..041770aea04 100644 --- a/tests/baselines/reference/symbolProperty16.types +++ b/tests/baselines/reference/symbolProperty16.types @@ -3,18 +3,18 @@ class C { >C : C private [Symbol.iterator]: { x }; ->Symbol.iterator : Symbol +>Symbol.iterator : symbol >Symbol : SymbolConstructor ->iterator : Symbol +>iterator : symbol >x : any } interface I { >I : I [Symbol.iterator]: { x }; ->Symbol.iterator : Symbol +>Symbol.iterator : symbol >Symbol : SymbolConstructor ->iterator : Symbol +>iterator : symbol >x : any } diff --git a/tests/baselines/reference/symbolProperty2.types b/tests/baselines/reference/symbolProperty2.types index d45ff4584f6..37fe9d13bdb 100644 --- a/tests/baselines/reference/symbolProperty2.types +++ b/tests/baselines/reference/symbolProperty2.types @@ -1,7 +1,7 @@ === tests/cases/conformance/es6/Symbols/symbolProperty2.ts === var s = Symbol(); ->s : Symbol ->Symbol() : Symbol +>s : symbol +>Symbol() : symbol >Symbol : SymbolConstructor var x = { @@ -9,13 +9,13 @@ var x = { >{ [s]: 0, [s]() { }, get [s]() { return 0; }} : {} [s]: 0, ->s : Symbol +>s : symbol [s]() { }, ->s : Symbol +>s : symbol get [s]() { ->s : Symbol +>s : symbol return 0; } diff --git a/tests/baselines/reference/symbolProperty20.types b/tests/baselines/reference/symbolProperty20.types index 94ef4a0f2db..745401142d8 100644 --- a/tests/baselines/reference/symbolProperty20.types +++ b/tests/baselines/reference/symbolProperty20.types @@ -3,15 +3,15 @@ interface I { >I : I [Symbol.iterator]: (s: string) => string; ->Symbol.iterator : Symbol +>Symbol.iterator : symbol >Symbol : SymbolConstructor ->iterator : Symbol +>iterator : symbol >s : string [Symbol.toStringTag](s: number): number; ->Symbol.toStringTag : Symbol +>Symbol.toStringTag : symbol >Symbol : SymbolConstructor ->toStringTag : Symbol +>toStringTag : symbol >s : number } @@ -21,17 +21,17 @@ var i: I = { >{ [Symbol.iterator]: s => s, [Symbol.toStringTag](n) { return n; }} : { [Symbol.iterator]: (s: string) => string; [Symbol.toStringTag](n: number): number; } [Symbol.iterator]: s => s, ->Symbol.iterator : Symbol +>Symbol.iterator : symbol >Symbol : SymbolConstructor ->iterator : Symbol +>iterator : symbol >s => s : (s: string) => string >s : string >s : string [Symbol.toStringTag](n) { return n; } ->Symbol.toStringTag : Symbol +>Symbol.toStringTag : symbol >Symbol : SymbolConstructor ->toStringTag : Symbol +>toStringTag : symbol >n : number >n : number } diff --git a/tests/baselines/reference/symbolProperty21.types b/tests/baselines/reference/symbolProperty21.types index f364b7e3599..053dae46479 100644 --- a/tests/baselines/reference/symbolProperty21.types +++ b/tests/baselines/reference/symbolProperty21.types @@ -5,15 +5,15 @@ interface I { >U : U [Symbol.unscopables]: T; ->Symbol.unscopables : Symbol +>Symbol.unscopables : symbol >Symbol : SymbolConstructor ->unscopables : Symbol +>unscopables : symbol >T : T [Symbol.isConcatSpreadable]: U; ->Symbol.isConcatSpreadable : Symbol +>Symbol.isConcatSpreadable : symbol >Symbol : SymbolConstructor ->isConcatSpreadable : Symbol +>isConcatSpreadable : symbol >U : U } @@ -36,18 +36,18 @@ foo({ >{ [Symbol.isConcatSpreadable]: "", [Symbol.isRegExp]: 0, [Symbol.unscopables]: true} : { [Symbol.isConcatSpreadable]: string; [Symbol.isRegExp]: number; [Symbol.unscopables]: boolean; } [Symbol.isConcatSpreadable]: "", ->Symbol.isConcatSpreadable : Symbol +>Symbol.isConcatSpreadable : symbol >Symbol : SymbolConstructor ->isConcatSpreadable : Symbol +>isConcatSpreadable : symbol [Symbol.isRegExp]: 0, ->Symbol.isRegExp : Symbol +>Symbol.isRegExp : symbol >Symbol : SymbolConstructor ->isRegExp : Symbol +>isRegExp : symbol [Symbol.unscopables]: true ->Symbol.unscopables : Symbol +>Symbol.unscopables : symbol >Symbol : SymbolConstructor ->unscopables : Symbol +>unscopables : symbol }); diff --git a/tests/baselines/reference/symbolProperty22.types b/tests/baselines/reference/symbolProperty22.types index c89af9afbd5..64fb5fc234c 100644 --- a/tests/baselines/reference/symbolProperty22.types +++ b/tests/baselines/reference/symbolProperty22.types @@ -5,9 +5,9 @@ interface I { >U : U [Symbol.unscopables](x: T): U; ->Symbol.unscopables : Symbol +>Symbol.unscopables : symbol >Symbol : SymbolConstructor ->unscopables : Symbol +>unscopables : symbol >x : T >T : T >U : U @@ -29,9 +29,9 @@ foo("", { [Symbol.unscopables]: s => s.length }); >foo("", { [Symbol.unscopables]: s => s.length }) : number >foo : (p1: T, p2: I) => U >{ [Symbol.unscopables]: s => s.length } : { [Symbol.unscopables]: (s: string) => number; } ->Symbol.unscopables : Symbol +>Symbol.unscopables : symbol >Symbol : SymbolConstructor ->unscopables : Symbol +>unscopables : symbol >s => s.length : (s: string) => number >s : string >s.length : number diff --git a/tests/baselines/reference/symbolProperty23.types b/tests/baselines/reference/symbolProperty23.types index 99480f03b01..b28ecb2dbe4 100644 --- a/tests/baselines/reference/symbolProperty23.types +++ b/tests/baselines/reference/symbolProperty23.types @@ -3,9 +3,9 @@ interface I { >I : I [Symbol.toPrimitive]: () => boolean; ->Symbol.toPrimitive : Symbol +>Symbol.toPrimitive : symbol >Symbol : SymbolConstructor ->toPrimitive : Symbol +>toPrimitive : symbol } class C implements I { @@ -13,9 +13,9 @@ class C implements I { >I : I [Symbol.toPrimitive]() { ->Symbol.toPrimitive : Symbol +>Symbol.toPrimitive : symbol >Symbol : SymbolConstructor ->toPrimitive : Symbol +>toPrimitive : symbol return true; } diff --git a/tests/baselines/reference/symbolProperty26.types b/tests/baselines/reference/symbolProperty26.types index 258347bd4fa..3971ccb402d 100644 --- a/tests/baselines/reference/symbolProperty26.types +++ b/tests/baselines/reference/symbolProperty26.types @@ -3,9 +3,9 @@ class C1 { >C1 : C1 [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol +>Symbol.toStringTag : symbol >Symbol : SymbolConstructor ->toStringTag : Symbol +>toStringTag : symbol return ""; } @@ -16,9 +16,9 @@ class C2 extends C1 { >C1 : C1 [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol +>Symbol.toStringTag : symbol >Symbol : SymbolConstructor ->toStringTag : Symbol +>toStringTag : symbol return ""; } diff --git a/tests/baselines/reference/symbolProperty27.types b/tests/baselines/reference/symbolProperty27.types index e6df5fa008f..5a5261a11b5 100644 --- a/tests/baselines/reference/symbolProperty27.types +++ b/tests/baselines/reference/symbolProperty27.types @@ -3,9 +3,9 @@ class C1 { >C1 : C1 [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol +>Symbol.toStringTag : symbol >Symbol : SymbolConstructor ->toStringTag : Symbol +>toStringTag : symbol return {}; >{} : {} @@ -17,9 +17,9 @@ class C2 extends C1 { >C1 : C1 [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol +>Symbol.toStringTag : symbol >Symbol : SymbolConstructor ->toStringTag : Symbol +>toStringTag : symbol return ""; } diff --git a/tests/baselines/reference/symbolProperty29.types b/tests/baselines/reference/symbolProperty29.types index 8ea46a1ac72..eb47ccae859 100644 --- a/tests/baselines/reference/symbolProperty29.types +++ b/tests/baselines/reference/symbolProperty29.types @@ -3,16 +3,15 @@ class C1 { >C1 : C1 [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol +>Symbol.toStringTag : symbol >Symbol : SymbolConstructor ->toStringTag : Symbol +>toStringTag : symbol return { x: "" }; >{ x: "" } : { x: string; } >x : string } - [s: Symbol]: () => { x: string }; ->s : Symbol ->Symbol : Symbol + [s: symbol]: () => { x: string }; +>s : symbol >x : string } diff --git a/tests/baselines/reference/symbolProperty31.types b/tests/baselines/reference/symbolProperty31.types index 460bf4f62ec..52a6523d4ed 100644 --- a/tests/baselines/reference/symbolProperty31.types +++ b/tests/baselines/reference/symbolProperty31.types @@ -3,9 +3,9 @@ class C1 { >C1 : C1 [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol +>Symbol.toStringTag : symbol >Symbol : SymbolConstructor ->toStringTag : Symbol +>toStringTag : symbol return { x: "" }; >{ x: "" } : { x: string; } @@ -16,8 +16,7 @@ class C2 extends C1 { >C2 : C2 >C1 : C1 - [s: Symbol]: () => { x: string }; ->s : Symbol ->Symbol : Symbol + [s: symbol]: () => { x: string }; +>s : symbol >x : string } diff --git a/tests/baselines/reference/symbolProperty33.types b/tests/baselines/reference/symbolProperty33.types index cc2c1687622..aed8a97e60b 100644 --- a/tests/baselines/reference/symbolProperty33.types +++ b/tests/baselines/reference/symbolProperty33.types @@ -4,9 +4,9 @@ class C1 extends C2 { >C2 : C2 [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol +>Symbol.toStringTag : symbol >Symbol : SymbolConstructor ->toStringTag : Symbol +>toStringTag : symbol return { x: "" }; >{ x: "" } : { x: string; } @@ -16,8 +16,7 @@ class C1 extends C2 { class C2 { >C2 : C2 - [s: Symbol]: () => { x: string }; ->s : Symbol ->Symbol : Symbol + [s: symbol]: () => { x: string }; +>s : symbol >x : string } diff --git a/tests/baselines/reference/symbolProperty4.types b/tests/baselines/reference/symbolProperty4.types index af3d7a85590..b8aac1f2770 100644 --- a/tests/baselines/reference/symbolProperty4.types +++ b/tests/baselines/reference/symbolProperty4.types @@ -4,15 +4,15 @@ var x = { >{ [Symbol()]: 0, [Symbol()]() { }, get [Symbol()]() { return 0; }} : {} [Symbol()]: 0, ->Symbol() : Symbol +>Symbol() : symbol >Symbol : SymbolConstructor [Symbol()]() { }, ->Symbol() : Symbol +>Symbol() : symbol >Symbol : SymbolConstructor get [Symbol()]() { ->Symbol() : Symbol +>Symbol() : symbol >Symbol : SymbolConstructor return 0; diff --git a/tests/baselines/reference/symbolProperty45.types b/tests/baselines/reference/symbolProperty45.types index 41e50387f00..24a74729aec 100644 --- a/tests/baselines/reference/symbolProperty45.types +++ b/tests/baselines/reference/symbolProperty45.types @@ -3,16 +3,16 @@ class C { >C : C get [Symbol.hasInstance]() { ->Symbol.hasInstance : Symbol +>Symbol.hasInstance : symbol >Symbol : SymbolConstructor ->hasInstance : Symbol +>hasInstance : symbol return ""; } get [Symbol.toPrimitive]() { ->Symbol.toPrimitive : Symbol +>Symbol.toPrimitive : symbol >Symbol : SymbolConstructor ->toPrimitive : Symbol +>toPrimitive : symbol return ""; } diff --git a/tests/baselines/reference/symbolProperty5.types b/tests/baselines/reference/symbolProperty5.types index d39025ae85b..7d6a9f05858 100644 --- a/tests/baselines/reference/symbolProperty5.types +++ b/tests/baselines/reference/symbolProperty5.types @@ -4,19 +4,19 @@ var x = { >{ [Symbol.iterator]: 0, [Symbol.isRegExp]() { }, get [Symbol.toStringTag]() { return 0; }} : { [Symbol.iterator]: number; [Symbol.isRegExp](): void; [Symbol.toStringTag]: number; } [Symbol.iterator]: 0, ->Symbol.iterator : Symbol +>Symbol.iterator : symbol >Symbol : SymbolConstructor ->iterator : Symbol +>iterator : symbol [Symbol.isRegExp]() { }, ->Symbol.isRegExp : Symbol +>Symbol.isRegExp : symbol >Symbol : SymbolConstructor ->isRegExp : Symbol +>isRegExp : symbol get [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol +>Symbol.toStringTag : symbol >Symbol : SymbolConstructor ->toStringTag : Symbol +>toStringTag : symbol return 0; } diff --git a/tests/baselines/reference/symbolProperty50.types b/tests/baselines/reference/symbolProperty50.types index 6715f8bce2f..8258dfe1b72 100644 --- a/tests/baselines/reference/symbolProperty50.types +++ b/tests/baselines/reference/symbolProperty50.types @@ -9,8 +9,8 @@ module M { >C : C [Symbol.iterator]() { } ->Symbol.iterator : Symbol +>Symbol.iterator : symbol >Symbol : SymbolConstructor ->iterator : Symbol +>iterator : symbol } } diff --git a/tests/baselines/reference/symbolProperty51.types b/tests/baselines/reference/symbolProperty51.types index b039e3e3b80..6677b3b2e2d 100644 --- a/tests/baselines/reference/symbolProperty51.types +++ b/tests/baselines/reference/symbolProperty51.types @@ -9,8 +9,8 @@ module M { >C : C [Symbol.iterator]() { } ->Symbol.iterator : Symbol +>Symbol.iterator : symbol >Symbol : SymbolConstructor ->iterator : Symbol +>iterator : symbol } } diff --git a/tests/baselines/reference/symbolProperty6.types b/tests/baselines/reference/symbolProperty6.types index 703ef4506a8..e5aac6f48da 100644 --- a/tests/baselines/reference/symbolProperty6.types +++ b/tests/baselines/reference/symbolProperty6.types @@ -3,24 +3,24 @@ class C { >C : C [Symbol.iterator] = 0; ->Symbol.iterator : Symbol +>Symbol.iterator : symbol >Symbol : SymbolConstructor ->iterator : Symbol +>iterator : symbol [Symbol.unscopables]: number; ->Symbol.unscopables : Symbol +>Symbol.unscopables : symbol >Symbol : SymbolConstructor ->unscopables : Symbol +>unscopables : symbol [Symbol.isRegExp]() { } ->Symbol.isRegExp : Symbol +>Symbol.isRegExp : symbol >Symbol : SymbolConstructor ->isRegExp : Symbol +>isRegExp : symbol get [Symbol.toStringTag]() { ->Symbol.toStringTag : Symbol +>Symbol.toStringTag : symbol >Symbol : SymbolConstructor ->toStringTag : Symbol +>toStringTag : symbol return 0; } diff --git a/tests/baselines/reference/symbolProperty8.types b/tests/baselines/reference/symbolProperty8.types index d1bab0615ed..d6c2f464b53 100644 --- a/tests/baselines/reference/symbolProperty8.types +++ b/tests/baselines/reference/symbolProperty8.types @@ -3,12 +3,12 @@ interface I { >I : I [Symbol.unscopables]: number; ->Symbol.unscopables : Symbol +>Symbol.unscopables : symbol >Symbol : SymbolConstructor ->unscopables : Symbol +>unscopables : symbol [Symbol.isRegExp](); ->Symbol.isRegExp : Symbol +>Symbol.isRegExp : symbol >Symbol : SymbolConstructor ->isRegExp : Symbol +>isRegExp : symbol } diff --git a/tests/baselines/reference/symbolType9.errors.txt b/tests/baselines/reference/symbolType9.errors.txt new file mode 100644 index 00000000000..5506fdc6f9d --- /dev/null +++ b/tests/baselines/reference/symbolType9.errors.txt @@ -0,0 +1,24 @@ +tests/cases/conformance/es6/Symbols/symbolType9.ts(3,1): error TS2365: Operator '==' cannot be applied to types 'symbol' and 'boolean'. +tests/cases/conformance/es6/Symbols/symbolType9.ts(5,1): error TS2365: Operator '!=' cannot be applied to types 'number' and 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType9.ts(7,1): error TS2365: Operator '===' cannot be applied to types 'symbol' and 'number'. +tests/cases/conformance/es6/Symbols/symbolType9.ts(9,1): error TS2365: Operator '!==' cannot be applied to types 'boolean' and 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType9.ts (4 errors) ==== + var s = Symbol.for("equal"); + s == s; + s == true; + ~~~~~~~~~ +!!! error TS2365: Operator '==' cannot be applied to types 'symbol' and 'boolean'. + s != s; + 0 != s; + ~~~~~~ +!!! error TS2365: Operator '!=' cannot be applied to types 'number' and 'symbol'. + s === s; + s === 1; + ~~~~~~~ +!!! error TS2365: Operator '===' cannot be applied to types 'symbol' and 'number'. + s !== s; + false !== s; + ~~~~~~~~~~~ +!!! error TS2365: Operator '!==' cannot be applied to types 'boolean' and 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType9.types b/tests/baselines/reference/symbolType9.types deleted file mode 100644 index f2d1af709ac..00000000000 --- a/tests/baselines/reference/symbolType9.types +++ /dev/null @@ -1,44 +0,0 @@ -=== tests/cases/conformance/es6/Symbols/symbolType9.ts === -var s = Symbol.for("equal"); ->s : Symbol ->Symbol.for("equal") : Symbol ->Symbol.for : (key: string) => Symbol ->Symbol : SymbolConstructor ->for : (key: string) => Symbol - -s == s; ->s == s : boolean ->s : Symbol ->s : Symbol - -s == true; ->s == true : boolean ->s : Symbol - -s != s; ->s != s : boolean ->s : Symbol ->s : Symbol - -0 != s; ->0 != s : boolean ->s : Symbol - -s === s; ->s === s : boolean ->s : Symbol ->s : Symbol - -s === 1; ->s === 1 : boolean ->s : Symbol - -s !== s; ->s !== s : boolean ->s : Symbol ->s : Symbol - -false !== s; ->false !== s : boolean ->s : Symbol - From d793658b7ff228f023207748cbae908aca05b0c4 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 3 Feb 2015 18:02:54 -0800 Subject: [PATCH 026/162] Change Symbol to symbol in error messages --- src/compiler/checker.ts | 20 ++++----- .../diagnosticInformationMap.generated.ts | 18 ++++---- src/compiler/diagnosticMessages.json | 18 ++++---- .../reference/arraySigChecking.errors.txt | 4 +- .../computedPropertyNames12.errors.txt | 44 +++++++++---------- .../computedPropertyNames14.errors.txt | 24 +++++----- .../computedPropertyNames15.errors.txt | 8 ++-- .../computedPropertyNames17.errors.txt | 24 +++++----- .../computedPropertyNames3.errors.txt | 16 +++---- .../computedPropertyNames32.errors.txt | 4 +- .../computedPropertyNames35.errors.txt | 8 ++-- .../computedPropertyNames42.errors.txt | 4 +- .../computedPropertyNames5.errors.txt | 24 +++++----- .../computedPropertyNames6.errors.txt | 8 ++-- .../computedPropertyNames8.errors.txt | 8 ++-- .../computedPropertyNames9.errors.txt | 4 +- ...edPropertyNamesDeclarationEmit3.errors.txt | 4 +- ...edPropertyNamesDeclarationEmit4.errors.txt | 4 +- ...omputedPropertyNamesOnOverloads.errors.txt | 8 ++-- ...eReferenceWithoutTypeArgument.d.errors.txt | 4 +- ...ypeReferenceWithoutTypeArgument.errors.txt | 4 +- ...peReferenceWithoutTypeArgument2.errors.txt | 4 +- ...peReferenceWithoutTypeArgument3.errors.txt | 4 +- tests/baselines/reference/giant.errors.txt | 32 +++++++------- ...SignatureMustHaveTypeAnnotation.errors.txt | 8 ++-- .../indexSignatureWithInitializer.errors.txt | 8 ++-- .../reference/indexTypeCheck.errors.txt | 4 +- .../indexWithoutParamType2.errors.txt | 4 +- .../parserComputedPropertyName10.errors.txt | 4 +- .../parserComputedPropertyName11.errors.txt | 4 +- .../parserComputedPropertyName13.errors.txt | 4 +- .../parserComputedPropertyName14.errors.txt | 4 +- .../parserComputedPropertyName15.errors.txt | 4 +- .../parserComputedPropertyName18.errors.txt | 4 +- .../parserComputedPropertyName19.errors.txt | 4 +- .../parserComputedPropertyName20.errors.txt | 4 +- .../parserComputedPropertyName21.errors.txt | 4 +- .../parserComputedPropertyName22.errors.txt | 4 +- .../parserComputedPropertyName25.errors.txt | 4 +- .../parserComputedPropertyName28.errors.txt | 8 ++-- .../parserComputedPropertyName29.errors.txt | 8 ++-- .../parserComputedPropertyName31.errors.txt | 8 ++-- .../parserComputedPropertyName32.errors.txt | 4 +- .../parserComputedPropertyName36.errors.txt | 4 +- .../parserComputedPropertyName41.errors.txt | 4 +- .../parserComputedPropertyName7.errors.txt | 4 +- .../parserComputedPropertyName8.errors.txt | 4 +- .../parserComputedPropertyName9.errors.txt | 4 +- .../parserES5ComputedPropertyName1.errors.txt | 4 +- ...parserES5ComputedPropertyName10.errors.txt | 4 +- ...parserES5ComputedPropertyName11.errors.txt | 4 +- .../parserES5ComputedPropertyName5.errors.txt | 4 +- .../parserES5ComputedPropertyName7.errors.txt | 4 +- .../parserES5ComputedPropertyName8.errors.txt | 4 +- .../parserES5ComputedPropertyName9.errors.txt | 4 +- .../parserES5SymbolIndexer1.errors.txt | 4 +- .../parserES5SymbolIndexer2.errors.txt | 4 +- .../parserES5SymbolIndexer3.errors.txt | 4 +- .../parserIndexSignature11.errors.txt | 4 +- .../parserIndexSignature4.errors.txt | 4 +- .../parserIndexSignature5.errors.txt | 4 +- .../parserIndexSignature6.errors.txt | 4 +- .../parserIndexSignature8.errors.txt | 8 ++-- .../reference/propertyAssignment.errors.txt | 4 +- .../reference/symbolProperty3.errors.txt | 12 ++--- .../reference/symbolProperty53.errors.txt | 4 +- .../reference/symbolProperty7.errors.txt | 8 ++-- 67 files changed, 254 insertions(+), 254 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 95af0816902..4973dd37450 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5535,7 +5535,7 @@ module ts { // This will allow types number, string, Symbol or any. It will also allow enums, the unknown // type, and any union of these types (like string | number). if (!isTypeOfKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.ESSymbol)) { - error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_Symbol_or_any); + error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } } @@ -10526,12 +10526,12 @@ module ts { if (parameter.type.kind !== SyntaxKind.StringKeyword && parameter.type.kind !== SyntaxKind.NumberKeyword) { if (parameter.type.kind === SyntaxKind.SymbolKeyword) { if (languageVersion < ScriptTarget.ES6) { - return grammarErrorOnNode(parameter.type, Diagnostics.Symbol_indexers_are_only_available_when_targeting_ECMAScript_6_and_higher); + return grammarErrorOnNode(parameter.type, Diagnostics.symbol_indexers_are_only_available_when_targeting_ECMAScript_6_and_higher); } // No error for parameter type } else { - return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_number_or_Symbol); + return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_number_or_symbol); } } if (!node.type) { @@ -10839,17 +10839,17 @@ module ts { // and accessors are not allowed in ambient contexts in general, // so this error only really matters for methods. if (isInAmbientContext(node)) { - return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_Symbol); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol); } else if (!node.body) { - return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_Symbol); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol); } } else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) { - return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_Symbol); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol); } else if (node.parent.kind === SyntaxKind.TypeLiteral) { - return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_Symbol); + return checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol); } } @@ -11120,17 +11120,17 @@ module ts { function checkGrammarProperty(node: PropertyDeclaration) { if (node.parent.kind === SyntaxKind.ClassDeclaration) { if (checkGrammarForInvalidQuestionMark(node, node.questionToken, Diagnostics.A_class_member_cannot_be_declared_optional) || - checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_Symbol)) { + checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol)) { return true; } } else if (node.parent.kind === SyntaxKind.InterfaceDeclaration) { - if (checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_Symbol)) { + if (checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol)) { return true; } } else if (node.parent.kind === SyntaxKind.TypeLiteral) { - if (checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_Symbol)) { + if (checkGrammarForNonSymbolComputedProperty(node.name, Diagnostics.A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol)) { return true; } } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 0955702fe02..e16130a0ecd 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -19,7 +19,7 @@ module ts { An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an initializer." }, An_index_signature_must_have_a_type_annotation: { code: 1021, category: DiagnosticCategory.Error, key: "An index signature must have a type annotation." }, An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: DiagnosticCategory.Error, key: "An index signature parameter must have a type annotation." }, - An_index_signature_parameter_type_must_be_string_number_or_Symbol: { code: 1023, category: DiagnosticCategory.Error, key: "An index signature parameter type must be 'string', 'number', or 'Symbol'." }, + An_index_signature_parameter_type_must_be_string_number_or_symbol: { code: 1023, category: DiagnosticCategory.Error, key: "An index signature parameter type must be 'string', 'number', or 'symbol'." }, A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: DiagnosticCategory.Error, key: "A class or interface declaration can only have one 'extends' clause." }, An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: DiagnosticCategory.Error, key: "An 'extends' clause must precede an 'implements' clause." }, A_class_can_only_extend_a_single_class: { code: 1026, category: DiagnosticCategory.Error, key: "A class can only extend a single class." }, @@ -123,12 +123,12 @@ module ts { An_object_member_cannot_be_declared_optional: { code: 1162, category: DiagnosticCategory.Error, key: "An object member cannot be declared optional." }, yield_expression_must_be_contained_within_a_generator_declaration: { code: 1163, category: DiagnosticCategory.Error, key: "'yield' expression must be contained_within a generator declaration." }, Computed_property_names_are_not_allowed_in_enums: { code: 1164, category: DiagnosticCategory.Error, key: "Computed property names are not allowed in enums." }, - A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_Symbol: { code: 1165, category: DiagnosticCategory.Error, key: "A computed property name in an ambient context must directly refer to a built-in Symbol." }, - A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_Symbol: { code: 1166, category: DiagnosticCategory.Error, key: "A computed property name in a class property declaration must directly refer to a built-in Symbol." }, + A_computed_property_name_in_an_ambient_context_must_directly_refer_to_a_built_in_symbol: { code: 1165, category: DiagnosticCategory.Error, key: "A computed property name in an ambient context must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_class_property_declaration_must_directly_refer_to_a_built_in_symbol: { code: 1166, category: DiagnosticCategory.Error, key: "A computed property name in a class property declaration must directly refer to a built-in symbol." }, Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1167, category: DiagnosticCategory.Error, key: "Computed property names are only available when targeting ECMAScript 6 and higher." }, - A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_Symbol: { code: 1168, category: DiagnosticCategory.Error, key: "A computed property name in a method overload must directly refer to a built-in Symbol." }, - A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_Symbol: { code: 1169, category: DiagnosticCategory.Error, key: "A computed property name in an interface must directly refer to a built-in Symbol." }, - A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_Symbol: { code: 1170, category: DiagnosticCategory.Error, key: "A computed property name in a type literal must directly refer to a built-in Symbol." }, + A_computed_property_name_in_a_method_overload_must_directly_refer_to_a_built_in_symbol: { code: 1168, category: DiagnosticCategory.Error, key: "A computed property name in a method overload must directly refer to a built-in symbol." }, + A_computed_property_name_in_an_interface_must_directly_refer_to_a_built_in_symbol: { code: 1169, category: DiagnosticCategory.Error, key: "A computed property name in an interface must directly refer to a built-in symbol." }, + A_computed_property_name_in_a_type_literal_must_directly_refer_to_a_built_in_symbol: { code: 1170, category: DiagnosticCategory.Error, key: "A computed property name in a type literal must directly refer to a built-in symbol." }, A_comma_expression_is_not_allowed_in_a_computed_property_name: { code: 1171, category: DiagnosticCategory.Error, key: "A comma expression is not allowed in a computed property name." }, extends_clause_already_seen: { code: 1172, category: DiagnosticCategory.Error, key: "'extends' clause already seen." }, extends_clause_must_precede_implements_clause: { code: 1173, category: DiagnosticCategory.Error, key: "'extends' clause must precede 'implements' clause." }, @@ -147,7 +147,7 @@ module ts { Merge_conflict_marker_encountered: { code: 1185, category: DiagnosticCategory.Error, key: "Merge conflict marker encountered." }, A_rest_element_cannot_have_an_initializer: { code: 1186, category: DiagnosticCategory.Error, key: "A rest element cannot have an initializer." }, A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: DiagnosticCategory.Error, key: "A parameter property may not be a binding pattern." }, - Symbol_indexers_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1188, category: DiagnosticCategory.Error, key: "'Symbol' indexers are only available when targeting ECMAScript 6 and higher.", isEarly: true }, + symbol_indexers_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1188, category: DiagnosticCategory.Error, key: "'symbol' indexers are only available when targeting ECMAScript 6 and higher.", isEarly: true }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, @@ -300,10 +300,10 @@ module ts { Type_0_is_not_an_array_type: { code: 2461, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type." }, A_rest_element_must_be_last_in_an_array_destructuring_pattern: { code: 2462, category: DiagnosticCategory.Error, key: "A rest element must be last in an array destructuring pattern" }, A_binding_pattern_parameter_cannot_be_optional_in_an_implementation_signature: { code: 2463, category: DiagnosticCategory.Error, key: "A binding pattern parameter cannot be optional in an implementation signature." }, - A_computed_property_name_must_be_of_type_string_number_Symbol_or_any: { code: 2464, category: DiagnosticCategory.Error, key: "A computed property name must be of type 'string', 'number', 'Symbol', or 'any'." }, + A_computed_property_name_must_be_of_type_string_number_symbol_or_any: { code: 2464, category: DiagnosticCategory.Error, key: "A computed property name must be of type 'string', 'number', 'symbol', or 'any'." }, this_cannot_be_referenced_in_a_computed_property_name: { code: 2465, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a computed property name." }, super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in a computed property name." }, - A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." }, + A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." }, Cannot_find_global_value_0: { code: 2468, category: DiagnosticCategory.Error, key: "Cannot find global value '{0}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 581f8a5cafe..876f3184d15 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -67,7 +67,7 @@ "category": "Error", "code": 1022 }, - "An index signature parameter type must be 'string', 'number', or 'Symbol'.": { + "An index signature parameter type must be 'string', 'number', or 'symbol'.": { "category": "Error", "code": 1023 }, @@ -483,11 +483,11 @@ "category": "Error", "code": 1164 }, - "A computed property name in an ambient context must directly refer to a built-in Symbol.": { + "A computed property name in an ambient context must directly refer to a built-in symbol.": { "category": "Error", "code": 1165 }, - "A computed property name in a class property declaration must directly refer to a built-in Symbol.": { + "A computed property name in a class property declaration must directly refer to a built-in symbol.": { "category": "Error", "code": 1166 }, @@ -495,15 +495,15 @@ "category": "Error", "code": 1167 }, - "A computed property name in a method overload must directly refer to a built-in Symbol.": { + "A computed property name in a method overload must directly refer to a built-in symbol.": { "category": "Error", "code": 1168 }, - "A computed property name in an interface must directly refer to a built-in Symbol.": { + "A computed property name in an interface must directly refer to a built-in symbol.": { "category": "Error", "code": 1169 }, - "A computed property name in a type literal must directly refer to a built-in Symbol.": { + "A computed property name in a type literal must directly refer to a built-in symbol.": { "category": "Error", "code": 1170 }, @@ -579,7 +579,7 @@ "category": "Error", "code": 1187 }, - "'Symbol' indexers are only available when targeting ECMAScript 6 and higher.": { + "'symbol' indexers are only available when targeting ECMAScript 6 and higher.": { "category": "Error", "code": 1188, "isEarly": true @@ -1193,7 +1193,7 @@ "category": "Error", "code": 2463 }, - "A computed property name must be of type 'string', 'number', 'Symbol', or 'any'.": { + "A computed property name must be of type 'string', 'number', 'symbol', or 'any'.": { "category": "Error", "code": 2464 }, @@ -1207,7 +1207,7 @@ }, "A computed property name cannot reference a type parameter from its containing type.": { "category": "Error", - "code": 2466 + "code": 2467 }, "Cannot find global value '{0}'.": { "category": "Error", diff --git a/tests/baselines/reference/arraySigChecking.errors.txt b/tests/baselines/reference/arraySigChecking.errors.txt index 82a32dbda4d..85948381ff5 100644 --- a/tests/baselines/reference/arraySigChecking.errors.txt +++ b/tests/baselines/reference/arraySigChecking.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/arraySigChecking.ts(11,17): error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. +tests/cases/compiler/arraySigChecking.ts(11,17): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. tests/cases/compiler/arraySigChecking.ts(18,5): error TS2322: Type 'void[]' is not assignable to type 'string[]'. Type 'void' is not assignable to type 'string'. tests/cases/compiler/arraySigChecking.ts(22,1): error TS2322: Type 'number[][]' is not assignable to type 'number[][][]'. @@ -20,7 +20,7 @@ tests/cases/compiler/arraySigChecking.ts(22,1): error TS2322: Type 'number[][]' var foo: { [index: any]; }; // expect an error here ~~~~~ -!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. +!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. } interface myInt { diff --git a/tests/baselines/reference/computedPropertyNames12.errors.txt b/tests/baselines/reference/computedPropertyNames12.errors.txt index f0fd658c33a..1fdf741f893 100644 --- a/tests/baselines/reference/computedPropertyNames12.errors.txt +++ b/tests/baselines/reference/computedPropertyNames12.errors.txt @@ -1,14 +1,14 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(5,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(6,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(7,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(10,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(11,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(12,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(13,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(14,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(15,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(5,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(6,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(7,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(10,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(11,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(12,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(13,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(14,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(15,12): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts (11 errors) ==== @@ -18,35 +18,35 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames12.ts(15,12) class C { [s]: number; ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. [n] = n; ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. static [s + s]: string; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. [s + n] = 2; ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. [+s]: typeof s; ~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. static [""]: number; ~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. [0]: number; ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. [a]: number; ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. static [true]: number; ~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. [`hello bye`] = 0; ~~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. static [`hello ${a} bye`] = 0 ~~~~~~~~~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames14.errors.txt b/tests/baselines/reference/computedPropertyNames14.errors.txt index 23d22be0780..9ab0cf6a4e9 100644 --- a/tests/baselines/reference/computedPropertyNames14.errors.txt +++ b/tests/baselines/reference/computedPropertyNames14.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(6,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts (6 errors) ==== @@ -11,20 +11,20 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames14.ts(8,12): class C { [b]() {} ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static [true]() { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [[]]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static [{}]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [undefined]() { } ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static [null]() { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames15.errors.txt b/tests/baselines/reference/computedPropertyNames15.errors.txt index dc0ffb5fe46..64b08df3221 100644 --- a/tests/baselines/reference/computedPropertyNames15.errors.txt +++ b/tests/baselines/reference/computedPropertyNames15.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts (2 errors) ==== @@ -10,8 +10,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames15.ts(7,5): [p1]() { } [p2]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [p3]() { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames17.errors.txt b/tests/baselines/reference/computedPropertyNames17.errors.txt index 78ce6d5e433..df9fe01528a 100644 --- a/tests/baselines/reference/computedPropertyNames17.errors.txt +++ b/tests/baselines/reference/computedPropertyNames17.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(3,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(4,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts (6 errors) ==== @@ -11,20 +11,20 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames17.ts(8,9): class C { get [b]() { return 0;} ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static set [true](v) { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. get [[]]() { return 0; } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. set [{}](v) { } ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static get [undefined]() { return 0; } ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. set [null](v) { } ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames3.errors.txt b/tests/baselines/reference/computedPropertyNames3.errors.txt index 23dbcf7d9b1..7136e441e72 100644 --- a/tests/baselines/reference/computedPropertyNames3.errors.txt +++ b/tests/baselines/reference/computedPropertyNames3.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(4,12): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. -tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts (6 errors) ==== @@ -12,19 +12,19 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames3.ts(7,16): [0 + 1]() { } static [() => { }]() { } ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. get [delete id]() { } ~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. set [[0, 1]](v) { } ~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static get [""]() { } ~~~~~~~~~~~~ !!! error TS2378: A 'get' accessor must return a value or consist of a single 'throw' statement. ~~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. static set [id.toString()](v) { } } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames32.errors.txt b/tests/baselines/reference/computedPropertyNames32.errors.txt index e2f08c79fc9..63b13d40ab4 100644 --- a/tests/baselines/reference/computedPropertyNames32.errors.txt +++ b/tests/baselines/reference/computedPropertyNames32.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts(6,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts(6,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts (1 errors) ==== @@ -9,5 +9,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames32.ts(6,10): } [foo()]() { } ~ -!!! error TS2466: A computed property name cannot reference a type parameter from its containing type. +!!! error TS2467: A computed property name cannot reference a type parameter from its containing type. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames35.errors.txt b/tests/baselines/reference/computedPropertyNames35.errors.txt index c9986864b0e..aa9279fe9c3 100644 --- a/tests/baselines/reference/computedPropertyNames35.errors.txt +++ b/tests/baselines/reference/computedPropertyNames35.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,5): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,10): error TS2466: A computed property name cannot reference a type parameter from its containing type. +tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,10): error TS2467: A computed property name cannot reference a type parameter from its containing type. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts (2 errors) ==== @@ -8,7 +8,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames35.ts(4,10): bar(): string; [foo()](): void; ~~~~~~~~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ -!!! error TS2466: A computed property name cannot reference a type parameter from its containing type. +!!! error TS2467: A computed property name cannot reference a type parameter from its containing type. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames42.errors.txt b/tests/baselines/reference/computedPropertyNames42.errors.txt index 2c05e8869c0..417931c535f 100644 --- a/tests/baselines/reference/computedPropertyNames42.errors.txt +++ b/tests/baselines/reference/computedPropertyNames42.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. @@ -12,7 +12,7 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames42.ts(8,5): // Computed properties [""]: Foo; ~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~~~~~~~~~ !!! error TS2411: Property '[""]' of type 'Foo' is not assignable to string index type 'Foo2'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames5.errors.txt b/tests/baselines/reference/computedPropertyNames5.errors.txt index d8fa1d30750..2b59a816e16 100644 --- a/tests/baselines/reference/computedPropertyNames5.errors.txt +++ b/tests/baselines/reference/computedPropertyNames5.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(5,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts (6 errors) ==== @@ -11,20 +11,20 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames5.ts(8,5): e var v = { [b]: 0, ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [true]: 1, ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [[]]: 0, ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [{}]: 0, ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [undefined]: undefined, ~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [null]: null ~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames6.errors.txt b/tests/baselines/reference/computedPropertyNames6.errors.txt index 3ee4387610b..1a651b581c3 100644 --- a/tests/baselines/reference/computedPropertyNames6.errors.txt +++ b/tests/baselines/reference/computedPropertyNames6.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(6,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts (2 errors) ==== @@ -10,8 +10,8 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames6.ts(7,5): e [p1]: 0, [p2]: 1, ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [p3]: 2 ~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames8.errors.txt b/tests/baselines/reference/computedPropertyNames8.errors.txt index f45280c517c..44e32e0a771 100644 --- a/tests/baselines/reference/computedPropertyNames8.errors.txt +++ b/tests/baselines/reference/computedPropertyNames8.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts (2 errors) ==== @@ -9,9 +9,9 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames8.ts(6,9): e var v = { [t]: 0, ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [u]: 1 ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. }; } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames9.errors.txt b/tests/baselines/reference/computedPropertyNames9.errors.txt index ba27c193767..a71e0f5e8eb 100644 --- a/tests/baselines/reference/computedPropertyNames9.errors.txt +++ b/tests/baselines/reference/computedPropertyNames9.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts (1 errors) ==== @@ -12,5 +12,5 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames9.ts(9,5): e [f(0)]: 0, [f(true)]: 0 ~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt index ab2d1822e4c..961b64a7f32 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit3.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit3.ts (1 errors) ==== interface I { ["" + ""](): void; ~~~~~~~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt index f366427d525..45fa3ae521e 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit4.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts(2,5): error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts(2,5): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesDeclarationEmit4.ts (1 errors) ==== var v: { ["" + ""](): void; ~~~~~~~~~ -!!! error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt b/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt index 64b6ba87452..ee7b67ad829 100644 --- a/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt +++ b/tests/baselines/reference/computedPropertyNamesOnOverloads.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(4,5): error TS1168: A computed property name in a method overload must directly refer to a built-in Symbol. -tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(5,5): error TS1168: A computed property name in a method overload must directly refer to a built-in Symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(4,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. +tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts(5,5): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. ==== tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads.ts (2 errors) ==== @@ -8,9 +8,9 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNamesOnOverloads. class C { [methodName](v: string); ~~~~~~~~~~~~ -!!! error TS1168: A computed property name in a method overload must directly refer to a built-in Symbol. +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. [methodName](); ~~~~~~~~~~~~ -!!! error TS1168: A computed property name in a method overload must directly refer to a built-in Symbol. +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. [methodName](v?: string) { } } \ No newline at end of file diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt index 68543a10b01..5d7da139c2b 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(10,21): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(11,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(11,26): error TS2314: Generic type 'C' requires 1 type argument(s). -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,19): error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,19): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,26): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(14,23): error TS2314: Generic type 'C' requires 1 type argument(s). @@ -36,7 +36,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc !!! error TS2314: Generic type 'C' requires 1 type argument(s). declare var d: { [x: C]: C }; ~ -!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. +!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. ~ !!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt index 9076b86ff3e..7b5116356c7 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(10,13): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(11,14): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(11,18): error TS2314: Generic type 'C' requires 1 type argument(s). -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,11): error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,11): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,14): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,18): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(14,13): error TS2314: Generic type 'C' requires 1 type argument(s). @@ -46,7 +46,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc !!! error TS2314: Generic type 'C' requires 1 type argument(s). var d: { [x: C]: C }; ~ -!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. +!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. ~ !!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt index ca79c04f6ed..136682b1ca1 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(10,13): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(11,14): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(11,18): error TS2314: Generic type 'I' requires 1 type argument(s). -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,11): error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,11): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,14): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,18): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(14,13): error TS2314: Generic type 'I' requires 1 type argument(s). @@ -46,7 +46,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc !!! error TS2314: Generic type 'I' requires 1 type argument(s). var d: { [x: I]: I }; ~ -!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. +!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. ~ !!! error TS2314: Generic type 'I' requires 1 type argument(s). ~ diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt index 7154a90cb8a..d755a9120a8 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(10,21): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(11,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(11,26): error TS2314: Generic type 'C' requires 1 type argument(s). -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,19): error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,19): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,26): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(14,23): error TS2314: Generic type 'C' requires 1 type argument(s). @@ -36,7 +36,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc !!! error TS2314: Generic type 'C' requires 1 type argument(s). declare var d: { [x: C]: C }; ~ -!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. +!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. ~ !!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ diff --git a/tests/baselines/reference/giant.errors.txt b/tests/baselines/reference/giant.errors.txt index 99a4360ac52..1d623870d63 100644 --- a/tests/baselines/reference/giant.errors.txt +++ b/tests/baselines/reference/giant.errors.txt @@ -16,7 +16,7 @@ tests/cases/compiler/giant.ts(34,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(35,12): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(36,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(36,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(61,5): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +tests/cases/compiler/giant.ts(61,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(61,6): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(62,5): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(63,6): error TS1096: An index signature must have exactly one parameter. @@ -39,7 +39,7 @@ tests/cases/compiler/giant.ts(98,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(99,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(100,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(100,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(125,9): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +tests/cases/compiler/giant.ts(125,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(125,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(126,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(127,10): error TS1096: An index signature must have exactly one parameter. @@ -63,7 +63,7 @@ tests/cases/compiler/giant.ts(177,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(178,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(179,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(179,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(204,9): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +tests/cases/compiler/giant.ts(204,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(204,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(205,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(206,10): error TS1096: An index signature must have exactly one parameter. @@ -119,7 +119,7 @@ tests/cases/compiler/giant.ts(292,16): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(293,12): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(294,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(294,16): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(319,5): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +tests/cases/compiler/giant.ts(319,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(319,6): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(320,5): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(321,6): error TS1096: An index signature must have exactly one parameter. @@ -142,7 +142,7 @@ tests/cases/compiler/giant.ts(356,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(357,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(358,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(358,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(383,9): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +tests/cases/compiler/giant.ts(383,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(383,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(384,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(385,10): error TS1096: An index signature must have exactly one parameter. @@ -166,7 +166,7 @@ tests/cases/compiler/giant.ts(435,20): error TS2300: Duplicate identifier 'tsF'. tests/cases/compiler/giant.ts(436,16): error TS2300: Duplicate identifier 'tgF'. tests/cases/compiler/giant.ts(437,20): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/giant.ts(437,20): error TS2300: Duplicate identifier 'tgF'. -tests/cases/compiler/giant.ts(462,9): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +tests/cases/compiler/giant.ts(462,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(462,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(463,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(464,10): error TS1096: An index signature must have exactly one parameter. @@ -238,7 +238,7 @@ tests/cases/compiler/giant.ts(556,21): error TS1036: Statements are not allowed tests/cases/compiler/giant.ts(558,24): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(561,21): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(563,21): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(587,9): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +tests/cases/compiler/giant.ts(587,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(587,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(588,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(589,10): error TS1096: An index signature must have exactly one parameter. @@ -255,7 +255,7 @@ tests/cases/compiler/giant.ts(621,26): error TS1184: An implementation cannot be tests/cases/compiler/giant.ts(623,24): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(626,21): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/compiler/giant.ts(628,21): error TS1184: An implementation cannot be declared in ambient contexts. -tests/cases/compiler/giant.ts(653,9): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +tests/cases/compiler/giant.ts(653,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/giant.ts(653,10): error TS2304: Cannot find name 'p'. tests/cases/compiler/giant.ts(654,9): error TS1021: An index signature must have a type annotation. tests/cases/compiler/giant.ts(655,10): error TS1096: An index signature must have exactly one parameter. @@ -364,7 +364,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -474,7 +474,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -601,7 +601,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -828,7 +828,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -938,7 +938,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -1065,7 +1065,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -1334,7 +1334,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; @@ -1434,7 +1434,7 @@ tests/cases/compiler/giant.ts(676,30): error TS1184: An implementation cannot be //Index Signature [p]; ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; diff --git a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt index e8b8ed9d488..88e09d7746b 100644 --- a/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt +++ b/tests/baselines/reference/indexSignatureMustHaveTypeAnnotation.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(3,6): error TS2304: Cannot find name 'x'. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(4,5): error TS1021: An index signature must have a type annotation. -tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(9,6): error TS2304: Cannot find name 'x'. tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021: An index signature must have a type annotation. @@ -11,7 +11,7 @@ tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021 // Used to be indexer, now it is a computed property [x]: string; ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. [x: string]; @@ -23,7 +23,7 @@ tests/cases/compiler/indexSignatureMustHaveTypeAnnotation.ts(14,5): error TS1021 // Used to be indexer, now it is a computed property [x]: string ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. diff --git a/tests/baselines/reference/indexSignatureWithInitializer.errors.txt b/tests/baselines/reference/indexSignatureWithInitializer.errors.txt index b7298e6b5e7..4a49de69393 100644 --- a/tests/baselines/reference/indexSignatureWithInitializer.errors.txt +++ b/tests/baselines/reference/indexSignatureWithInitializer.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/indexSignatureWithInitializer.ts(3,5): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +tests/cases/compiler/indexSignatureWithInitializer.ts(3,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/compiler/indexSignatureWithInitializer.ts(3,6): error TS2304: Cannot find name 'x'. -tests/cases/compiler/indexSignatureWithInitializer.ts(7,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/compiler/indexSignatureWithInitializer.ts(7,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot find name 'x'. @@ -9,7 +9,7 @@ tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot interface I { [x = '']: string; ~~~~~~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. } @@ -17,7 +17,7 @@ tests/cases/compiler/indexSignatureWithInitializer.ts(7,6): error TS2304: Cannot class C { [x = 0]: string ~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/indexTypeCheck.errors.txt b/tests/baselines/reference/indexTypeCheck.errors.txt index 0914ea9ca7b..f45e56ef6df 100644 --- a/tests/baselines/reference/indexTypeCheck.errors.txt +++ b/tests/baselines/reference/indexTypeCheck.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/indexTypeCheck.ts(17,2): error TS2413: Numeric index type ' tests/cases/compiler/indexTypeCheck.ts(22,2): error TS2413: Numeric index type 'Orange' is not assignable to string index type 'Yellow'. tests/cases/compiler/indexTypeCheck.ts(27,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'. tests/cases/compiler/indexTypeCheck.ts(32,3): error TS1096: An index signature must have exactly one parameter. -tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. +tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. @@ -58,7 +58,7 @@ tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression interface Magenta { [p:Purple]; // error ~ -!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. +!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. } var yellow: Yellow; diff --git a/tests/baselines/reference/indexWithoutParamType2.errors.txt b/tests/baselines/reference/indexWithoutParamType2.errors.txt index 163b7b98753..7e72b7804e2 100644 --- a/tests/baselines/reference/indexWithoutParamType2.errors.txt +++ b/tests/baselines/reference/indexWithoutParamType2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/indexWithoutParamType2.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/compiler/indexWithoutParamType2.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/compiler/indexWithoutParamType2.ts(3,6): error TS2304: Cannot find name 'x'. @@ -7,7 +7,7 @@ tests/cases/compiler/indexWithoutParamType2.ts(3,6): error TS2304: Cannot find n // Used to be indexer, now it is a computed property [x]: string ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'x'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName10.errors.txt b/tests/baselines/reference/parserComputedPropertyName10.errors.txt index 96ed65032af..a9b5396781a 100644 --- a/tests/baselines/reference/parserComputedPropertyName10.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName10.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName10.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e] = 1 ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName11.errors.txt b/tests/baselines/reference/parserComputedPropertyName11.errors.txt index 2083c5bc819..2a7a606f4bf 100644 --- a/tests/baselines/reference/parserComputedPropertyName11.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,4): error TS1168: A computed property name in a method overload must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,4): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName11.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e](); ~~~ -!!! error TS1168: A computed property name in a method overload must directly refer to a built-in Symbol. +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName13.errors.txt b/tests/baselines/reference/parserComputedPropertyName13.errors.txt index e0d06224488..a7a77cf1244 100644 --- a/tests/baselines/reference/parserComputedPropertyName13.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName13.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName13.ts (2 errors) ==== var v: { [e]: number }; ~~~ -!!! error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName14.errors.txt b/tests/baselines/reference/parserComputedPropertyName14.errors.txt index 99e36669f50..50a6d1bc689 100644 --- a/tests/baselines/reference/parserComputedPropertyName14.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName14.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName14.ts (2 errors) ==== var v: { [e](): number }; ~~~ -!!! error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName15.errors.txt b/tests/baselines/reference/parserComputedPropertyName15.errors.txt index 1985338e19f..9635178af16 100644 --- a/tests/baselines/reference/parserComputedPropertyName15.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName15.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,31): error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,31): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts(1,32): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName15.ts (2 errors) ==== var v: { [e: number]: string; [e]: number }; ~~~ -!!! error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName18.errors.txt b/tests/baselines/reference/parserComputedPropertyName18.errors.txt index 9a78c057cc7..9e64ddd0d28 100644 --- a/tests/baselines/reference/parserComputedPropertyName18.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName18.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName18.ts (2 errors) ==== var v: { [e]?(): number }; ~~~ -!!! error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName19.errors.txt b/tests/baselines/reference/parserComputedPropertyName19.errors.txt index 412995f93e0..86bb591011e 100644 --- a/tests/baselines/reference/parserComputedPropertyName19.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName19.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName19.ts (2 errors) ==== var v: { [e]? }; ~~~ -!!! error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName20.errors.txt b/tests/baselines/reference/parserComputedPropertyName20.errors.txt index 7c93d63a7ef..035e494af33 100644 --- a/tests/baselines/reference/parserComputedPropertyName20.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName20.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName20.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP interface I { [e](): number ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName21.errors.txt b/tests/baselines/reference/parserComputedPropertyName21.errors.txt index 603940f24b2..4ebc321cc80 100644 --- a/tests/baselines/reference/parserComputedPropertyName21.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName21.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName21.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP interface I { [e]: number ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName22.errors.txt b/tests/baselines/reference/parserComputedPropertyName22.errors.txt index 2cdd5321e02..fd9e3797018 100644 --- a/tests/baselines/reference/parserComputedPropertyName22.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName22.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName22.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP declare class C { [e]: number ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName25.errors.txt b/tests/baselines/reference/parserComputedPropertyName25.errors.txt index d0b632aa2ec..0d0a2a8d833 100644 --- a/tests/baselines/reference/parserComputedPropertyName25.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName25.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(3,6): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName25.ts(4,6): error TS2304: Cannot find name 'e2'. @@ -8,7 +8,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP // No ASI [e] = 0 ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. [e2] = 1 diff --git a/tests/baselines/reference/parserComputedPropertyName28.errors.txt b/tests/baselines/reference/parserComputedPropertyName28.errors.txt index 70a010092e4..a84f3b7d16b 100644 --- a/tests/baselines/reference/parserComputedPropertyName28.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName28.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(2,6): error TS2304: Cannot find name 'e'. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName28.ts(3,6): error TS2304: Cannot find name 'e2'. @@ -8,12 +8,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e]: number = 0; ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. [e2]: number ~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~ !!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName29.errors.txt b/tests/baselines/reference/parserComputedPropertyName29.errors.txt index 54d3f9746ff..3d886eacc50 100644 --- a/tests/baselines/reference/parserComputedPropertyName29.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName29.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,6): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(3,11): error TS2304: Cannot find name 'id'. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName29.ts(4,6): error TS2304: Cannot find name 'e2'. @@ -10,14 +10,14 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP // yes ASI [e] = id++ ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. ~~ !!! error TS2304: Cannot find name 'id'. [e2]: number ~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~ !!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName31.errors.txt b/tests/baselines/reference/parserComputedPropertyName31.errors.txt index ef4f34bd3e3..4661b0797af 100644 --- a/tests/baselines/reference/parserComputedPropertyName31.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName31.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(3,6): error TS2304: Cannot find name 'e'. -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName31.ts(4,6): error TS2304: Cannot find name 'e2'. @@ -9,12 +9,12 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP // yes ASI [e]: number ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. [e2]: number ~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~ !!! error TS2304: Cannot find name 'e2'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName32.errors.txt b/tests/baselines/reference/parserComputedPropertyName32.errors.txt index b70d346ce1e..4be8d70383e 100644 --- a/tests/baselines/reference/parserComputedPropertyName32.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName32.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,5): error TS1165: A computed property name in an ambient context must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,5): error TS1165: A computed property name in an ambient context must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName32.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP declare class C { [e](): number ~~~ -!!! error TS1165: A computed property name in an ambient context must directly refer to a built-in Symbol. +!!! error TS1165: A computed property name in an ambient context must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName36.errors.txt b/tests/baselines/reference/parserComputedPropertyName36.errors.txt index 3536ead6ebe..07e937b3b42 100644 --- a/tests/baselines/reference/parserComputedPropertyName36.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName36.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName36.ts(2,6): error TS2304: Cannot find name 'public'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [public ]: string; ~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~~~~~~ !!! error TS2304: Cannot find name 'public'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName41.errors.txt b/tests/baselines/reference/parserComputedPropertyName41.errors.txt index 3de11e5218a..5389b187cad 100644 --- a/tests/baselines/reference/parserComputedPropertyName41.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName41.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName41.ts (1 errors) ==== var v = { [0 in []]: true ~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName7.errors.txt b/tests/baselines/reference/parserComputedPropertyName7.errors.txt index 833383b64c9..056fa3d82fd 100644 --- a/tests/baselines/reference/parserComputedPropertyName7.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName7.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e] ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName8.errors.txt b/tests/baselines/reference/parserComputedPropertyName8.errors.txt index d8798997f59..32bb4906353 100644 --- a/tests/baselines/reference/parserComputedPropertyName8.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName8.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,11): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,11): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName8.ts(2,12): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { public [e] ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserComputedPropertyName9.errors.txt b/tests/baselines/reference/parserComputedPropertyName9.errors.txt index ce97d134718..9db0cbde3bd 100644 --- a/tests/baselines/reference/parserComputedPropertyName9.errors.txt +++ b/tests/baselines/reference/parserComputedPropertyName9.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,5): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'. @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript6/ComputedPropertyNames/parserComputedP class C { [e]: Type ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. ~~~~ diff --git a/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt index 7dc962d83b0..2c8f1d2ab4f 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName1.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName1.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput declare class C { [e]: number ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt index 76a2a986261..31d3f9985ab 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName10.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName10.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e] = 1 ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt index 41d146ba518..b4808607ab0 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,4): error TS1168: A computed property name in a method overload must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,4): error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName11.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e](); ~~~ -!!! error TS1168: A computed property name in a method overload must directly refer to a built-in Symbol. +!!! error TS1168: A computed property name in a method overload must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt index d375f202918..9125ce7b58f 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,5): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName5.ts(2,6): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput interface I { [e]: number ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt index 849cdc6d2a1..277bdcd3c94 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName7.ts(2,5): error TS2304: Cannot find name 'e'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e] ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt index 84cf5e849f6..6b674a1d2c0 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName8.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,10): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts(1,11): error TS2304: Cannot find name 'e'. ==== tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName8.ts (2 errors) ==== var v: { [e]: number }; ~~~ -!!! error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt b/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt index da62c00cd0f..fb087a4d82f 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt +++ b/tests/baselines/reference/parserES5ComputedPropertyName9.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,4): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,5): error TS2304: Cannot find name 'e'. tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5ComputedPropertyName9.ts(2,9): error TS2304: Cannot find name 'Type'. @@ -7,7 +7,7 @@ tests/cases/conformance/parser/ecmascript5/ComputedPropertyNames/parserES5Comput class C { [e]: Type ~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'e'. ~~~~ diff --git a/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt index a5ff176db61..a3c4f22a87e 100644 --- a/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt +++ b/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts(2,9): error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts(2,9): error TS1188: 'symbol' indexers are only available when targeting ECMAScript 6 and higher. ==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts (1 errors) ==== interface I { [s: symbol]: string; ~~~~~~ -!!! error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher. +!!! error TS1188: 'symbol' indexers are only available when targeting ECMAScript 6 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt index de4c97aae29..39d8aa41d77 100644 --- a/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt +++ b/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts(2,9): error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts(2,9): error TS1188: 'symbol' indexers are only available when targeting ECMAScript 6 and higher. ==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts (1 errors) ==== class C { [s: symbol]: string; ~~~~~~ -!!! error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher. +!!! error TS1188: 'symbol' indexers are only available when targeting ECMAScript 6 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt index e839338e772..34dea325439 100644 --- a/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt +++ b/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts(2,9): error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts(2,9): error TS1188: 'symbol' indexers are only available when targeting ECMAScript 6 and higher. ==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts (1 errors) ==== var x: { [s: symbol]: string; ~~~~~~ -!!! error TS1188: 'Symbol' indexers are only available when targeting ECMAScript 6 and higher. +!!! error TS1188: 'symbol' indexers are only available when targeting ECMAScript 6 and higher. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexSignature11.errors.txt b/tests/baselines/reference/parserIndexSignature11.errors.txt index b3c29f44d99..f1f2a4a00f4 100644 --- a/tests/baselines/reference/parserIndexSignature11.errors.txt +++ b/tests/baselines/reference/parserIndexSignature11.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,9): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,9): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(2,10): error TS2304: Cannot find name 'p'. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(3,9): error TS1021: An index signature must have a type annotation. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature11.ts(4,10): error TS1096: An index signature must have exactly one parameter. @@ -8,7 +8,7 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature1 interface I { [p]; // Used to be indexer, now it is a computed property ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'p'. [p1: string]; diff --git a/tests/baselines/reference/parserIndexSignature4.errors.txt b/tests/baselines/reference/parserIndexSignature4.errors.txt index f67ea364c46..bd73b4d2bf4 100644 --- a/tests/baselines/reference/parserIndexSignature4.errors.txt +++ b/tests/baselines/reference/parserIndexSignature4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,3): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,3): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4.ts(2,4): error TS2304: Cannot find name 'a'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature4 interface I { [a = 0] // Used to be indexer, now it is a computed property ~~~~~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'a'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexSignature5.errors.txt b/tests/baselines/reference/parserIndexSignature5.errors.txt index 85c9e0a21a1..54ccd05f4f9 100644 --- a/tests/baselines/reference/parserIndexSignature5.errors.txt +++ b/tests/baselines/reference/parserIndexSignature5.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,3): error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,3): error TS1169: A computed property name in an interface must directly refer to a built-in symbol. tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5.ts(2,4): error TS2304: Cannot find name 'a'. @@ -6,7 +6,7 @@ tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature5 interface I { [a] // Used to be indexer, now it is a computed property ~~~ -!!! error TS1169: A computed property name in an interface must directly refer to a built-in Symbol. +!!! error TS1169: A computed property name in an interface must directly refer to a built-in symbol. ~ !!! error TS2304: Cannot find name 'a'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexSignature6.errors.txt b/tests/baselines/reference/parserIndexSignature6.errors.txt index eae5aae90c9..52a3b28a519 100644 --- a/tests/baselines/reference/parserIndexSignature6.errors.txt +++ b/tests/baselines/reference/parserIndexSignature6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature6.ts(2,4): error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature6.ts(2,4): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. ==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature6.ts (1 errors) ==== interface I { [a:boolean] ~ -!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. +!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexSignature8.errors.txt b/tests/baselines/reference/parserIndexSignature8.errors.txt index 859d373eca4..efed14e9577 100644 --- a/tests/baselines/reference/parserIndexSignature8.errors.txt +++ b/tests/baselines/reference/parserIndexSignature8.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts(1,13): error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts(2,14): error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts(1,13): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts(2,14): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. ==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts (2 errors) ==== var foo: { [index: any]; }; // expect an error here ~~~~~ -!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. +!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. var foo2: { [index: RegExp]; }; // expect an error here ~~~~~ -!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'Symbol'. +!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/propertyAssignment.errors.txt b/tests/baselines/reference/propertyAssignment.errors.txt index 54a74e1b129..47359caf9c2 100644 --- a/tests/baselines/reference/propertyAssignment.errors.txt +++ b/tests/baselines/reference/propertyAssignment.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/propertyAssignment.ts(6,13): error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. +tests/cases/compiler/propertyAssignment.ts(6,13): error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. tests/cases/compiler/propertyAssignment.ts(6,14): error TS2304: Cannot find name 'index'. tests/cases/compiler/propertyAssignment.ts(14,1): error TS2322: Type '{ x: number; }' is not assignable to type 'new () => any'. tests/cases/compiler/propertyAssignment.ts(16,1): error TS2322: Type '{ x: number; }' is not assignable to type '() => void'. @@ -12,7 +12,7 @@ tests/cases/compiler/propertyAssignment.ts(16,1): error TS2322: Type '{ x: numbe var foo2: { [index]; } // should be an error, used to be indexer, now it is a computed property ~~~~~~~ -!!! error TS1170: A computed property name in a type literal must directly refer to a built-in Symbol. +!!! error TS1170: A computed property name in a type literal must directly refer to a built-in symbol. ~~~~~ !!! error TS2304: Cannot find name 'index'. var bar2: { x : number; } diff --git a/tests/baselines/reference/symbolProperty3.errors.txt b/tests/baselines/reference/symbolProperty3.errors.txt index 44c75a3ef7b..ed557c85a63 100644 --- a/tests/baselines/reference/symbolProperty3.errors.txt +++ b/tests/baselines/reference/symbolProperty3.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/es6/Symbols/symbolProperty3.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/Symbols/symbolProperty3.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. -tests/cases/conformance/es6/Symbols/symbolProperty3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/Symbols/symbolProperty3.ts(3,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/Symbols/symbolProperty3.ts(4,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/Symbols/symbolProperty3.ts(5,9): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/Symbols/symbolProperty3.ts (3 errors) ==== @@ -8,13 +8,13 @@ tests/cases/conformance/es6/Symbols/symbolProperty3.ts(5,9): error TS2464: A com var x = { [s]: 0, ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. [s]() { }, ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. get [s]() { ~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. return 0; } } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty53.errors.txt b/tests/baselines/reference/symbolProperty53.errors.txt index 87ec693263e..0d9601df68a 100644 --- a/tests/baselines/reference/symbolProperty53.errors.txt +++ b/tests/baselines/reference/symbolProperty53.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/es6/Symbols/symbolProperty53.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +tests/cases/conformance/es6/Symbols/symbolProperty53.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. ==== tests/cases/conformance/es6/Symbols/symbolProperty53.ts (1 errors) ==== var obj = { [Symbol.for]: 0 ~~~~~~~~~~~~ -!!! error TS2464: A computed property name must be of type 'string', 'number', 'Symbol', or 'any'. +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. }; \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty7.errors.txt b/tests/baselines/reference/symbolProperty7.errors.txt index 0fe3597a10e..652f637d852 100644 --- a/tests/baselines/reference/symbolProperty7.errors.txt +++ b/tests/baselines/reference/symbolProperty7.errors.txt @@ -1,15 +1,15 @@ -tests/cases/conformance/es6/Symbols/symbolProperty7.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. -tests/cases/conformance/es6/Symbols/symbolProperty7.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +tests/cases/conformance/es6/Symbols/symbolProperty7.ts(2,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. +tests/cases/conformance/es6/Symbols/symbolProperty7.ts(3,5): error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. ==== tests/cases/conformance/es6/Symbols/symbolProperty7.ts (2 errors) ==== class C { [Symbol()] = 0; ~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. [Symbol()]: number; ~~~~~~~~~~ -!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in Symbol. +!!! error TS1166: A computed property name in a class property declaration must directly refer to a built-in symbol. [Symbol()]() { } get [Symbol()]() { return 0; From 2d1647485cfb33a7ae1d84a6bc08ced6f952a552 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 4 Feb 2015 19:18:54 -0800 Subject: [PATCH 027/162] Fix expression checking for symbols --- src/compiler/checker.ts | 72 ++++++++-- .../diagnosticInformationMap.generated.ts | 3 +- src/compiler/diagnosticMessages.json | 6 +- .../inOperatorWithInvalidOperands.errors.txt | 32 ++--- .../reference/symbolProperty54.errors.txt | 9 ++ .../reference/symbolType1.errors.txt | 7 +- tests/baselines/reference/symbolType1.js | 6 +- tests/baselines/reference/symbolType11.types | 37 +++++ .../reference/symbolType12.errors.txt | 136 ++++++++++++++++++ tests/baselines/reference/symbolType12.js | 5 +- .../reference/symbolType13.errors.txt | 18 +++ .../reference/symbolType2.errors.txt | 8 ++ .../reference/symbolType3.errors.txt | 33 +++++ tests/baselines/reference/symbolType3.js | 5 +- .../reference/symbolType6.errors.txt | 57 ++++++++ tests/baselines/reference/symbolType6.js | 13 +- .../reference/symbolType8.errors.txt | 45 ++++++ tests/baselines/reference/symbolType8.js | 7 +- .../reference/widenedTypes.errors.txt | 4 +- .../conformance/es6/Symbols/symbolType1.ts | 4 +- .../conformance/es6/Symbols/symbolType12.ts | 4 +- .../conformance/es6/Symbols/symbolType3.ts | 4 +- .../conformance/es6/Symbols/symbolType6.ts | 8 +- .../conformance/es6/Symbols/symbolType8.ts | 5 +- 24 files changed, 484 insertions(+), 44 deletions(-) create mode 100644 tests/baselines/reference/symbolProperty54.errors.txt create mode 100644 tests/baselines/reference/symbolType11.types create mode 100644 tests/baselines/reference/symbolType12.errors.txt create mode 100644 tests/baselines/reference/symbolType13.errors.txt create mode 100644 tests/baselines/reference/symbolType2.errors.txt create mode 100644 tests/baselines/reference/symbolType3.errors.txt create mode 100644 tests/baselines/reference/symbolType6.errors.txt create mode 100644 tests/baselines/reference/symbolType8.errors.txt diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4973dd37450..d513066cc04 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -6856,6 +6856,9 @@ module ts { case SyntaxKind.PlusToken: case SyntaxKind.MinusToken: case SyntaxKind.TildeToken: + if (hasSomeTypeOfKind(operandType, TypeFlags.ESSymbol)) { + error(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_a_value_of_type_symbol, tokenToString(node.operator)); + } return numberType; case SyntaxKind.ExclamationToken: return booleanType; @@ -6891,6 +6894,24 @@ module ts { return numberType; } + // Just like isTypeOfKind below, except that it returns true if *any* constituent + // has this kind. + function hasSomeTypeOfKind(type: Type, kind: TypeFlags): boolean { + if (type.flags & kind) { + return true; + } + if (type.flags & TypeFlags.Union) { + var types = (type).types; + for (var i = 0; i < types.length; i++) { + if (types[i].flags & kind) { + return true; + } + } + return false; + } + return false; + } + // Return true if type has the given flags, or is a union type composed of types that all have those flags. function isTypeOfKind(type: Type, kind: TypeFlags): boolean { if (type.flags & kind) { @@ -6938,7 +6959,7 @@ module ts { // and the right operand to be of type Any, an object type, or a type parameter type. // The result is always of the Boolean primitive type. if (!isTypeOfKind(leftType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) { - error(node.left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number); + error(node.left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } if (!isTypeOfKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { error(node.right, Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); @@ -7106,14 +7127,21 @@ module ts { // If both operands are of the Number primitive type, the result is of the Number primitive type. resultType = numberType; } - else if (isTypeOfKind(leftType, TypeFlags.StringLike) || isTypeOfKind(rightType, TypeFlags.StringLike)) { - // If one or both operands are of the String primitive type, the result is of the String primitive type. - resultType = stringType; - } - else if (leftType.flags & TypeFlags.Any || rightType.flags & TypeFlags.Any) { - // Otherwise, the result is of type Any. - // NOTE: unknown type here denotes error type. Old compiler treated this case as any type so do we. - resultType = anyType; + else { + if (isTypeOfKind(leftType, TypeFlags.StringLike) || isTypeOfKind(rightType, TypeFlags.StringLike)) { + // If one or both operands are of the String primitive type, the result is of the String primitive type. + resultType = stringType; + } + else if (leftType.flags & TypeFlags.Any || rightType.flags & TypeFlags.Any) { + // Otherwise, the result is of type Any. + // NOTE: unknown type here denotes error type. Old compiler treated this case as any type so do we. + resultType = anyType; + } + + // Symbols are not allowed at all in arithmetic expressions + if (resultType && !checkForDisallowedESSymbolOperand(operator)) { + return resultType; + } } if (!resultType) { @@ -7125,14 +7153,18 @@ module ts { checkAssignmentOperator(resultType); } return resultType; - case SyntaxKind.EqualsEqualsToken: - case SyntaxKind.ExclamationEqualsToken: - case SyntaxKind.EqualsEqualsEqualsToken: - case SyntaxKind.ExclamationEqualsEqualsToken: case SyntaxKind.LessThanToken: case SyntaxKind.GreaterThanToken: case SyntaxKind.LessThanEqualsToken: case SyntaxKind.GreaterThanEqualsToken: + if (!checkForDisallowedESSymbolOperand(operator)) { + return booleanType; + } + // Fall through + case SyntaxKind.EqualsEqualsToken: + case SyntaxKind.ExclamationEqualsToken: + case SyntaxKind.EqualsEqualsEqualsToken: + case SyntaxKind.ExclamationEqualsEqualsToken: if (!isTypeAssignableTo(leftType, rightType) && !isTypeAssignableTo(rightType, leftType)) { reportOperatorError(); } @@ -7152,6 +7184,20 @@ module ts { return rightType; } + // Return type is true if there was no error, false if there was an error. + function checkForDisallowedESSymbolOperand(operator: SyntaxKind): boolean { + var offendingSymbolOperand = + hasSomeTypeOfKind(leftType, TypeFlags.ESSymbol) ? node.left : + hasSomeTypeOfKind(rightType, TypeFlags.ESSymbol) ? node.right : + undefined; + if (offendingSymbolOperand) { + error(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_a_value_of_type_symbol, tokenToString(operator)); + return false; + } + + return true; + } + function getSuggestedBooleanOperator(operator: SyntaxKind): SyntaxKind { switch (operator) { case SyntaxKind.BarToken: diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index e16130a0ecd..922044bdaf5 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -205,7 +205,7 @@ module ts { The_operand_of_an_increment_or_decrement_operator_must_be_a_variable_property_or_indexer: { code: 2357, category: DiagnosticCategory.Error, key: "The operand of an increment or decrement operator must be a variable, property or indexer." }, The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2358, category: DiagnosticCategory.Error, key: "The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter." }, The_right_hand_side_of_an_instanceof_expression_must_be_of_type_any_or_of_a_type_assignable_to_the_Function_interface_type: { code: 2359, category: DiagnosticCategory.Error, key: "The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type." }, - The_left_hand_side_of_an_in_expression_must_be_of_types_any_string_or_number: { code: 2360, category: DiagnosticCategory.Error, key: "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'." }, + The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol: { code: 2360, category: DiagnosticCategory.Error, key: "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'." }, The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter: { code: 2361, category: DiagnosticCategory.Error, key: "The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter" }, The_left_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2362, category: DiagnosticCategory.Error, key: "The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, The_right_hand_side_of_an_arithmetic_operation_must_be_of_type_any_number_or_an_enum_type: { code: 2363, category: DiagnosticCategory.Error, key: "The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type." }, @@ -305,6 +305,7 @@ module ts { super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in a computed property name." }, A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." }, Cannot_find_global_value_0: { code: 2468, category: DiagnosticCategory.Error, key: "Cannot find global value '{0}'." }, + The_0_operator_cannot_be_applied_to_a_value_of_type_symbol: { code: 2469, category: DiagnosticCategory.Error, key: "The '{0}' operator cannot be applied to a value of type 'symbol'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 876f3184d15..fb170548614 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -813,7 +813,7 @@ "category": "Error", "code": 2359 }, - "The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'.": { + "The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'.": { "category": "Error", "code": 2360 }, @@ -1213,6 +1213,10 @@ "category": "Error", "code": 2468 }, + "The '{0}' operator cannot be applied to a value of type 'symbol'.": { + "category": "Error", + "code": 2469 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt index 9df5357767f..0985157e0da 100644 --- a/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt +++ b/tests/baselines/reference/inOperatorWithInvalidOperands.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(12,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(13,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(14,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(16,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(17,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(19,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(20,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(12,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(13,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(14,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(16,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(17,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(19,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(20,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(30,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(31,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(32,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter @@ -15,7 +15,7 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(37,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(38,16): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(39,17): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter -tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,11): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,11): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInvalidOperands.ts(43,17): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter @@ -33,27 +33,27 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv var ra1 = a1 in x; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra2 = a2 in x; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra3 = a3 in x; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra4 = a4 in x; var ra5 = null in x; ~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra6 = undefined in x; ~~~~~~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra7 = E.a in x; var ra8 = false in x; ~~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. var ra9 = {} in x; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. // invalid right operands // the right operand is required to be of type Any, an object type, or a type parameter type @@ -98,6 +98,6 @@ tests/cases/conformance/expressions/binaryOperators/inOperator/inOperatorWithInv // both operands are invalid var rc1 = {} in ''; ~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. ~~ !!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty54.errors.txt b/tests/baselines/reference/symbolProperty54.errors.txt new file mode 100644 index 00000000000..b634b4edb0f --- /dev/null +++ b/tests/baselines/reference/symbolProperty54.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/Symbols/symbolProperty54.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty54.ts (1 errors) ==== + var obj = { + [Symbol.prototype]: 0 + ~~~~~~~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + }; \ No newline at end of file diff --git a/tests/baselines/reference/symbolType1.errors.txt b/tests/baselines/reference/symbolType1.errors.txt index db535f57625..00873ccc871 100644 --- a/tests/baselines/reference/symbolType1.errors.txt +++ b/tests/baselines/reference/symbolType1.errors.txt @@ -1,11 +1,16 @@ tests/cases/conformance/es6/Symbols/symbolType1.ts(1,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. tests/cases/conformance/es6/Symbols/symbolType1.ts(2,19): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. +tests/cases/conformance/es6/Symbols/symbolType1.ts(4,19): error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. -==== tests/cases/conformance/es6/Symbols/symbolType1.ts (2 errors) ==== +==== tests/cases/conformance/es6/Symbols/symbolType1.ts (3 errors) ==== Symbol() instanceof Symbol; ~~~~~~~~ !!! error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. Symbol instanceof Symbol(); ~~~~~~~~ +!!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. + (Symbol() || {}) instanceof Object; // This one should be okay, it's a valid way of distinguishing types + Symbol instanceof (Symbol() || {}); + ~~~~~~~~~~~~~~~~ !!! error TS2359: The right-hand side of an 'instanceof' expression must be of type 'any' or of a type assignable to the 'Function' interface type. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType1.js b/tests/baselines/reference/symbolType1.js index a3b00871c4e..90fb5405162 100644 --- a/tests/baselines/reference/symbolType1.js +++ b/tests/baselines/reference/symbolType1.js @@ -1,7 +1,11 @@ //// [symbolType1.ts] Symbol() instanceof Symbol; -Symbol instanceof Symbol(); +Symbol instanceof Symbol(); +(Symbol() || {}) instanceof Object; // This one should be okay, it's a valid way of distinguishing types +Symbol instanceof (Symbol() || {}); //// [symbolType1.js] Symbol() instanceof Symbol; Symbol instanceof Symbol(); +(Symbol() || {}) instanceof Object; // This one should be okay, it's a valid way of distinguishing types +Symbol instanceof (Symbol() || {}); diff --git a/tests/baselines/reference/symbolType11.types b/tests/baselines/reference/symbolType11.types new file mode 100644 index 00000000000..ba3a2fec364 --- /dev/null +++ b/tests/baselines/reference/symbolType11.types @@ -0,0 +1,37 @@ +=== tests/cases/conformance/es6/Symbols/symbolType11.ts === +var s = Symbol.for("logical"); +>s : symbol +>Symbol.for("logical") : symbol +>Symbol.for : (key: string) => symbol +>Symbol : SymbolConstructor +>for : (key: string) => symbol + +s && s; +>s && s : symbol +>s : symbol +>s : symbol + +s && []; +>s && [] : undefined[] +>s : symbol +>[] : undefined[] + +0 && s; +>0 && s : symbol +>s : symbol + +s || s; +>s || s : symbol +>s : symbol +>s : symbol + +s || 1; +>s || 1 : number | symbol +>s : symbol + +({}) || s; +>({}) || s : symbol | {} +>({}) : {} +>{} : {} +>s : symbol + diff --git a/tests/baselines/reference/symbolType12.errors.txt b/tests/baselines/reference/symbolType12.errors.txt new file mode 100644 index 00000000000..85db01ff5d2 --- /dev/null +++ b/tests/baselines/reference/symbolType12.errors.txt @@ -0,0 +1,136 @@ +tests/cases/conformance/es6/Symbols/symbolType12.ts(3,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(3,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(5,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(5,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(6,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(7,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(7,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(8,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(9,1): error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(10,1): error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'number'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(11,1): error TS2469: The '+=' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(12,8): error TS2469: The '+=' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(13,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(13,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(14,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(15,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(15,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(16,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(17,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(17,7): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(18,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(19,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(19,8): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(20,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(21,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(21,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(22,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(23,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(23,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(24,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(25,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(25,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(26,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType12.ts(28,8): error TS2469: The '+=' operator cannot be applied to a value of type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType12.ts (35 errors) ==== + var s = Symbol.for("assign"); + var str = ""; + s *= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s *= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s /= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s /= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s %= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s %= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s += s; + ~~~~~~ +!!! error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'symbol'. + s += 0; + ~~~~~~ +!!! error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'number'. + s += ""; + ~ +!!! error TS2469: The '+=' operator cannot be applied to a value of type 'symbol'. + str += s; + ~ +!!! error TS2469: The '+=' operator cannot be applied to a value of type 'symbol'. + s -= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s -= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s <<= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s <<= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >>= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >>= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >>>= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s >>>= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s &= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s &= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s ^= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s ^= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s |= s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s |= 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + str += (s || str); + ~~~~~~~~~~ +!!! error TS2469: The '+=' operator cannot be applied to a value of type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType12.js b/tests/baselines/reference/symbolType12.js index 05d7fa03eb6..069846e136f 100644 --- a/tests/baselines/reference/symbolType12.js +++ b/tests/baselines/reference/symbolType12.js @@ -24,7 +24,9 @@ s &= 0; s ^= s; s ^= 0; s |= s; -s |= 0; +s |= 0; + +str += (s || str); //// [symbolType12.js] var s = Symbol.for("assign"); @@ -53,3 +55,4 @@ s ^= s; s ^= 0; s |= s; s |= 0; +str += (s || str); diff --git a/tests/baselines/reference/symbolType13.errors.txt b/tests/baselines/reference/symbolType13.errors.txt new file mode 100644 index 00000000000..68981d0072b --- /dev/null +++ b/tests/baselines/reference/symbolType13.errors.txt @@ -0,0 +1,18 @@ +tests/cases/conformance/es6/Symbols/symbolType13.ts(4,6): error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. +tests/cases/conformance/es6/Symbols/symbolType13.ts(5,11): 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/es6/Symbols/symbolType13.ts(6,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/es6/Symbols/symbolType13.ts (3 errors) ==== + var s = Symbol(); + var x: any; + + for (s in {}) { } + ~ +!!! error TS2405: The left-hand side of a 'for...in' statement must be of type 'string' or 'any'. + for (x in s) { } + ~ +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. + for (var y in s) { } + ~ +!!! error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType2.errors.txt b/tests/baselines/reference/symbolType2.errors.txt new file mode 100644 index 00000000000..441db917718 --- /dev/null +++ b/tests/baselines/reference/symbolType2.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/es6/Symbols/symbolType2.ts(2,7): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter + + +==== tests/cases/conformance/es6/Symbols/symbolType2.ts (1 errors) ==== + Symbol.isConcatSpreadable in {}; + "" in Symbol.toPrimitive; + ~~~~~~~~~~~~~~~~~~ +!!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter \ No newline at end of file diff --git a/tests/baselines/reference/symbolType3.errors.txt b/tests/baselines/reference/symbolType3.errors.txt new file mode 100644 index 00000000000..384ccb06c05 --- /dev/null +++ b/tests/baselines/reference/symbolType3.errors.txt @@ -0,0 +1,33 @@ +tests/cases/conformance/es6/Symbols/symbolType3.ts(5,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType3.ts(6,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType3.ts(7,3): error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType3.ts(8,3): error TS2469: The '-' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType3.ts(9,3): error TS2469: The '~' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType3.ts(12,2): error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType3.ts (6 errors) ==== + var s = Symbol(); + delete Symbol.iterator; + void Symbol.toPrimitive; + typeof Symbol.toStringTag; + ++s; + ~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + --s; + ~ +!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + + Symbol(); + ~~~~~~~~ +!!! error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. + - Symbol(); + ~~~~~~~~ +!!! error TS2469: The '-' operator cannot be applied to a value of type 'symbol'. + ~ Symbol(); + ~~~~~~~~ +!!! error TS2469: The '~' operator cannot be applied to a value of type 'symbol'. + ! Symbol(); + + +(Symbol() || 0); + ~~~~~~~~~~~~~~~ +!!! error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType3.js b/tests/baselines/reference/symbolType3.js index 088449a3a89..4f599dacbe0 100644 --- a/tests/baselines/reference/symbolType3.js +++ b/tests/baselines/reference/symbolType3.js @@ -8,7 +8,9 @@ typeof Symbol.toStringTag; + Symbol(); - Symbol(); ~ Symbol(); -! Symbol(); +! Symbol(); + ++(Symbol() || 0); //// [symbolType3.js] var s = Symbol(); @@ -21,3 +23,4 @@ typeof Symbol.toStringTag; -Symbol(); ~Symbol(); !Symbol(); ++(Symbol() || 0); diff --git a/tests/baselines/reference/symbolType6.errors.txt b/tests/baselines/reference/symbolType6.errors.txt new file mode 100644 index 00000000000..9ad7321063f --- /dev/null +++ b/tests/baselines/reference/symbolType6.errors.txt @@ -0,0 +1,57 @@ +tests/cases/conformance/es6/Symbols/symbolType6.ts(3,1): error TS2365: Operator '+' cannot be applied to types 'symbol' and 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType6.ts(4,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType6.ts(5,1): error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(6,1): error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(7,1): error TS2365: Operator '+' cannot be applied to types 'symbol' and 'number'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(8,6): error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(9,5): error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(10,1): error TS2365: Operator '+' cannot be applied to types 'number' and 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(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/es6/Symbols/symbolType6.ts(12,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. +tests/cases/conformance/es6/Symbols/symbolType6.ts(14,1): error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(15,6): error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType6.ts (13 errors) ==== + var s = Symbol.for("add"); + var a: any; + s + s; + ~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types 'symbol' and 'symbol'. + s - s; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + s + ""; + ~ +!!! error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. + s + a; + ~ +!!! error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. + s + 0; + ~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types 'symbol' and 'number'. + "" + s; + ~ +!!! error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. + a + s; + ~ +!!! error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. + 0 + s; + ~~~~~ +!!! error TS2365: Operator '+' cannot be applied to types 'number' and 'symbol'. + s - 0; + ~ +!!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + 0 - s; + ~ +!!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. + + (s || "") + ""; + ~~~~~~~~~ +!!! error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. + "" + (s || ""); + ~~~~~~~~~ +!!! error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType6.js b/tests/baselines/reference/symbolType6.js index ad16baa28b4..b316f48cf03 100644 --- a/tests/baselines/reference/symbolType6.js +++ b/tests/baselines/reference/symbolType6.js @@ -1,21 +1,32 @@ //// [symbolType6.ts] var s = Symbol.for("add"); +var a: any; s + s; s - s; s + ""; +s + a; s + 0; "" + s; +a + s; 0 + s; s - 0; -0 - s; +0 - s; + +(s || "") + ""; +"" + (s || ""); //// [symbolType6.js] var s = Symbol.for("add"); +var a; s + s; s - s; s + ""; +s + a; s + 0; "" + s; +a + s; 0 + s; s - 0; 0 - s; +(s || "") + ""; +"" + (s || ""); diff --git a/tests/baselines/reference/symbolType8.errors.txt b/tests/baselines/reference/symbolType8.errors.txt new file mode 100644 index 00000000000..e72d0d619e4 --- /dev/null +++ b/tests/baselines/reference/symbolType8.errors.txt @@ -0,0 +1,45 @@ +tests/cases/conformance/es6/Symbols/symbolType8.ts(2,1): error TS2469: The '<' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(3,1): error TS2469: The '<' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(4,1): error TS2469: The '>' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(5,1): error TS2469: The '>' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(6,1): error TS2469: The '<=' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(7,1): error TS2469: The '<=' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(8,1): error TS2469: The '>=' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(9,1): error TS2469: The '>=' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(11,6): error TS2469: The '>=' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(12,1): error TS2469: The '>=' operator cannot be applied to a value of type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType8.ts (10 errors) ==== + var s = Symbol.for("compare"); + s < s; + ~ +!!! error TS2469: The '<' operator cannot be applied to a value of type 'symbol'. + s < 0; + ~ +!!! error TS2469: The '<' operator cannot be applied to a value of type 'symbol'. + s > s; + ~ +!!! error TS2469: The '>' operator cannot be applied to a value of type 'symbol'. + s > 0; + ~ +!!! error TS2469: The '>' operator cannot be applied to a value of type 'symbol'. + s <= s; + ~ +!!! error TS2469: The '<=' operator cannot be applied to a value of type 'symbol'. + s <= 0; + ~ +!!! error TS2469: The '<=' operator cannot be applied to a value of type 'symbol'. + s >= s; + ~ +!!! error TS2469: The '>=' operator cannot be applied to a value of type 'symbol'. + s >= 0; + ~ +!!! error TS2469: The '>=' operator cannot be applied to a value of type 'symbol'. + + 0 >= (s || 0); + ~~~~~~~~ +!!! error TS2469: The '>=' operator cannot be applied to a value of type 'symbol'. + (s || 0) >= s; + ~~~~~~~~ +!!! error TS2469: The '>=' operator cannot be applied to a value of type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType8.js b/tests/baselines/reference/symbolType8.js index e80dea220b9..7e56416ca84 100644 --- a/tests/baselines/reference/symbolType8.js +++ b/tests/baselines/reference/symbolType8.js @@ -7,7 +7,10 @@ s > 0; s <= s; s <= 0; s >= s; -s >= 0; +s >= 0; + +0 >= (s || 0); +(s || 0) >= s; //// [symbolType8.js] var s = Symbol.for("compare"); @@ -19,3 +22,5 @@ s <= s; s <= 0; s >= s; s >= 0; +0 >= (s || 0); +(s || 0) >= s; diff --git a/tests/baselines/reference/widenedTypes.errors.txt b/tests/baselines/reference/widenedTypes.errors.txt index 7374bd23b77..2277ef6eea7 100644 --- a/tests/baselines/reference/widenedTypes.errors.txt +++ b/tests/baselines/reference/widenedTypes.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/widenedTypes.ts(2,1): error TS2358: The left-hand side of an 'instanceof' expression must be of type 'any', an object type or a type parameter. -tests/cases/compiler/widenedTypes.ts(5,1): error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +tests/cases/compiler/widenedTypes.ts(5,1): error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. tests/cases/compiler/widenedTypes.ts(6,7): error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter tests/cases/compiler/widenedTypes.ts(8,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/compiler/widenedTypes.ts(11,1): error TS2322: Type 'string' is not assignable to type 'number'. @@ -20,7 +20,7 @@ tests/cases/compiler/widenedTypes.ts(24,5): error TS2322: Type '{ [x: string]: n null in {}; ~~~~ -!!! error TS2360: The left-hand side of an 'in' expression must be of types 'any', 'string' or 'number'. +!!! error TS2360: The left-hand side of an 'in' expression must be of type 'any', 'string', 'number', or 'symbol'. "" in null; ~~~~ !!! error TS2361: The right-hand side of an 'in' expression must be of type 'any', an object type or a type parameter diff --git a/tests/cases/conformance/es6/Symbols/symbolType1.ts b/tests/cases/conformance/es6/Symbols/symbolType1.ts index 3945ecc76e8..3a7339fbeb7 100644 --- a/tests/cases/conformance/es6/Symbols/symbolType1.ts +++ b/tests/cases/conformance/es6/Symbols/symbolType1.ts @@ -1,3 +1,5 @@ //@target: ES6 Symbol() instanceof Symbol; -Symbol instanceof Symbol(); \ No newline at end of file +Symbol instanceof Symbol(); +(Symbol() || {}) instanceof Object; // This one should be okay, it's a valid way of distinguishing types +Symbol instanceof (Symbol() || {}); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType12.ts b/tests/cases/conformance/es6/Symbols/symbolType12.ts index 7197c13497d..44852bc10e6 100644 --- a/tests/cases/conformance/es6/Symbols/symbolType12.ts +++ b/tests/cases/conformance/es6/Symbols/symbolType12.ts @@ -24,4 +24,6 @@ s &= 0; s ^= s; s ^= 0; s |= s; -s |= 0; \ No newline at end of file +s |= 0; + +str += (s || str); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType3.ts b/tests/cases/conformance/es6/Symbols/symbolType3.ts index ca098fe0695..b5855ecab41 100644 --- a/tests/cases/conformance/es6/Symbols/symbolType3.ts +++ b/tests/cases/conformance/es6/Symbols/symbolType3.ts @@ -8,4 +8,6 @@ typeof Symbol.toStringTag; + Symbol(); - Symbol(); ~ Symbol(); -! Symbol(); \ No newline at end of file +! Symbol(); + ++(Symbol() || 0); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType6.ts b/tests/cases/conformance/es6/Symbols/symbolType6.ts index b6f58ac5b29..2efa682b98f 100644 --- a/tests/cases/conformance/es6/Symbols/symbolType6.ts +++ b/tests/cases/conformance/es6/Symbols/symbolType6.ts @@ -1,10 +1,16 @@ //@target: ES6 var s = Symbol.for("add"); +var a: any; s + s; s - s; s + ""; +s + a; s + 0; "" + s; +a + s; 0 + s; s - 0; -0 - s; \ No newline at end of file +0 - s; + +(s || "") + ""; +"" + (s || ""); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType8.ts b/tests/cases/conformance/es6/Symbols/symbolType8.ts index 4970ae0a9ca..b3bc68094c7 100644 --- a/tests/cases/conformance/es6/Symbols/symbolType8.ts +++ b/tests/cases/conformance/es6/Symbols/symbolType8.ts @@ -7,4 +7,7 @@ s > 0; s <= s; s <= 0; s >= s; -s >= 0; \ No newline at end of file +s >= 0; + +0 >= (s || 0); +(s || 0) >= s; \ No newline at end of file From 6a6c03b9b79bbd158eab7acc01a740de6b1b5df2 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 4 Feb 2015 19:32:13 -0800 Subject: [PATCH 028/162] Fix error message wording --- src/compiler/checker.ts | 2 +- src/compiler/diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- .../reference/baseTypePrivateMemberClash.errors.txt | 4 ++-- .../callSignaturesThatDifferOnlyByReturnType2.errors.txt | 4 ++-- .../reference/conflictingMemberTypesInBases.errors.txt | 4 ++-- .../genericAndNonGenericInheritedSignature1.errors.txt | 4 ++-- .../genericAndNonGenericInheritedSignature2.errors.txt | 4 ++-- ...meNamePrivatePropertiesFromDifferentOrigins.errors.txt | 4 ++-- ...tSameNamePropertiesWithDifferentOptionality.errors.txt | 4 ++-- ...itSameNamePropertiesWithDifferentVisibility.errors.txt | 4 ++-- .../baselines/reference/interfaceDeclaration1.errors.txt | 4 ++-- .../interfaceExtendingClassWithPrivates2.errors.txt | 4 ++-- .../interfaceExtendingClassWithProtecteds2.errors.txt | 4 ++-- .../reference/interfaceImplementation7.errors.txt | 4 ++-- .../reference/interfacePropertiesWithSameName2.errors.txt | 8 ++++---- .../reference/interfacePropertiesWithSameName3.errors.txt | 8 ++++---- .../reference/interfaceWithMultipleBaseTypes.errors.txt | 4 ++-- .../mergedInterfacesWithInheritedPrivates3.errors.txt | 8 ++++---- .../mergedInterfacesWithMultipleBases4.errors.txt | 4 ++-- ...ipleBaseInterfaesWithIncompatibleProperties.errors.txt | 4 ++-- 21 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d513066cc04..af36448cbfe 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8999,7 +8999,7 @@ module ts { var typeName1 = typeToString(existing.containingType); var typeName2 = typeToString(base); - var errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Named_properties_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2); + var errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2); errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); diagnostics.add(createDiagnosticForNodeFromMessageChain(typeNode, errorInfo)); } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 922044bdaf5..34f9c50eaad 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -167,7 +167,7 @@ module ts { Global_type_0_must_be_a_class_or_interface_type: { code: 2316, category: DiagnosticCategory.Error, key: "Global type '{0}' must be a class or interface type." }, Global_type_0_must_have_1_type_parameter_s: { code: 2317, category: DiagnosticCategory.Error, key: "Global type '{0}' must have {1} type parameter(s)." }, Cannot_find_global_type_0: { code: 2318, category: DiagnosticCategory.Error, key: "Cannot find global type '{0}'." }, - Named_properties_0_of_types_1_and_2_are_not_identical: { code: 2319, category: DiagnosticCategory.Error, key: "Named properties '{0}' of types '{1}' and '{2}' are not identical." }, + Named_property_0_of_types_1_and_2_are_not_identical: { code: 2319, category: DiagnosticCategory.Error, key: "Named property '{0}' of types '{1}' and '{2}' are not identical." }, Interface_0_cannot_simultaneously_extend_types_1_and_2: { code: 2320, category: DiagnosticCategory.Error, key: "Interface '{0}' cannot simultaneously extend types '{1}' and '{2}'." }, Excessive_stack_depth_comparing_types_0_and_1: { code: 2321, category: DiagnosticCategory.Error, key: "Excessive stack depth comparing types '{0}' and '{1}'." }, Type_0_is_not_assignable_to_type_1: { code: 2322, category: DiagnosticCategory.Error, key: "Type '{0}' is not assignable to type '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index fb170548614..1fd7cb7356b 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -661,7 +661,7 @@ "category": "Error", "code": 2318 }, - "Named properties '{0}' of types '{1}' and '{2}' are not identical.": { + "Named property '{0}' of types '{1}' and '{2}' are not identical.": { "category": "Error", "code": 2319 }, diff --git a/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt b/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt index eca303ff72c..28e66844696 100644 --- a/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt +++ b/tests/baselines/reference/baseTypePrivateMemberClash.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/baseTypePrivateMemberClash.ts(8,11): error TS2320: Interface 'Z' cannot simultaneously extend types 'X' and 'Y'. - Named properties 'm' of types 'X' and 'Y' are not identical. + Named property 'm' of types 'X' and 'Y' are not identical. ==== tests/cases/compiler/baseTypePrivateMemberClash.ts (1 errors) ==== @@ -13,4 +13,4 @@ tests/cases/compiler/baseTypePrivateMemberClash.ts(8,11): error TS2320: Interfac interface Z extends X, Y { } ~ !!! error TS2320: Interface 'Z' cannot simultaneously extend types 'X' and 'Y'. -!!! error TS2320: Named properties 'm' of types 'X' and 'Y' are not identical. \ No newline at end of file +!!! error TS2320: Named property 'm' of types 'X' and 'Y' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt index 5fabfd0b7ad..4ff65843eba 100644 --- a/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt +++ b/tests/baselines/reference/callSignaturesThatDifferOnlyByReturnType2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(8,11): error TS2320: Interface 'A' cannot simultaneously extend types 'I' and 'I'. - Named properties 'foo' of types 'I' and 'I' are not identical. + Named property 'foo' of types 'I' and 'I' are not identical. tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesThatDifferOnlyByReturnType2.ts(13,16): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'. @@ -14,7 +14,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesTha interface A extends I, I { } ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'I' and 'I'. -!!! error TS2320: Named properties 'foo' of types 'I' and 'I' are not identical. +!!! error TS2320: Named property 'foo' of types 'I' and 'I' are not identical. var x: A; // BUG 822524 diff --git a/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt b/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt index 58fdcb4c7ae..07e7a64ec1f 100644 --- a/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt +++ b/tests/baselines/reference/conflictingMemberTypesInBases.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/conflictingMemberTypesInBases.ts(12,11): error TS2320: Interface 'E' cannot simultaneously extend types 'B' and 'D'. - Named properties 'm' of types 'B' and 'D' are not identical. + Named property 'm' of types 'B' and 'D' are not identical. ==== tests/cases/compiler/conflictingMemberTypesInBases.ts (1 errors) ==== @@ -17,6 +17,6 @@ tests/cases/compiler/conflictingMemberTypesInBases.ts(12,11): error TS2320: Inte interface E extends B { } // Error here for extending B and D ~ !!! error TS2320: Interface 'E' cannot simultaneously extend types 'B' and 'D'. -!!! error TS2320: Named properties 'm' of types 'B' and 'D' are not identical. +!!! error TS2320: Named property 'm' of types 'B' and 'D' are not identical. interface E extends D { } // No duplicate error here \ No newline at end of file diff --git a/tests/baselines/reference/genericAndNonGenericInheritedSignature1.errors.txt b/tests/baselines/reference/genericAndNonGenericInheritedSignature1.errors.txt index 63ff9d9313e..7180dc7c25b 100644 --- a/tests/baselines/reference/genericAndNonGenericInheritedSignature1.errors.txt +++ b/tests/baselines/reference/genericAndNonGenericInheritedSignature1.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts(7,11): error TS2320: Interface 'Hello' cannot simultaneously extend types 'Foo' and 'Bar'. - Named properties 'f' of types 'Foo' and 'Bar' are not identical. + Named property 'f' of types 'Foo' and 'Bar' are not identical. ==== tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts (1 errors) ==== @@ -12,6 +12,6 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature1.ts(7,11): error TS2 interface Hello extends Foo, Bar { ~~~~~ !!! error TS2320: Interface 'Hello' cannot simultaneously extend types 'Foo' and 'Bar'. -!!! error TS2320: Named properties 'f' of types 'Foo' and 'Bar' are not identical. +!!! error TS2320: Named property 'f' of types 'Foo' and 'Bar' are not identical. } \ No newline at end of file diff --git a/tests/baselines/reference/genericAndNonGenericInheritedSignature2.errors.txt b/tests/baselines/reference/genericAndNonGenericInheritedSignature2.errors.txt index 05fdd68319e..158fd447923 100644 --- a/tests/baselines/reference/genericAndNonGenericInheritedSignature2.errors.txt +++ b/tests/baselines/reference/genericAndNonGenericInheritedSignature2.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts(7,11): error TS2320: Interface 'Hello' cannot simultaneously extend types 'Bar' and 'Foo'. - Named properties 'f' of types 'Bar' and 'Foo' are not identical. + Named property 'f' of types 'Bar' and 'Foo' are not identical. ==== tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts (1 errors) ==== @@ -12,6 +12,6 @@ tests/cases/compiler/genericAndNonGenericInheritedSignature2.ts(7,11): error TS2 interface Hello extends Bar, Foo { ~~~~~ !!! error TS2320: Interface 'Hello' cannot simultaneously extend types 'Bar' and 'Foo'. -!!! error TS2320: Named properties 'f' of types 'Bar' and 'Foo' are not identical. +!!! error TS2320: Named property 'f' of types 'Bar' and 'Foo' are not identical. } \ No newline at end of file diff --git a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt index 555349cc251..e8c47e95fe9 100644 --- a/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt +++ b/tests/baselines/reference/inheritSameNamePrivatePropertiesFromDifferentOrigins.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. ==== tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts (1 errors) ==== @@ -14,6 +14,6 @@ tests/cases/compiler/inheritSameNamePrivatePropertiesFromDifferentOrigins.ts(9,1 interface A extends C, C2 { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } \ No newline at end of file diff --git a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt index 3f9c4a3bae0..f6debbde7ec 100644 --- a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt +++ b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentOptionality.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. ==== tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts (1 errors) ==== @@ -14,6 +14,6 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentOptionality.ts(9,11): interface A extends C, C2 { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } \ No newline at end of file diff --git a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt index 9864b4a4792..1865e9f6b78 100644 --- a/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt +++ b/tests/baselines/reference/inheritSameNamePropertiesWithDifferentVisibility.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. ==== tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts (1 errors) ==== @@ -14,6 +14,6 @@ tests/cases/compiler/inheritSameNamePropertiesWithDifferentVisibility.ts(9,11): interface A extends C, C2 { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } \ No newline at end of file diff --git a/tests/baselines/reference/interfaceDeclaration1.errors.txt b/tests/baselines/reference/interfaceDeclaration1.errors.txt index 1e8cc0c1e68..b73cfef75df 100644 --- a/tests/baselines/reference/interfaceDeclaration1.errors.txt +++ b/tests/baselines/reference/interfaceDeclaration1.errors.txt @@ -7,7 +7,7 @@ tests/cases/compiler/interfaceDeclaration1.ts(35,7): error TS2420: Class 'C1' in Property 'prototype' is missing in type 'C1'. tests/cases/compiler/interfaceDeclaration1.ts(41,11): error TS2310: Type 'i8' recursively references itself as a base type. tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i12' cannot simultaneously extend types 'i10' and 'i11'. - Named properties 'foo' of types 'i10' and 'i11' are not identical. + Named property 'foo' of types 'i10' and 'i11' are not identical. ==== tests/cases/compiler/interfaceDeclaration1.ts (8 errors) ==== @@ -80,5 +80,5 @@ tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i interface i12 extends i10, i11 { } ~~~ !!! error TS2320: Interface 'i12' cannot simultaneously extend types 'i10' and 'i11'. -!!! error TS2320: Named properties 'foo' of types 'i10' and 'i11' are not identical. +!!! error TS2320: Named property 'foo' of types 'i10' and 'i11' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt index c9be8471e8c..7850c10fe26 100644 --- a/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClassWithPrivates2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(9,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'. - Named properties 'x' of types 'Foo' and 'Bar' are not identical. + Named property 'x' of types 'Foo' and 'Bar' are not identical. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Bar'. Property 'x' is private in type 'Bar' but not in type 'I4'. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithPrivates2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Foo'. @@ -20,7 +20,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending interface I3 extends Foo, Bar { // error ~~ !!! error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'. -!!! error TS2320: Named properties 'x' of types 'Foo' and 'Bar' are not identical. +!!! error TS2320: Named property 'x' of types 'Foo' and 'Bar' are not identical. } interface I4 extends Foo, Bar { // error diff --git a/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt b/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt index a63dfd6efca..48e3b7d7e6c 100644 --- a/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt +++ b/tests/baselines/reference/interfaceExtendingClassWithProtecteds2.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(9,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'. - Named properties 'x' of types 'Foo' and 'Bar' are not identical. + Named property 'x' of types 'Foo' and 'Bar' are not identical. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Bar'. Property 'x' is protected but type 'I4' is not a class derived from 'Bar'. tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtendingClassWithProtecteds2.ts(12,11): error TS2430: Interface 'I4' incorrectly extends interface 'Foo'. @@ -20,7 +20,7 @@ tests/cases/conformance/interfaces/interfacesExtendingClasses/interfaceExtending interface I3 extends Foo, Bar { // error ~~ !!! error TS2320: Interface 'I3' cannot simultaneously extend types 'Foo' and 'Bar'. -!!! error TS2320: Named properties 'x' of types 'Foo' and 'Bar' are not identical. +!!! error TS2320: Named property 'x' of types 'Foo' and 'Bar' are not identical. } interface I4 extends Foo, Bar { // error diff --git a/tests/baselines/reference/interfaceImplementation7.errors.txt b/tests/baselines/reference/interfaceImplementation7.errors.txt index ff1118e5c69..b297015dfbe 100644 --- a/tests/baselines/reference/interfaceImplementation7.errors.txt +++ b/tests/baselines/reference/interfaceImplementation7.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/interfaceImplementation7.ts(4,11): error TS2320: Interface 'i3' cannot simultaneously extend types 'i1' and 'i2'. - Named properties 'name' of types 'i1' and 'i2' are not identical. + Named property 'name' of types 'i1' and 'i2' are not identical. tests/cases/compiler/interfaceImplementation7.ts(7,7): error TS2420: Class 'C1' incorrectly implements interface 'i4'. Types of property 'name' are incompatible. Type '() => string' is not assignable to type '() => { s: string; n: number; }'. @@ -14,7 +14,7 @@ tests/cases/compiler/interfaceImplementation7.ts(7,7): error TS2420: Class 'C1' interface i3 extends i1, i2 { } ~~ !!! error TS2320: Interface 'i3' cannot simultaneously extend types 'i1' and 'i2'. -!!! error TS2320: Named properties 'name' of types 'i1' and 'i2' are not identical. +!!! error TS2320: Named property 'name' of types 'i1' and 'i2' are not identical. interface i4 extends i1, i2 { name(): { s: string; n: number; }; } class C1 implements i4 { diff --git a/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt b/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt index a7df9c15e59..82301d9ae16 100644 --- a/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt +++ b/tests/baselines/reference/interfacePropertiesWithSameName2.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/interfacePropertiesWithSameName2.ts(10,11): error TS2320: Interface 'MoverShaker' cannot simultaneously extend types 'Mover' and 'Shaker'. - Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. + Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical. tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: Interface 'MoverShaker2' cannot simultaneously extend types 'Mover' and 'Shaker'. - Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. + Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical. ==== tests/cases/compiler/interfacePropertiesWithSameName2.ts (2 errors) ==== @@ -17,7 +17,7 @@ tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: I interface MoverShaker extends Mover, Shaker { ~~~~~~~~~~~ !!! error TS2320: Interface 'MoverShaker' cannot simultaneously extend types 'Mover' and 'Shaker'. -!!! error TS2320: Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. +!!! error TS2320: Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical. } @@ -36,7 +36,7 @@ tests/cases/compiler/interfacePropertiesWithSameName2.ts(26,11): error TS2320: I interface MoverShaker2 extends MoversAndShakers.Mover, MoversAndShakers.Shaker { } // error ~~~~~~~~~~~~ !!! error TS2320: Interface 'MoverShaker2' cannot simultaneously extend types 'Mover' and 'Shaker'. -!!! error TS2320: Named properties 'getStatus' of types 'Mover' and 'Shaker' are not identical. +!!! error TS2320: Named property 'getStatus' of types 'Mover' and 'Shaker' are not identical. interface MoverShaker3 extends MoversAndShakers.Mover, MoversAndShakers.Shaker { getStatus(): { speed: number; frequency: number; }; // ok because this getStatus overrides the conflicting ones above diff --git a/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt b/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt index b7dfdffc79e..cc333e0e054 100644 --- a/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt +++ b/tests/baselines/reference/interfacePropertiesWithSameName3.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/interfacePropertiesWithSameName3.ts(3,11): error TS2320: Interface 'F' cannot simultaneously extend types 'E' and 'D'. - Named properties 'a' of types 'E' and 'D' are not identical. + Named property 'a' of types 'E' and 'D' are not identical. tests/cases/compiler/interfacePropertiesWithSameName3.ts(7,11): error TS2320: Interface 'F2' cannot simultaneously extend types 'E2' and 'D2'. - Named properties 'a' of types 'E2' and 'D2' are not identical. + Named property 'a' of types 'E2' and 'D2' are not identical. ==== tests/cases/compiler/interfacePropertiesWithSameName3.ts (2 errors) ==== @@ -10,12 +10,12 @@ tests/cases/compiler/interfacePropertiesWithSameName3.ts(7,11): error TS2320: In interface F extends E, D { } // error ~ !!! error TS2320: Interface 'F' cannot simultaneously extend types 'E' and 'D'. -!!! error TS2320: Named properties 'a' of types 'E' and 'D' are not identical. +!!! error TS2320: Named property 'a' of types 'E' and 'D' are not identical. class D2 { a: number; } class E2 { a: string; } interface F2 extends E2, D2 { } // error ~~ !!! error TS2320: Interface 'F2' cannot simultaneously extend types 'E2' and 'D2'. -!!! error TS2320: Named properties 'a' of types 'E2' and 'D2' are not identical. +!!! error TS2320: Named property 'a' of types 'E2' and 'D2' are not identical. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt b/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt index 1562e16df4d..95adbbf6717 100644 --- a/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt +++ b/tests/baselines/reference/interfaceWithMultipleBaseTypes.errors.txt @@ -4,7 +4,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBa Types of property 'b' are incompatible. Type 'number' is not assignable to type 'string'. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(52,15): error TS2320: Interface 'Derived3' cannot simultaneously extend types 'Base1' and 'Base2'. - Named properties 'x' of types 'Base1' and 'Base2' are not identical. + Named property 'x' of types 'Base1' and 'Base2' are not identical. tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBaseTypes.ts(54,15): error TS2430: Interface 'Derived4' incorrectly extends interface 'Base1'. Types of property 'x' are incompatible. Type '{ a: T; b: T; }' is not assignable to type '{ a: number; }'. @@ -86,7 +86,7 @@ tests/cases/conformance/interfaces/interfaceDeclarations/interfaceWithMultipleBa interface Derived3 extends Base1, Base2 { } // error ~~~~~~~~ !!! error TS2320: Interface 'Derived3' cannot simultaneously extend types 'Base1' and 'Base2'. -!!! error TS2320: Named properties 'x' of types 'Base1' and 'Base2' are not identical. +!!! error TS2320: Named property 'x' of types 'Base1' and 'Base2' are not identical. interface Derived4 extends Base1, Base2 { // error ~~~~~~~~ diff --git a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt index 4c49e6beb0c..584edc24bb5 100644 --- a/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithInheritedPrivates3.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates3.ts(9,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates3.ts(31,15): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. - Named properties 'x' of types 'C' and 'C2' are not identical. + Named property 'x' of types 'C' and 'C2' are not identical. ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheritedPrivates3.ts (2 errors) ==== @@ -16,7 +16,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri interface A extends C { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } @@ -41,7 +41,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithInheri interface A extends C { // error, privates conflict ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C2'. -!!! error TS2320: Named properties 'x' of types 'C' and 'C2' are not identical. +!!! error TS2320: Named property 'x' of types 'C' and 'C2' are not identical. y: string; } diff --git a/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt b/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt index 1e11dc792f1..f7ea6fbc2a0 100644 --- a/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithMultipleBases4.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases4.ts(19,11): error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C'. - Named properties 'a' of types 'C' and 'C' are not identical. + Named property 'a' of types 'C' and 'C' are not identical. ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultipleBases4.ts (1 errors) ==== @@ -24,7 +24,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithMultip interface A extends C, C3 { // error ~ !!! error TS2320: Interface 'A' cannot simultaneously extend types 'C' and 'C'. -!!! error TS2320: Named properties 'a' of types 'C' and 'C' are not identical. +!!! error TS2320: Named property 'a' of types 'C' and 'C' are not identical. y: T; } diff --git a/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt index 633f544a67b..70db70de97b 100644 --- a/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt +++ b/tests/baselines/reference/multipleBaseInterfaesWithIncompatibleProperties.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties.ts(6,11): error TS2320: Interface 'C' cannot simultaneously extend types 'A' and 'A'. - Named properties 'x' of types 'A' and 'A' are not identical. + Named property 'x' of types 'A' and 'A' are not identical. ==== tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties.ts (1 errors) ==== @@ -11,5 +11,5 @@ tests/cases/compiler/multipleBaseInterfaesWithIncompatibleProperties.ts(6,11): e interface C extends A, A { } ~ !!! error TS2320: Interface 'C' cannot simultaneously extend types 'A' and 'A'. -!!! error TS2320: Named properties 'x' of types 'A' and 'A' are not identical. +!!! error TS2320: Named property 'x' of types 'A' and 'A' are not identical. \ No newline at end of file From 92617f5978a9ef2da4b39f578e6b1d376108b593 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 4 Feb 2015 19:43:36 -0800 Subject: [PATCH 029/162] Don't pass prop.name directly for error reporting --- src/compiler/checker.ts | 2 +- .../reference/symbolProperty35.errors.txt | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/symbolProperty35.errors.txt diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index af36448cbfe..2e900f3b6ce 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8999,7 +8999,7 @@ module ts { var typeName1 = typeToString(existing.containingType); var typeName2 = typeToString(base); - var errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, prop.name, typeName1, typeName2); + var errorInfo = chainDiagnosticMessages(undefined, Diagnostics.Named_property_0_of_types_1_and_2_are_not_identical, symbolToString(prop), typeName1, typeName2); errorInfo = chainDiagnosticMessages(errorInfo, Diagnostics.Interface_0_cannot_simultaneously_extend_types_1_and_2, typeToString(type), typeName1, typeName2); diagnostics.add(createDiagnosticForNodeFromMessageChain(typeNode, errorInfo)); } diff --git a/tests/baselines/reference/symbolProperty35.errors.txt b/tests/baselines/reference/symbolProperty35.errors.txt new file mode 100644 index 00000000000..1558f5a3409 --- /dev/null +++ b/tests/baselines/reference/symbolProperty35.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/es6/Symbols/symbolProperty35.ts(8,11): error TS2320: Interface 'I3' cannot simultaneously extend types 'I1' and 'I2'. + Named property '[Symbol.toStringTag]' of types 'I1' and 'I2' are not identical. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty35.ts (1 errors) ==== + interface I1 { + [Symbol.toStringTag](): { x: string } + } + interface I2 { + [Symbol.toStringTag](): { x: number } + } + + interface I3 extends I1, I2 { } + ~~ +!!! error TS2320: Interface 'I3' cannot simultaneously extend types 'I1' and 'I2'. +!!! error TS2320: Named property '[Symbol.toStringTag]' of types 'I1' and 'I2' are not identical. \ No newline at end of file From fbeadbcbd3dfa42f970f66386375e0f21549c670 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 5 Feb 2015 12:19:58 -0800 Subject: [PATCH 030/162] Add test for new Symbol() --- tests/baselines/reference/symbolType14.errors.txt | 7 +++++++ tests/baselines/reference/symbolType14.js | 5 +++++ tests/cases/conformance/es6/Symbols/symbolType14.ts | 2 ++ 3 files changed, 14 insertions(+) create mode 100644 tests/baselines/reference/symbolType14.errors.txt create mode 100644 tests/baselines/reference/symbolType14.js create mode 100644 tests/cases/conformance/es6/Symbols/symbolType14.ts diff --git a/tests/baselines/reference/symbolType14.errors.txt b/tests/baselines/reference/symbolType14.errors.txt new file mode 100644 index 00000000000..a31230efe23 --- /dev/null +++ b/tests/baselines/reference/symbolType14.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/Symbols/symbolType14.ts(1,1): error TS2350: Only a void function can be called with the 'new' keyword. + + +==== tests/cases/conformance/es6/Symbols/symbolType14.ts (1 errors) ==== + new Symbol(); + ~~~~~~~~~~~~ +!!! error TS2350: Only a void function can be called with the 'new' keyword. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType14.js b/tests/baselines/reference/symbolType14.js new file mode 100644 index 00000000000..4bbd24f30d9 --- /dev/null +++ b/tests/baselines/reference/symbolType14.js @@ -0,0 +1,5 @@ +//// [symbolType14.ts] +new Symbol(); + +//// [symbolType14.js] +new Symbol(); diff --git a/tests/cases/conformance/es6/Symbols/symbolType14.ts b/tests/cases/conformance/es6/Symbols/symbolType14.ts new file mode 100644 index 00000000000..c20a8be874b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType14.ts @@ -0,0 +1,2 @@ +//@target: ES6 +new Symbol(); \ No newline at end of file From 9f39a5388ab6cd4a3393938fef16fb7219182b20 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 5 Feb 2015 12:21:25 -0800 Subject: [PATCH 031/162] Make Symbol the apparent type of symbol --- src/compiler/checker.ts | 3 +++ tests/baselines/reference/symbolType11.types | 2 +- .../baselines/reference/symbolType15.errors.txt | 11 +++++++++++ tests/baselines/reference/symbolType15.js | 12 ++++++++++++ tests/baselines/reference/symbolType16.js | 11 +++++++++++ tests/baselines/reference/symbolType16.types | 16 ++++++++++++++++ .../conformance/es6/Symbols/symbolType15.ts | 6 ++++++ .../conformance/es6/Symbols/symbolType16.ts | 7 +++++++ 8 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/symbolType15.errors.txt create mode 100644 tests/baselines/reference/symbolType15.js create mode 100644 tests/baselines/reference/symbolType16.js create mode 100644 tests/baselines/reference/symbolType16.types create mode 100644 tests/cases/conformance/es6/Symbols/symbolType15.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolType16.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 2e900f3b6ce..b40acf0ea06 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2524,6 +2524,9 @@ module ts { else if (type.flags & TypeFlags.Boolean) { type = globalBooleanType; } + else if (type.flags & TypeFlags.ESSymbol) { + type = globalESSymbolType; + } return type; } diff --git a/tests/baselines/reference/symbolType11.types b/tests/baselines/reference/symbolType11.types index ba3a2fec364..21de110854c 100644 --- a/tests/baselines/reference/symbolType11.types +++ b/tests/baselines/reference/symbolType11.types @@ -30,7 +30,7 @@ s || 1; >s : symbol ({}) || s; ->({}) || s : symbol | {} +>({}) || s : {} >({}) : {} >{} : {} >s : symbol diff --git a/tests/baselines/reference/symbolType15.errors.txt b/tests/baselines/reference/symbolType15.errors.txt new file mode 100644 index 00000000000..eb63e5798d5 --- /dev/null +++ b/tests/baselines/reference/symbolType15.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/es6/Symbols/symbolType15.ts(5,1): error TS2322: Type 'Symbol' is not assignable to type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolType15.ts (1 errors) ==== + var sym: symbol; + var symObj: Symbol; + + symObj = sym; + sym = symObj; + ~~~ +!!! error TS2322: Type 'Symbol' is not assignable to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType15.js b/tests/baselines/reference/symbolType15.js new file mode 100644 index 00000000000..1c3519d603e --- /dev/null +++ b/tests/baselines/reference/symbolType15.js @@ -0,0 +1,12 @@ +//// [symbolType15.ts] +var sym: symbol; +var symObj: Symbol; + +symObj = sym; +sym = symObj; + +//// [symbolType15.js] +var sym; +var symObj; +symObj = sym; +sym = symObj; diff --git a/tests/baselines/reference/symbolType16.js b/tests/baselines/reference/symbolType16.js new file mode 100644 index 00000000000..65a95dd8365 --- /dev/null +++ b/tests/baselines/reference/symbolType16.js @@ -0,0 +1,11 @@ +//// [symbolType16.ts] +interface Symbol { + newSymbolProp: number; +} + +var sym: symbol; +sym.newSymbolProp; + +//// [symbolType16.js] +var sym; +sym.newSymbolProp; diff --git a/tests/baselines/reference/symbolType16.types b/tests/baselines/reference/symbolType16.types new file mode 100644 index 00000000000..91fdc9978da --- /dev/null +++ b/tests/baselines/reference/symbolType16.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/Symbols/symbolType16.ts === +interface Symbol { +>Symbol : Symbol + + newSymbolProp: number; +>newSymbolProp : number +} + +var sym: symbol; +>sym : symbol + +sym.newSymbolProp; +>sym.newSymbolProp : number +>sym : symbol +>newSymbolProp : number + diff --git a/tests/cases/conformance/es6/Symbols/symbolType15.ts b/tests/cases/conformance/es6/Symbols/symbolType15.ts new file mode 100644 index 00000000000..22f1f9662c0 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType15.ts @@ -0,0 +1,6 @@ +//@target: ES6 +var sym: symbol; +var symObj: Symbol; + +symObj = sym; +sym = symObj; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType16.ts b/tests/cases/conformance/es6/Symbols/symbolType16.ts new file mode 100644 index 00000000000..0421e0ccc02 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType16.ts @@ -0,0 +1,7 @@ +//@target: ES6 +interface Symbol { + newSymbolProp: number; +} + +var sym: symbol; +sym.newSymbolProp; \ No newline at end of file From df826de042f6e18102e44d625bfcba6df111e60a Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 5 Feb 2015 12:30:22 -0800 Subject: [PATCH 032/162] symbols in type guards --- src/compiler/checker.ts | 2 +- tests/baselines/reference/symbolType17.js | 21 ++++++++++++++++ tests/baselines/reference/symbolType17.types | 24 +++++++++++++++++++ tests/baselines/reference/symbolType18.js | 21 ++++++++++++++++ tests/baselines/reference/symbolType18.types | 24 +++++++++++++++++++ tests/baselines/reference/symbolType19.js | 24 +++++++++++++++++++ tests/baselines/reference/symbolType19.types | 23 ++++++++++++++++++ .../conformance/es6/Symbols/symbolType17.ts | 11 +++++++++ .../conformance/es6/Symbols/symbolType18.ts | 11 +++++++++ .../conformance/es6/Symbols/symbolType19.ts | 11 +++++++++ 10 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/symbolType17.js create mode 100644 tests/baselines/reference/symbolType17.types create mode 100644 tests/baselines/reference/symbolType18.js create mode 100644 tests/baselines/reference/symbolType18.types create mode 100644 tests/baselines/reference/symbolType19.js create mode 100644 tests/baselines/reference/symbolType19.types create mode 100644 tests/cases/conformance/es6/Symbols/symbolType17.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolType18.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolType19.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b40acf0ea06..17d79081974 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4767,7 +4767,7 @@ module ts { if (assumeTrue) { // Assumed result is true. If check was not for a primitive type, remove all primitive types if (!typeInfo) { - return removeTypesFromUnionType(type, /*typeKind*/ TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.Boolean, /*isOfTypeKind*/ true); + return removeTypesFromUnionType(type, /*typeKind*/ TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.Boolean | TypeFlags.ESSymbol, /*isOfTypeKind*/ true); } // Check was for a primitive type, return that primitive type if it is a subtype if (isTypeSubtypeOf(typeInfo.type, type)) { diff --git a/tests/baselines/reference/symbolType17.js b/tests/baselines/reference/symbolType17.js new file mode 100644 index 00000000000..a00d2cb36f7 --- /dev/null +++ b/tests/baselines/reference/symbolType17.js @@ -0,0 +1,21 @@ +//// [symbolType17.ts] +interface Foo { prop } +var x: symbol | Foo; + +x; +if (typeof x === "symbol") { + x; +} +else { + x; +} + +//// [symbolType17.js] +var x; +x; +if (typeof x === "symbol") { + x; +} +else { + x; +} diff --git a/tests/baselines/reference/symbolType17.types b/tests/baselines/reference/symbolType17.types new file mode 100644 index 00000000000..b86d5a70ff7 --- /dev/null +++ b/tests/baselines/reference/symbolType17.types @@ -0,0 +1,24 @@ +=== tests/cases/conformance/es6/Symbols/symbolType17.ts === +interface Foo { prop } +>Foo : Foo +>prop : any + +var x: symbol | Foo; +>x : symbol | Foo +>Foo : Foo + +x; +>x : symbol | Foo + +if (typeof x === "symbol") { +>typeof x === "symbol" : boolean +>typeof x : string +>x : symbol | Foo + + x; +>x : symbol +} +else { + x; +>x : Foo +} diff --git a/tests/baselines/reference/symbolType18.js b/tests/baselines/reference/symbolType18.js new file mode 100644 index 00000000000..f8a784d2500 --- /dev/null +++ b/tests/baselines/reference/symbolType18.js @@ -0,0 +1,21 @@ +//// [symbolType18.ts] +interface Foo { prop } +var x: symbol | Foo; + +x; +if (typeof x === "object") { + x; +} +else { + x; +} + +//// [symbolType18.js] +var x; +x; +if (typeof x === "object") { + x; +} +else { + x; +} diff --git a/tests/baselines/reference/symbolType18.types b/tests/baselines/reference/symbolType18.types new file mode 100644 index 00000000000..1693c6e2499 --- /dev/null +++ b/tests/baselines/reference/symbolType18.types @@ -0,0 +1,24 @@ +=== tests/cases/conformance/es6/Symbols/symbolType18.ts === +interface Foo { prop } +>Foo : Foo +>prop : any + +var x: symbol | Foo; +>x : symbol | Foo +>Foo : Foo + +x; +>x : symbol | Foo + +if (typeof x === "object") { +>typeof x === "object" : boolean +>typeof x : string +>x : symbol | Foo + + x; +>x : Foo +} +else { + x; +>x : symbol | Foo +} diff --git a/tests/baselines/reference/symbolType19.js b/tests/baselines/reference/symbolType19.js new file mode 100644 index 00000000000..f3ba0e12472 --- /dev/null +++ b/tests/baselines/reference/symbolType19.js @@ -0,0 +1,24 @@ +//// [symbolType19.ts] +enum E { } +var x: symbol | E; + +x; +if (typeof x === "number") { + x; +} +else { + x; +} + +//// [symbolType19.js] +var E; +(function (E) { +})(E || (E = {})); +var x; +x; +if (typeof x === "number") { + x; +} +else { + x; +} diff --git a/tests/baselines/reference/symbolType19.types b/tests/baselines/reference/symbolType19.types new file mode 100644 index 00000000000..d01fbfa87fe --- /dev/null +++ b/tests/baselines/reference/symbolType19.types @@ -0,0 +1,23 @@ +=== tests/cases/conformance/es6/Symbols/symbolType19.ts === +enum E { } +>E : E + +var x: symbol | E; +>x : symbol | E +>E : E + +x; +>x : symbol | E + +if (typeof x === "number") { +>typeof x === "number" : boolean +>typeof x : string +>x : symbol | E + + x; +>x : E +} +else { + x; +>x : symbol +} diff --git a/tests/cases/conformance/es6/Symbols/symbolType17.ts b/tests/cases/conformance/es6/Symbols/symbolType17.ts new file mode 100644 index 00000000000..95824f1794b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType17.ts @@ -0,0 +1,11 @@ +//@target: ES6 +interface Foo { prop } +var x: symbol | Foo; + +x; +if (typeof x === "symbol") { + x; +} +else { + x; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType18.ts b/tests/cases/conformance/es6/Symbols/symbolType18.ts new file mode 100644 index 00000000000..caa84171737 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType18.ts @@ -0,0 +1,11 @@ +//@target: ES6 +interface Foo { prop } +var x: symbol | Foo; + +x; +if (typeof x === "object") { + x; +} +else { + x; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolType19.ts b/tests/cases/conformance/es6/Symbols/symbolType19.ts new file mode 100644 index 00000000000..85d13b2cbdd --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType19.ts @@ -0,0 +1,11 @@ +//@target: ES6 +enum E { } +var x: symbol | E; + +x; +if (typeof x === "number") { + x; +} +else { + x; +} \ No newline at end of file From d07ed679a01a75b1fd7735da366be3cf5eee796f Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 5 Feb 2015 17:18:32 -0800 Subject: [PATCH 033/162] Support indexing with known symbols --- src/compiler/binder.ts | 2 +- src/compiler/checker.ts | 36 +++++++++++-- src/compiler/utilities.ts | 4 ++ .../reference/symbolProperty17.types | 27 ++++++++++ .../reference/symbolProperty18.types | 47 +++++++++++++++++ .../reference/symbolProperty19.types | 38 ++++++++++++++ .../reference/symbolProperty28.types | 34 +++++++++++++ .../reference/symbolProperty40.types | 48 +++++++++++++++++ .../reference/symbolProperty41.types | 51 +++++++++++++++++++ .../reference/symbolProperty46.errors.txt | 17 +++++++ .../reference/symbolProperty47.errors.txt | 7 ++- .../reference/symbolProperty52.errors.txt | 9 +++- tests/baselines/reference/symbolProperty52.js | 5 +- .../reference/symbolProperty53.errors.txt | 9 +++- tests/baselines/reference/symbolProperty53.js | 5 +- tests/baselines/reference/symbolProperty55.js | 23 +++++++++ .../reference/symbolProperty55.types | 28 ++++++++++ tests/baselines/reference/symbolProperty56.js | 23 +++++++++ .../reference/symbolProperty56.types | 26 ++++++++++ tests/baselines/reference/symbolProperty57.js | 14 +++++ .../reference/symbolProperty57.types | 19 +++++++ .../es6/Symbols/symbolProperty52.ts | 4 +- .../es6/Symbols/symbolProperty53.ts | 4 +- .../es6/Symbols/symbolProperty55.ts | 11 ++++ .../es6/Symbols/symbolProperty56.ts | 11 ++++ .../es6/Symbols/symbolProperty57.ts | 7 +++ 26 files changed, 495 insertions(+), 14 deletions(-) create mode 100644 tests/baselines/reference/symbolProperty17.types create mode 100644 tests/baselines/reference/symbolProperty18.types create mode 100644 tests/baselines/reference/symbolProperty19.types create mode 100644 tests/baselines/reference/symbolProperty28.types create mode 100644 tests/baselines/reference/symbolProperty40.types create mode 100644 tests/baselines/reference/symbolProperty41.types create mode 100644 tests/baselines/reference/symbolProperty46.errors.txt create mode 100644 tests/baselines/reference/symbolProperty55.js create mode 100644 tests/baselines/reference/symbolProperty55.types create mode 100644 tests/baselines/reference/symbolProperty56.js create mode 100644 tests/baselines/reference/symbolProperty56.types create mode 100644 tests/baselines/reference/symbolProperty57.js create mode 100644 tests/baselines/reference/symbolProperty57.types create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty55.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty56.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty57.ts diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index 3f17d26d2b2..cca2ca29e45 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -97,7 +97,7 @@ module ts { if (node.name.kind === SyntaxKind.ComputedPropertyName) { var nameExpression = (node.name).expression; Debug.assert(isWellKnownSymbolSyntactically(nameExpression)); - return "__@" + (nameExpression).name.text; + return getPropertyNameForKnownSymbolName((nameExpression).name.text); } return (node.name).text; } diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 17d79081974..d47fd2085d0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5787,8 +5787,8 @@ module ts { // See if we can index as a property. if (node.argumentExpression) { - if (node.argumentExpression.kind === SyntaxKind.StringLiteral || node.argumentExpression.kind === SyntaxKind.NumericLiteral) { - var name = (node.argumentExpression).text; + var name = getPropertyNameForIndexedAccess(node.argumentExpression); + if (name !== undefined) { var prop = getPropertyOfType(objectType, name); if (prop) { getNodeLinks(node).resolvedSymbol = prop; @@ -5832,6 +5832,36 @@ module ts { return unknownType; } + /** + * If indexArgumentExpression is a string literal or number literal, returns its text. + * If indexArgumentExpression is a well known symbol, returns the property name corresponding + * to this symbol. + * Otherwise, returns undefined. + */ + function getPropertyNameForIndexedAccess(indexArgumentExpression: Expression) { + if (indexArgumentExpression.kind === SyntaxKind.StringLiteral || indexArgumentExpression.kind === SyntaxKind.NumericLiteral) { + return (indexArgumentExpression).text; + } + if (isWellKnownSymbolSyntactically(indexArgumentExpression)) { + var leftHandSide = (indexArgumentExpression).expression; + Debug.assert((leftHandSide).text === "Symbol"); + // The name is Symbol., so make sure Symbol actually resolves to the + // global Symbol object + var leftHandSideSymbol = resolveName(indexArgumentExpression, (leftHandSide).text, + SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + if (leftHandSideSymbol === globalESSymbolConstructorSymbol) { + // Make sure the property type is the primitive symbol type + var rightHandSideName = ((indexArgumentExpression).name).text; + var esSymbolConstructorPropertyType = getTypeOfPropertyOfType(globalESSymbolConstructorType, rightHandSideName); + if (esSymbolConstructorPropertyType && esSymbolConstructorPropertyType.flags & TypeFlags.ESSymbol) { + return getPropertyNameForKnownSymbolName(rightHandSideName); + } + } + } + + return undefined; + } + function resolveUntypedCall(node: CallLikeExpression): Signature { if (node.kind === SyntaxKind.TaggedTemplateExpression) { checkExpression((node).template); @@ -10334,7 +10364,7 @@ module ts { globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); globalESSymbolType = getGlobalType("Symbol"); globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); - globalESSymbolConstructorType = getTypeOfGlobalSymbol(globalESSymbolConstructorSymbol, /*arity*/ 0); + globalESSymbolConstructorType = getTypeOfSymbol(globalESSymbolConstructorSymbol); } else { globalTemplateStringsArrayType = unknownType; diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 9d8f5f9b563..8830dacc374 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -852,6 +852,10 @@ module ts { return node.kind === SyntaxKind.PropertyAccessExpression && isESSymbolIdentifier((node).expression); } + export function getPropertyNameForKnownSymbolName(symbolName: string): string { + return "__@" + symbolName; + } + /** * Includes the word "Symbol" with unicode escapes */ diff --git a/tests/baselines/reference/symbolProperty17.types b/tests/baselines/reference/symbolProperty17.types new file mode 100644 index 00000000000..f804943c212 --- /dev/null +++ b/tests/baselines/reference/symbolProperty17.types @@ -0,0 +1,27 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty17.ts === +interface I { +>I : I + + [Symbol.iterator]: number; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + [s: symbol]: string; +>s : symbol + + "__@iterator": string; +} + +var i: I; +>i : I +>I : I + +var it = i[Symbol.iterator]; +>it : number +>i[Symbol.iterator] : number +>i : I +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + diff --git a/tests/baselines/reference/symbolProperty18.types b/tests/baselines/reference/symbolProperty18.types new file mode 100644 index 00000000000..8dd74112a8d --- /dev/null +++ b/tests/baselines/reference/symbolProperty18.types @@ -0,0 +1,47 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty18.ts === +var i = { +>i : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } +>{ [Symbol.iterator]: 0, [Symbol.toStringTag]() { return "" }, set [Symbol.toPrimitive](p: boolean) { }} : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } + + [Symbol.iterator]: 0, +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + [Symbol.toStringTag]() { return "" }, +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + set [Symbol.toPrimitive](p: boolean) { } +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol +>p : boolean +} + +var it = i[Symbol.iterator]; +>it : number +>i[Symbol.iterator] : number +>i : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +var str = i[Symbol.toStringTag](); +>str : string +>i[Symbol.toStringTag]() : string +>i[Symbol.toStringTag] : () => string +>i : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + +i[Symbol.toPrimitive] = false; +>i[Symbol.toPrimitive] = false : boolean +>i[Symbol.toPrimitive] : boolean +>i : { [Symbol.iterator]: number; [Symbol.toStringTag](): string; [Symbol.toPrimitive]: boolean; } +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol + diff --git a/tests/baselines/reference/symbolProperty19.types b/tests/baselines/reference/symbolProperty19.types new file mode 100644 index 00000000000..705c2b8bdf7 --- /dev/null +++ b/tests/baselines/reference/symbolProperty19.types @@ -0,0 +1,38 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty19.ts === +var i = { +>i : { [Symbol.iterator]: { p: any; }; [Symbol.toStringTag](): { p: any; }; } +>{ [Symbol.iterator]: { p: null }, [Symbol.toStringTag]() { return { p: undefined }; }} : { [Symbol.iterator]: { p: null; }; [Symbol.toStringTag](): { p: any; }; } + + [Symbol.iterator]: { p: null }, +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>{ p: null } : { p: null; } +>p : null + + [Symbol.toStringTag]() { return { p: undefined }; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +>{ p: undefined } : { p: undefined; } +>p : undefined +>undefined : undefined +} + +var it = i[Symbol.iterator]; +>it : { p: any; } +>i[Symbol.iterator] : { p: any; } +>i : { [Symbol.iterator]: { p: any; }; [Symbol.toStringTag](): { p: any; }; } +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +var str = i[Symbol.toStringTag](); +>str : { p: any; } +>i[Symbol.toStringTag]() : { p: any; } +>i[Symbol.toStringTag] : () => { p: any; } +>i : { [Symbol.iterator]: { p: any; }; [Symbol.toStringTag](): { p: any; }; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + diff --git a/tests/baselines/reference/symbolProperty28.types b/tests/baselines/reference/symbolProperty28.types new file mode 100644 index 00000000000..ef5aa0f3003 --- /dev/null +++ b/tests/baselines/reference/symbolProperty28.types @@ -0,0 +1,34 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty28.ts === +class C1 { +>C1 : C1 + + [Symbol.toStringTag]() { +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol + + return { x: "" }; +>{ x: "" } : { x: string; } +>x : string + } +} + +class C2 extends C1 { } +>C2 : C2 +>C1 : C1 + +var c: C2; +>c : C2 +>C2 : C2 + +var obj = c[Symbol.toStringTag]().x; +>obj : string +>c[Symbol.toStringTag]().x : string +>c[Symbol.toStringTag]() : { x: string; } +>c[Symbol.toStringTag] : () => { x: string; } +>c : C2 +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +>x : string + diff --git a/tests/baselines/reference/symbolProperty40.types b/tests/baselines/reference/symbolProperty40.types new file mode 100644 index 00000000000..a87a6ea28a8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty40.types @@ -0,0 +1,48 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty40.ts === +class C { +>C : C + + [Symbol.iterator](x: string): string; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : string + + [Symbol.iterator](x: number): number; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : number + + [Symbol.iterator](x: any) { +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any + + return undefined; +>undefined : undefined + } +} + +var c = new C; +>c : C +>new C : C +>C : typeof C + +c[Symbol.iterator](""); +>c[Symbol.iterator]("") : string +>c[Symbol.iterator] : { (x: string): string; (x: number): number; } +>c : C +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +c[Symbol.iterator](0); +>c[Symbol.iterator](0) : number +>c[Symbol.iterator] : { (x: string): string; (x: number): number; } +>c : C +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + diff --git a/tests/baselines/reference/symbolProperty41.types b/tests/baselines/reference/symbolProperty41.types new file mode 100644 index 00000000000..94032c194d6 --- /dev/null +++ b/tests/baselines/reference/symbolProperty41.types @@ -0,0 +1,51 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty41.ts === +class C { +>C : C + + [Symbol.iterator](x: string): { x: string }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : string +>x : string + + [Symbol.iterator](x: "hello"): { x: string; hello: string }; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : "hello" +>x : string +>hello : string + + [Symbol.iterator](x: any) { +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +>x : any + + return undefined; +>undefined : undefined + } +} + +var c = new C; +>c : C +>new C : C +>C : typeof C + +c[Symbol.iterator](""); +>c[Symbol.iterator]("") : { x: string; } +>c[Symbol.iterator] : { (x: string): { x: string; }; (x: "hello"): { x: string; hello: string; }; } +>c : C +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +c[Symbol.iterator]("hello"); +>c[Symbol.iterator]("hello") : { x: string; hello: string; } +>c[Symbol.iterator] : { (x: string): { x: string; }; (x: "hello"): { x: string; hello: string; }; } +>c : C +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + diff --git a/tests/baselines/reference/symbolProperty46.errors.txt b/tests/baselines/reference/symbolProperty46.errors.txt new file mode 100644 index 00000000000..68f86afc315 --- /dev/null +++ b/tests/baselines/reference/symbolProperty46.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/es6/Symbols/symbolProperty46.ts(10,1): error TS2322: Type 'number' is not assignable to type 'string'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty46.ts (1 errors) ==== + class C { + get [Symbol.hasInstance]() { + return ""; + } + // Should take a string + set [Symbol.hasInstance](x) { + } + } + + (new C)[Symbol.hasInstance] = 0; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'number' is not assignable to type 'string'. + (new C)[Symbol.hasInstance] = ""; \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty47.errors.txt b/tests/baselines/reference/symbolProperty47.errors.txt index 8d16be2fd57..b35650f94bb 100644 --- a/tests/baselines/reference/symbolProperty47.errors.txt +++ b/tests/baselines/reference/symbolProperty47.errors.txt @@ -1,7 +1,8 @@ tests/cases/conformance/es6/Symbols/symbolProperty47.ts(3,16): error TS2322: Type 'string' is not assignable to type 'number'. +tests/cases/conformance/es6/Symbols/symbolProperty47.ts(11,1): error TS2322: Type 'string' is not assignable to type 'number'. -==== tests/cases/conformance/es6/Symbols/symbolProperty47.ts (1 errors) ==== +==== tests/cases/conformance/es6/Symbols/symbolProperty47.ts (2 errors) ==== class C { get [Symbol.hasInstance]() { return ""; @@ -14,4 +15,6 @@ tests/cases/conformance/es6/Symbols/symbolProperty47.ts(3,16): error TS2322: Typ } (new C)[Symbol.hasInstance] = 0; - (new C)[Symbol.hasInstance] = ""; \ No newline at end of file + (new C)[Symbol.hasInstance] = ""; + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2322: Type 'string' is not assignable to type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty52.errors.txt b/tests/baselines/reference/symbolProperty52.errors.txt index 484dffbea96..5a44918d564 100644 --- a/tests/baselines/reference/symbolProperty52.errors.txt +++ b/tests/baselines/reference/symbolProperty52.errors.txt @@ -1,9 +1,10 @@ tests/cases/conformance/es6/Symbols/symbolProperty52.ts(2,13): error TS2339: Property 'nonsense' does not exist on type 'SymbolConstructor'. tests/cases/conformance/es6/Symbols/symbolProperty52.ts(5,1): error TS2322: Type '{}' is not assignable to type '{ [Symbol.nonsense]: number; }'. Property '[Symbol.nonsense]' is missing in type '{}'. +tests/cases/conformance/es6/Symbols/symbolProperty52.ts(7,12): error TS2339: Property 'nonsense' does not exist on type 'SymbolConstructor'. -==== tests/cases/conformance/es6/Symbols/symbolProperty52.ts (2 errors) ==== +==== tests/cases/conformance/es6/Symbols/symbolProperty52.ts (3 errors) ==== var obj = { [Symbol.nonsense]: 0 ~~~~~~~~ @@ -13,4 +14,8 @@ tests/cases/conformance/es6/Symbols/symbolProperty52.ts(5,1): error TS2322: Type obj = {}; ~~~ !!! error TS2322: Type '{}' is not assignable to type '{ [Symbol.nonsense]: number; }'. -!!! error TS2322: Property '[Symbol.nonsense]' is missing in type '{}'. \ No newline at end of file +!!! error TS2322: Property '[Symbol.nonsense]' is missing in type '{}'. + + obj[Symbol.nonsense]; + ~~~~~~~~ +!!! error TS2339: Property 'nonsense' does not exist on type 'SymbolConstructor'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty52.js b/tests/baselines/reference/symbolProperty52.js index e3542b5a85f..1bf4a47de7f 100644 --- a/tests/baselines/reference/symbolProperty52.js +++ b/tests/baselines/reference/symbolProperty52.js @@ -3,10 +3,13 @@ var obj = { [Symbol.nonsense]: 0 }; -obj = {}; +obj = {}; + +obj[Symbol.nonsense]; //// [symbolProperty52.js] var obj = { [Symbol.nonsense]: 0 }; obj = {}; +obj[Symbol.nonsense]; diff --git a/tests/baselines/reference/symbolProperty53.errors.txt b/tests/baselines/reference/symbolProperty53.errors.txt index 0d9601df68a..523feed3e8e 100644 --- a/tests/baselines/reference/symbolProperty53.errors.txt +++ b/tests/baselines/reference/symbolProperty53.errors.txt @@ -1,9 +1,14 @@ tests/cases/conformance/es6/Symbols/symbolProperty53.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. +tests/cases/conformance/es6/Symbols/symbolProperty53.ts(5,1): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. -==== tests/cases/conformance/es6/Symbols/symbolProperty53.ts (1 errors) ==== +==== tests/cases/conformance/es6/Symbols/symbolProperty53.ts (2 errors) ==== var obj = { [Symbol.for]: 0 ~~~~~~~~~~~~ !!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. - }; \ No newline at end of file + }; + + obj[Symbol.for]; + ~~~~~~~~~~~~~~~ +!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty53.js b/tests/baselines/reference/symbolProperty53.js index f302dff8924..71c82d14917 100644 --- a/tests/baselines/reference/symbolProperty53.js +++ b/tests/baselines/reference/symbolProperty53.js @@ -1,9 +1,12 @@ //// [symbolProperty53.ts] var obj = { [Symbol.for]: 0 -}; +}; + +obj[Symbol.for]; //// [symbolProperty53.js] var obj = { [Symbol.for]: 0 }; +obj[Symbol.for]; diff --git a/tests/baselines/reference/symbolProperty55.js b/tests/baselines/reference/symbolProperty55.js new file mode 100644 index 00000000000..e19e2d8e2f6 --- /dev/null +++ b/tests/baselines/reference/symbolProperty55.js @@ -0,0 +1,23 @@ +//// [symbolProperty55.ts] +var obj = { + [Symbol.iterator]: 0 +}; + +module M { + var Symbol: SymbolConstructor; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol.iterator]; +} + +//// [symbolProperty55.js] +var obj = { + [Symbol.iterator]: 0 +}; +var M; +(function (M) { + var Symbol; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol.iterator]; +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty55.types b/tests/baselines/reference/symbolProperty55.types new file mode 100644 index 00000000000..34b32e27eae --- /dev/null +++ b/tests/baselines/reference/symbolProperty55.types @@ -0,0 +1,28 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty55.ts === +var obj = { +>obj : { [Symbol.iterator]: number; } +>{ [Symbol.iterator]: 0} : { [Symbol.iterator]: number; } + + [Symbol.iterator]: 0 +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +}; + +module M { +>M : typeof M + + var Symbol: SymbolConstructor; +>Symbol : SymbolConstructor +>SymbolConstructor : SymbolConstructor + + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol.iterator]; +>obj[Symbol.iterator] : any +>obj : { [Symbol.iterator]: number; } +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol +} diff --git a/tests/baselines/reference/symbolProperty56.js b/tests/baselines/reference/symbolProperty56.js new file mode 100644 index 00000000000..fea4520c2f8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty56.js @@ -0,0 +1,23 @@ +//// [symbolProperty56.ts] +var obj = { + [Symbol.iterator]: 0 +}; + +module M { + var Symbol: {}; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol["iterator"]]; +} + +//// [symbolProperty56.js] +var obj = { + [Symbol.iterator]: 0 +}; +var M; +(function (M) { + var Symbol; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol["iterator"]]; +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty56.types b/tests/baselines/reference/symbolProperty56.types new file mode 100644 index 00000000000..8fc2e97b751 --- /dev/null +++ b/tests/baselines/reference/symbolProperty56.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty56.ts === +var obj = { +>obj : { [Symbol.iterator]: number; } +>{ [Symbol.iterator]: 0} : { [Symbol.iterator]: number; } + + [Symbol.iterator]: 0 +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +}; + +module M { +>M : typeof M + + var Symbol: {}; +>Symbol : {} + + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol["iterator"]]; +>obj[Symbol["iterator"]] : any +>obj : { [Symbol.iterator]: number; } +>Symbol["iterator"] : any +>Symbol : {} +} diff --git a/tests/baselines/reference/symbolProperty57.js b/tests/baselines/reference/symbolProperty57.js new file mode 100644 index 00000000000..8fffcba3e27 --- /dev/null +++ b/tests/baselines/reference/symbolProperty57.js @@ -0,0 +1,14 @@ +//// [symbolProperty57.ts] +var obj = { + [Symbol.iterator]: 0 +}; + +// Should give type 'any'. +obj[Symbol["nonsense"]]; + +//// [symbolProperty57.js] +var obj = { + [Symbol.iterator]: 0 +}; +// Should give type 'any'. +obj[Symbol["nonsense"]]; diff --git a/tests/baselines/reference/symbolProperty57.types b/tests/baselines/reference/symbolProperty57.types new file mode 100644 index 00000000000..013c008ce12 --- /dev/null +++ b/tests/baselines/reference/symbolProperty57.types @@ -0,0 +1,19 @@ +=== tests/cases/conformance/es6/Symbols/symbolProperty57.ts === +var obj = { +>obj : { [Symbol.iterator]: number; } +>{ [Symbol.iterator]: 0} : { [Symbol.iterator]: number; } + + [Symbol.iterator]: 0 +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + +}; + +// Should give type 'any'. +obj[Symbol["nonsense"]]; +>obj[Symbol["nonsense"]] : any +>obj : { [Symbol.iterator]: number; } +>Symbol["nonsense"] : any +>Symbol : SymbolConstructor + diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty52.ts b/tests/cases/conformance/es6/Symbols/symbolProperty52.ts index 324278ea804..b14838a6914 100644 --- a/tests/cases/conformance/es6/Symbols/symbolProperty52.ts +++ b/tests/cases/conformance/es6/Symbols/symbolProperty52.ts @@ -3,4 +3,6 @@ var obj = { [Symbol.nonsense]: 0 }; -obj = {}; \ No newline at end of file +obj = {}; + +obj[Symbol.nonsense]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty53.ts b/tests/cases/conformance/es6/Symbols/symbolProperty53.ts index 04cdf21a67e..c58b6e885af 100644 --- a/tests/cases/conformance/es6/Symbols/symbolProperty53.ts +++ b/tests/cases/conformance/es6/Symbols/symbolProperty53.ts @@ -1,4 +1,6 @@ //@target: ES6 var obj = { [Symbol.for]: 0 -}; \ No newline at end of file +}; + +obj[Symbol.for]; \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty55.ts b/tests/cases/conformance/es6/Symbols/symbolProperty55.ts new file mode 100644 index 00000000000..3c6ceb69b0e --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty55.ts @@ -0,0 +1,11 @@ +//@target: ES6 +var obj = { + [Symbol.iterator]: 0 +}; + +module M { + var Symbol: SymbolConstructor; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol.iterator]; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty56.ts b/tests/cases/conformance/es6/Symbols/symbolProperty56.ts new file mode 100644 index 00000000000..ae9e5232b9b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty56.ts @@ -0,0 +1,11 @@ +//@target: ES6 +var obj = { + [Symbol.iterator]: 0 +}; + +module M { + var Symbol: {}; + // The following should be of type 'any'. This is because even though obj has a property keyed by Symbol.iterator, + // the key passed in here is the *wrong* Symbol.iterator. It is not the iterator property of the global Symbol. + obj[Symbol["iterator"]]; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty57.ts b/tests/cases/conformance/es6/Symbols/symbolProperty57.ts new file mode 100644 index 00000000000..b60c18a05ee --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty57.ts @@ -0,0 +1,7 @@ +//@target: ES6 +var obj = { + [Symbol.iterator]: 0 +}; + +// Should give type 'any'. +obj[Symbol["nonsense"]]; \ No newline at end of file From 83258629ea361820078caf7726d69cd09a89e3e0 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 5 Feb 2015 18:11:17 -0800 Subject: [PATCH 034/162] Fix error message --- src/compiler/checker.ts | 2 +- src/compiler/diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- tests/baselines/reference/indexTypeCheck.errors.txt | 4 ++-- ...bjectCreationOfElementAccessExpression.errors.txt | 8 ++++---- tests/baselines/reference/propertyAccess.errors.txt | 12 ++++++------ .../baselines/reference/symbolProperty53.errors.txt | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d47fd2085d0..b626db71cdc 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5827,7 +5827,7 @@ module ts { } // REVIEW: Users should know the type that was actually used. - error(node, Diagnostics.An_index_expression_argument_must_be_of_type_string_number_or_any); + error(node, Diagnostics.An_index_expression_argument_must_be_of_type_string_number_symbol_or_any); return unknownType; } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 34f9c50eaad..9e3f7a20d9f 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -189,7 +189,7 @@ module ts { Property_0_does_not_exist_on_type_1: { code: 2339, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on type '{1}'." }, Only_public_and_protected_methods_of_the_base_class_are_accessible_via_the_super_keyword: { code: 2340, category: DiagnosticCategory.Error, key: "Only public and protected methods of the base class are accessible via the 'super' keyword" }, Property_0_is_private_and_only_accessible_within_class_1: { code: 2341, category: DiagnosticCategory.Error, key: "Property '{0}' is private and only accessible within class '{1}'." }, - An_index_expression_argument_must_be_of_type_string_number_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', or 'any'." }, + An_index_expression_argument_must_be_of_type_string_number_symbol_or_any: { code: 2342, category: DiagnosticCategory.Error, key: "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'." }, Type_0_does_not_satisfy_the_constraint_1: { code: 2344, category: DiagnosticCategory.Error, key: "Type '{0}' does not satisfy the constraint '{1}'." }, Argument_of_type_0_is_not_assignable_to_parameter_of_type_1: { code: 2345, category: DiagnosticCategory.Error, key: "Argument of type '{0}' is not assignable to parameter of type '{1}'." }, Supplied_parameters_do_not_match_any_signature_of_call_target: { code: 2346, category: DiagnosticCategory.Error, key: "Supplied parameters do not match any signature of call target." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 1fd7cb7356b..1288ea748e2 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -749,7 +749,7 @@ "category": "Error", "code": 2341 }, - "An index expression argument must be of type 'string', 'number', or 'any'.": { + "An index expression argument must be of type 'string', 'number', 'symbol, or 'any'.": { "category": "Error", "code": 2342 }, diff --git a/tests/baselines/reference/indexTypeCheck.errors.txt b/tests/baselines/reference/indexTypeCheck.errors.txt index f45e56ef6df..5d3e6dc9268 100644 --- a/tests/baselines/reference/indexTypeCheck.errors.txt +++ b/tests/baselines/reference/indexTypeCheck.errors.txt @@ -5,7 +5,7 @@ tests/cases/compiler/indexTypeCheck.ts(22,2): error TS2413: Numeric index type ' tests/cases/compiler/indexTypeCheck.ts(27,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'. tests/cases/compiler/indexTypeCheck.ts(32,3): error TS1096: An index signature must have exactly one parameter. tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. -tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. ==== tests/cases/compiler/indexTypeCheck.ts (8 errors) ==== @@ -75,7 +75,7 @@ tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression yellow[blue]; // error ~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. var x:number[]; x[0]; diff --git a/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt b/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt index 73332ff8926..b2f3bd9d824 100644 --- a/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt +++ b/tests/baselines/reference/objectCreationOfElementAccessExpression.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,17): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,17): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. tests/cases/compiler/objectCreationOfElementAccessExpression.ts(53,63): error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? -tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,33): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,33): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,79): error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? @@ -59,12 +59,12 @@ tests/cases/compiler/objectCreationOfElementAccessExpression.ts(54,79): error TS // ElementAccessExpressions can only contain one expression. There should be a parse error here. var foods = new PetFood[new IceCream('Mint chocolate chip') , Cookie('Chocolate chip', false) , new Cookie('Peanut butter', true)]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? var foods2: MonsterFood[] = new PetFood[new IceCream('Mint chocolate chip') , Cookie('Chocolate chip', false) , new Cookie('Peanut butter', true)]; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2348: Value of type 'typeof Cookie' is not callable. Did you mean to include 'new'? \ No newline at end of file diff --git a/tests/baselines/reference/propertyAccess.errors.txt b/tests/baselines/reference/propertyAccess.errors.txt index 5cffcbec64c..d9cd90a48fc 100644 --- a/tests/baselines/reference/propertyAccess.errors.txt +++ b/tests/baselines/reference/propertyAccess.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(45,14): error TS2339: Property 'qqq' does not exist on type '{ 10: string; x: string; y: number; z: { n: string; m: number; o: () => boolean; }; 'literal property': number; }'. -tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(80,10): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. -tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(117,10): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. -tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(80,10): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(117,10): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. +tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. ==== tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts (4 errors) ==== @@ -88,7 +88,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er // Bracket notation property access using value of other type on type with numeric index signature and no string index signature var ll = numIndex[someObject]; // Error ~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. // Bracket notation property access using string value on type with string index signature and no numeric index signature var mm = strIndex['N']; @@ -127,7 +127,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er // Bracket notation property access using values of other types on type with no index signatures var uu = noIndex[someObject]; // Error ~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. // Bracket notation property access using numeric value on type with numeric index signature and string index signature var vv = noIndex[32]; @@ -152,7 +152,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,12): er // Bracket notation property access using value of other type on type with numeric index signature and no string index signature and string index signature var zzzz = bothIndex[someObject]; // Error ~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. var x1 = numIndex[stringOrNumber]; var x1: any; diff --git a/tests/baselines/reference/symbolProperty53.errors.txt b/tests/baselines/reference/symbolProperty53.errors.txt index 523feed3e8e..7658744eb55 100644 --- a/tests/baselines/reference/symbolProperty53.errors.txt +++ b/tests/baselines/reference/symbolProperty53.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/es6/Symbols/symbolProperty53.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. -tests/cases/conformance/es6/Symbols/symbolProperty53.ts(5,1): error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. +tests/cases/conformance/es6/Symbols/symbolProperty53.ts(5,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. ==== tests/cases/conformance/es6/Symbols/symbolProperty53.ts (2 errors) ==== @@ -11,4 +11,4 @@ tests/cases/conformance/es6/Symbols/symbolProperty53.ts(5,1): error TS2342: An i obj[Symbol.for]; ~~~~~~~~~~~~~~~ -!!! error TS2342: An index expression argument must be of type 'string', 'number', or 'any'. \ No newline at end of file +!!! error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. \ No newline at end of file From 3834edd747fc9ffab50299e5286183eb8e900feb Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Fri, 6 Feb 2015 13:06:28 -0800 Subject: [PATCH 035/162] Refactor part of getPropertyNameForIndexedAccess into checkSymbolNameIsProperSymbolReference --- src/compiler/checker.ts | 57 ++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 15 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b626db71cdc..72a05f619ab 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5540,6 +5540,14 @@ module ts { if (!isTypeOfKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.ESSymbol)) { error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } + else if (isWellKnownSymbolSyntactically(node.expression)) { + // If it's not ES6, error + // Check that Symbol corresponds to global symbol, and that property exists, and that it's a symbol + } + else { + // Some syntactic forms require that the property name be a well known symbol. + // Will move the grammar checks here. + } } return links.resolvedType; @@ -5835,33 +5843,52 @@ module ts { /** * If indexArgumentExpression is a string literal or number literal, returns its text. * If indexArgumentExpression is a well known symbol, returns the property name corresponding - * to this symbol. + * to this symbol, as long as it is a proper symbol reference. * Otherwise, returns undefined. */ - function getPropertyNameForIndexedAccess(indexArgumentExpression: Expression) { + function getPropertyNameForIndexedAccess(indexArgumentExpression: Expression): string { if (indexArgumentExpression.kind === SyntaxKind.StringLiteral || indexArgumentExpression.kind === SyntaxKind.NumericLiteral) { return (indexArgumentExpression).text; } - if (isWellKnownSymbolSyntactically(indexArgumentExpression)) { - var leftHandSide = (indexArgumentExpression).expression; - Debug.assert((leftHandSide).text === "Symbol"); - // The name is Symbol., so make sure Symbol actually resolves to the - // global Symbol object - var leftHandSideSymbol = resolveName(indexArgumentExpression, (leftHandSide).text, - SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); - if (leftHandSideSymbol === globalESSymbolConstructorSymbol) { - // Make sure the property type is the primitive symbol type + if (languageVersion >= ScriptTarget.ES6 && isWellKnownSymbolSyntactically(indexArgumentExpression)) { + if (checkSymbolNameIsProperSymbolReference(indexArgumentExpression, /*reportError*/ false)) { var rightHandSideName = ((indexArgumentExpression).name).text; - var esSymbolConstructorPropertyType = getTypeOfPropertyOfType(globalESSymbolConstructorType, rightHandSideName); - if (esSymbolConstructorPropertyType && esSymbolConstructorPropertyType.flags & TypeFlags.ESSymbol) { - return getPropertyNameForKnownSymbolName(rightHandSideName); - } + return getPropertyNameForKnownSymbolName(rightHandSideName); } } return undefined; } + /** + * A proper symbol reference requires the following: + * 1. The language version is at least ES6 + * 2. The expression is of the form Symbol. + * 3. Symbol in this context resolves to the global Symbol object + * 4. The property access denotes a property that is present on the global Symbol object + * 5. The property on the global Symbol object is of the primitive type symbol. + */ + function checkSymbolNameIsProperSymbolReference(wellKnownSymbolName: PropertyAccessExpression, reportError: boolean): boolean { + if (languageVersion < ScriptTarget.ES6) { + return false; + } + + Debug.assert(isWellKnownSymbolSyntactically(wellKnownSymbolName)); + // The name is Symbol., so make sure Symbol actually resolves to the + // global Symbol object + var leftHandSide = (wellKnownSymbolName).expression; + var leftHandSideSymbol = resolveName(wellKnownSymbolName, (leftHandSide).text, + SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + if (leftHandSideSymbol !== globalESSymbolConstructorSymbol) { + return false; + } + + // Make sure the property type is the primitive symbol type + var rightHandSideName = ((wellKnownSymbolName).name).text; + var esSymbolConstructorPropertyType = getTypeOfPropertyOfType(globalESSymbolConstructorType, rightHandSideName); + return !!(esSymbolConstructorPropertyType && esSymbolConstructorPropertyType.flags & TypeFlags.ESSymbol); + } + function resolveUntypedCall(node: CallLikeExpression): Signature { if (node.kind === SyntaxKind.TaggedTemplateExpression) { checkExpression((node).template); From 4c09ccd60ecd8a6a7ffd04ea413b8dbe8e8468f3 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Fri, 6 Feb 2015 19:32:19 -0800 Subject: [PATCH 036/162] Check that Symbol properties are proper, and support downlevel type checking --- src/compiler/checker.ts | 75 ++++++++++++------- .../diagnosticInformationMap.generated.ts | 2 + src/compiler/diagnosticMessages.json | 8 ++ .../reference/ES5SymbolProperty1.errors.txt | 19 +++++ .../baselines/reference/ES5SymbolProperty1.js | 18 +++++ .../reference/ES5SymbolProperty2.errors.txt | 22 ++++++ .../baselines/reference/ES5SymbolProperty2.js | 27 +++++++ .../reference/ES5SymbolProperty3.errors.txt | 16 ++++ .../baselines/reference/ES5SymbolProperty3.js | 19 +++++ .../reference/ES5SymbolProperty4.errors.txt | 16 ++++ .../baselines/reference/ES5SymbolProperty4.js | 19 +++++ .../reference/ES5SymbolProperty5.errors.txt | 16 ++++ .../baselines/reference/ES5SymbolProperty5.js | 19 +++++ .../reference/ES5SymbolProperty6.errors.txt | 17 +++++ .../baselines/reference/ES5SymbolProperty6.js | 16 ++++ .../reference/ES5SymbolProperty7.errors.txt | 16 ++++ .../baselines/reference/ES5SymbolProperty7.js | 19 +++++ tests/baselines/reference/ES5SymbolType1.js | 7 ++ .../baselines/reference/ES5SymbolType1.types | 10 +++ .../reference/symbolProperty48.errors.txt | 13 ++++ .../reference/symbolProperty49.errors.txt | 13 ++++ .../reference/symbolProperty58.errors.txt | 13 ++++ tests/baselines/reference/symbolProperty58.js | 13 ++++ .../conformance/Symbols/ES5SymbolProperty1.ts | 11 +++ .../conformance/Symbols/ES5SymbolProperty2.ts | 11 +++ .../conformance/Symbols/ES5SymbolProperty3.ts | 8 ++ .../conformance/Symbols/ES5SymbolProperty4.ts | 8 ++ .../conformance/Symbols/ES5SymbolProperty5.ts | 8 ++ .../conformance/Symbols/ES5SymbolProperty6.ts | 6 ++ .../conformance/Symbols/ES5SymbolProperty7.ts | 8 ++ .../conformance/Symbols/ES5SymbolType1.ts | 3 + .../es6/Symbols/symbolProperty58.ts | 8 ++ 32 files changed, 457 insertions(+), 27 deletions(-) create mode 100644 tests/baselines/reference/ES5SymbolProperty1.errors.txt create mode 100644 tests/baselines/reference/ES5SymbolProperty1.js create mode 100644 tests/baselines/reference/ES5SymbolProperty2.errors.txt create mode 100644 tests/baselines/reference/ES5SymbolProperty2.js create mode 100644 tests/baselines/reference/ES5SymbolProperty3.errors.txt create mode 100644 tests/baselines/reference/ES5SymbolProperty3.js create mode 100644 tests/baselines/reference/ES5SymbolProperty4.errors.txt create mode 100644 tests/baselines/reference/ES5SymbolProperty4.js create mode 100644 tests/baselines/reference/ES5SymbolProperty5.errors.txt create mode 100644 tests/baselines/reference/ES5SymbolProperty5.js create mode 100644 tests/baselines/reference/ES5SymbolProperty6.errors.txt create mode 100644 tests/baselines/reference/ES5SymbolProperty6.js create mode 100644 tests/baselines/reference/ES5SymbolProperty7.errors.txt create mode 100644 tests/baselines/reference/ES5SymbolProperty7.js create mode 100644 tests/baselines/reference/ES5SymbolType1.js create mode 100644 tests/baselines/reference/ES5SymbolType1.types create mode 100644 tests/baselines/reference/symbolProperty48.errors.txt create mode 100644 tests/baselines/reference/symbolProperty49.errors.txt create mode 100644 tests/baselines/reference/symbolProperty58.errors.txt create mode 100644 tests/baselines/reference/symbolProperty58.js create mode 100644 tests/cases/conformance/Symbols/ES5SymbolProperty1.ts create mode 100644 tests/cases/conformance/Symbols/ES5SymbolProperty2.ts create mode 100644 tests/cases/conformance/Symbols/ES5SymbolProperty3.ts create mode 100644 tests/cases/conformance/Symbols/ES5SymbolProperty4.ts create mode 100644 tests/cases/conformance/Symbols/ES5SymbolProperty5.ts create mode 100644 tests/cases/conformance/Symbols/ES5SymbolProperty6.ts create mode 100644 tests/cases/conformance/Symbols/ES5SymbolProperty7.ts create mode 100644 tests/cases/conformance/Symbols/ES5SymbolType1.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty58.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 72a05f619ab..b2f933e1194 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -96,7 +96,6 @@ module ts { var globalRegExpType: ObjectType; var globalTemplateStringsArrayType: ObjectType; var globalESSymbolType: ObjectType; - var globalESSymbolConstructorType: ObjectType; var anyArrayType: Type; @@ -3032,6 +3031,10 @@ module ts { return getTypeOfGlobalSymbol(getGlobalTypeSymbol(name), 0); } + function getGlobalESSymbolConstructorSymbol() { + return globalESSymbolConstructorSymbol || (globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol")); + } + function createArrayType(elementType: Type): Type { // globalArrayType will be undefined if we get here during creation of the Array type. This for example happens if // user code augments the Array type with call or construct signatures that have an array type as the return type. @@ -5541,12 +5544,7 @@ module ts { error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } else if (isWellKnownSymbolSyntactically(node.expression)) { - // If it's not ES6, error - // Check that Symbol corresponds to global symbol, and that property exists, and that it's a symbol - } - else { - // Some syntactic forms require that the property name be a well known symbol. - // Will move the grammar checks here. + checkSymbolNameIsProperSymbolReference(node.expression, links.resolvedType, /*reportError*/ true); } } @@ -5795,7 +5793,7 @@ module ts { // See if we can index as a property. if (node.argumentExpression) { - var name = getPropertyNameForIndexedAccess(node.argumentExpression); + var name = getPropertyNameForIndexedAccess(node.argumentExpression, indexType); if (name !== undefined) { var prop = getPropertyOfType(objectType, name); if (prop) { @@ -5846,12 +5844,12 @@ module ts { * to this symbol, as long as it is a proper symbol reference. * Otherwise, returns undefined. */ - function getPropertyNameForIndexedAccess(indexArgumentExpression: Expression): string { + function getPropertyNameForIndexedAccess(indexArgumentExpression: Expression, indexArgumentType: Type): string { if (indexArgumentExpression.kind === SyntaxKind.StringLiteral || indexArgumentExpression.kind === SyntaxKind.NumericLiteral) { return (indexArgumentExpression).text; } - if (languageVersion >= ScriptTarget.ES6 && isWellKnownSymbolSyntactically(indexArgumentExpression)) { - if (checkSymbolNameIsProperSymbolReference(indexArgumentExpression, /*reportError*/ false)) { + if (isWellKnownSymbolSyntactically(indexArgumentExpression)) { + if (checkSymbolNameIsProperSymbolReference(indexArgumentExpression, indexArgumentType, /*reportError*/ false)) { var rightHandSideName = ((indexArgumentExpression).name).text; return getPropertyNameForKnownSymbolName(rightHandSideName); } @@ -5862,31 +5860,52 @@ module ts { /** * A proper symbol reference requires the following: - * 1. The language version is at least ES6 - * 2. The expression is of the form Symbol. - * 3. Symbol in this context resolves to the global Symbol object - * 4. The property access denotes a property that is present on the global Symbol object - * 5. The property on the global Symbol object is of the primitive type symbol. + * 1. The expression is of the form Symbol. + * 2. Symbol in this context resolves to the global Symbol object + * 3. The property access denotes a property that is present on the global Symbol object + * 4. The property on the global Symbol object is of the primitive type symbol. */ - function checkSymbolNameIsProperSymbolReference(wellKnownSymbolName: PropertyAccessExpression, reportError: boolean): boolean { - if (languageVersion < ScriptTarget.ES6) { + function checkSymbolNameIsProperSymbolReference(wellKnownSymbolName: PropertyAccessExpression, propertyNameType: Type, reportError: boolean): boolean { + if (propertyNameType === unknownType) { + // There is already an error, so no need to report one. return false; } Debug.assert(isWellKnownSymbolSyntactically(wellKnownSymbolName)); + + // Make sure the property type is the primitive symbol type + if ((propertyNameType.flags & TypeFlags.ESSymbol) === 0) { + if (reportError) { + error(wellKnownSymbolName, Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, getTextOfNode(wellKnownSymbolName)); + } + return false; + } + // The name is Symbol., so make sure Symbol actually resolves to the // global Symbol object var leftHandSide = (wellKnownSymbolName).expression; + // Look up the global symbol, but don't report an error, since checking the actual expression + // would have reported an error. var leftHandSideSymbol = resolveName(wellKnownSymbolName, (leftHandSide).text, SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); - if (leftHandSideSymbol !== globalESSymbolConstructorSymbol) { + if (!leftHandSideSymbol) { return false; } - // Make sure the property type is the primitive symbol type - var rightHandSideName = ((wellKnownSymbolName).name).text; - var esSymbolConstructorPropertyType = getTypeOfPropertyOfType(globalESSymbolConstructorType, rightHandSideName); - return !!(esSymbolConstructorPropertyType && esSymbolConstructorPropertyType.flags & TypeFlags.ESSymbol); + var globalESSymbol = getGlobalESSymbolConstructorSymbol(); + if (!globalESSymbol) { + // Already errored when we tried to look up the symbol + return false; + } + + if (leftHandSideSymbol !== globalESSymbol) { + if (reportError) { + error(leftHandSide, Diagnostics.Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object); + } + return false; + } + + return true; } function resolveUntypedCall(node: CallLikeExpression): Signature { @@ -10391,13 +10410,15 @@ module ts { globalTemplateStringsArrayType = getGlobalType("TemplateStringsArray"); globalESSymbolType = getGlobalType("Symbol"); globalESSymbolConstructorSymbol = getGlobalValueSymbol("Symbol"); - globalESSymbolConstructorType = getTypeOfSymbol(globalESSymbolConstructorSymbol); } else { globalTemplateStringsArrayType = unknownType; - globalESSymbolType = unknownType; - globalESSymbolConstructorSymbol = unknownSymbol; - globalESSymbolConstructorType = unknownType; + + // Consider putting Symbol interface in lib.d.ts. On the plus side, putting it in lib.d.ts would make it + // extensible for Polyfilling Symbols. But putting it into lib.d.ts could also break users that have + // a global Symbol already, particularly if it is a class. + globalESSymbolType = createAnonymousType(undefined, emptySymbols, emptyArray, emptyArray, undefined, undefined); + globalESSymbolConstructorSymbol = undefined; } anyArrayType = createArrayType(anyType); diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 9e3f7a20d9f..c491acdf2ef 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -306,6 +306,8 @@ module ts { A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." }, Cannot_find_global_value_0: { code: 2468, category: DiagnosticCategory.Error, key: "Cannot find global value '{0}'." }, The_0_operator_cannot_be_applied_to_a_value_of_type_symbol: { code: 2469, category: DiagnosticCategory.Error, key: "The '{0}' operator cannot be applied to a value of type 'symbol'." }, + Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: DiagnosticCategory.Error, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, + A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: DiagnosticCategory.Error, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 1288ea748e2..e3f8a880111 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1217,6 +1217,14 @@ "category": "Error", "code": 2469 }, + "'Symbol' reference does not refer to the global Symbol constructor object.": { + "category": "Error", + "code": 2470 + }, + "A computed property name of the form '{0}' must be of type 'symbol'.": { + "category": "Error", + "code": 2471 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/tests/baselines/reference/ES5SymbolProperty1.errors.txt b/tests/baselines/reference/ES5SymbolProperty1.errors.txt new file mode 100644 index 00000000000..1c0c5a55ad2 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty1.errors.txt @@ -0,0 +1,19 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty1.ts(7,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/Symbols/ES5SymbolProperty1.ts(7,6): error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty1.ts (2 errors) ==== + interface SymbolConstructor { + foo: string; + } + var Symbol: SymbolConstructor; + + var obj = { + [Symbol.foo]: 0 + ~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'. + } + + obj[Symbol.foo]; \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty1.js b/tests/baselines/reference/ES5SymbolProperty1.js new file mode 100644 index 00000000000..3f761d3073f --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty1.js @@ -0,0 +1,18 @@ +//// [ES5SymbolProperty1.ts] +interface SymbolConstructor { + foo: string; +} +var Symbol: SymbolConstructor; + +var obj = { + [Symbol.foo]: 0 +} + +obj[Symbol.foo]; + +//// [ES5SymbolProperty1.js] +var Symbol; +var obj = { + [Symbol.foo]: 0 +}; +obj[Symbol.foo]; diff --git a/tests/baselines/reference/ES5SymbolProperty2.errors.txt b/tests/baselines/reference/ES5SymbolProperty2.errors.txt new file mode 100644 index 00000000000..397e8f51511 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty2.errors.txt @@ -0,0 +1,22 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(5,9): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(5,10): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. +tests/cases/conformance/Symbols/ES5SymbolProperty2.ts(10,11): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty2.ts (3 errors) ==== + module M { + var Symbol; + + export class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + (new C)[Symbol.iterator]; + } + + (new M.C)[Symbol.iterator]; + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty2.js b/tests/baselines/reference/ES5SymbolProperty2.js new file mode 100644 index 00000000000..a1efd6ae7ba --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty2.js @@ -0,0 +1,27 @@ +//// [ES5SymbolProperty2.ts] +module M { + var Symbol; + + export class C { + [Symbol.iterator]() { } + } + (new C)[Symbol.iterator]; +} + +(new M.C)[Symbol.iterator]; + +//// [ES5SymbolProperty2.js] +var M; +(function (M) { + var Symbol; + var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { + }; + return C; + })(); + M.C = C; + (new C)[Symbol.iterator]; +})(M || (M = {})); +(new M.C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty3.errors.txt b/tests/baselines/reference/ES5SymbolProperty3.errors.txt new file mode 100644 index 00000000000..3ec09f889f5 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty3.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty3.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/Symbols/ES5SymbolProperty3.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty3.ts (2 errors) ==== + var Symbol; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + + (new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty3.js b/tests/baselines/reference/ES5SymbolProperty3.js new file mode 100644 index 00000000000..7ef892cb3c4 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty3.js @@ -0,0 +1,19 @@ +//// [ES5SymbolProperty3.ts] +var Symbol; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty3.js] +var Symbol; +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { + }; + return C; +})(); +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty4.errors.txt b/tests/baselines/reference/ES5SymbolProperty4.errors.txt new file mode 100644 index 00000000000..045647e0313 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty4.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty4.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/Symbols/ES5SymbolProperty4.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty4.ts (2 errors) ==== + var Symbol: { iterator: string }; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + + (new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty4.js b/tests/baselines/reference/ES5SymbolProperty4.js new file mode 100644 index 00000000000..d4022066bb8 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty4.js @@ -0,0 +1,19 @@ +//// [ES5SymbolProperty4.ts] +var Symbol: { iterator: string }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty4.js] +var Symbol; +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { + }; + return C; +})(); +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty5.errors.txt b/tests/baselines/reference/ES5SymbolProperty5.errors.txt new file mode 100644 index 00000000000..7a94d1c4cda --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty5.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty5.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/Symbols/ES5SymbolProperty5.ts(7,1): error TS2346: Supplied parameters do not match any signature of call target. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty5.ts (2 errors) ==== + var Symbol: { iterator: symbol }; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + } + + (new C)[Symbol.iterator](0) // Should error + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2346: Supplied parameters do not match any signature of call target. \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty5.js b/tests/baselines/reference/ES5SymbolProperty5.js new file mode 100644 index 00000000000..c433b0ab443 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty5.js @@ -0,0 +1,19 @@ +//// [ES5SymbolProperty5.ts] +var Symbol: { iterator: symbol }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator](0) // Should error + +//// [ES5SymbolProperty5.js] +var Symbol; +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { + }; + return C; +})(); +(new C)[Symbol.iterator](0); // Should error diff --git a/tests/baselines/reference/ES5SymbolProperty6.errors.txt b/tests/baselines/reference/ES5SymbolProperty6.errors.txt new file mode 100644 index 00000000000..c86c13da05b --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty6.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(2,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(2,6): error TS2304: Cannot find name 'Symbol'. +tests/cases/conformance/Symbols/ES5SymbolProperty6.ts(5,9): error TS2304: Cannot find name 'Symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty6.ts (3 errors) ==== + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. + } + + (new C)[Symbol.iterator] + ~~~~~~ +!!! error TS2304: Cannot find name 'Symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty6.js b/tests/baselines/reference/ES5SymbolProperty6.js new file mode 100644 index 00000000000..949ce722aa7 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty6.js @@ -0,0 +1,16 @@ +//// [ES5SymbolProperty6.ts] +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty6.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { + }; + return C; +})(); +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty7.errors.txt b/tests/baselines/reference/ES5SymbolProperty7.errors.txt new file mode 100644 index 00000000000..4b35618ad52 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty7.errors.txt @@ -0,0 +1,16 @@ +tests/cases/conformance/Symbols/ES5SymbolProperty7.ts(4,5): error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/Symbols/ES5SymbolProperty7.ts(4,6): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/Symbols/ES5SymbolProperty7.ts (2 errors) ==== + var Symbol: { iterator: any }; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~~~ +!!! error TS1167: Computed property names are only available when targeting ECMAScript 6 and higher. + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + + (new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/baselines/reference/ES5SymbolProperty7.js b/tests/baselines/reference/ES5SymbolProperty7.js new file mode 100644 index 00000000000..f98e792e8cd --- /dev/null +++ b/tests/baselines/reference/ES5SymbolProperty7.js @@ -0,0 +1,19 @@ +//// [ES5SymbolProperty7.ts] +var Symbol: { iterator: any }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] + +//// [ES5SymbolProperty7.js] +var Symbol; +var C = (function () { + function C() { + } + C.prototype[Symbol.iterator] = function () { + }; + return C; +})(); +(new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolType1.js b/tests/baselines/reference/ES5SymbolType1.js new file mode 100644 index 00000000000..5b555c19e7c --- /dev/null +++ b/tests/baselines/reference/ES5SymbolType1.js @@ -0,0 +1,7 @@ +//// [ES5SymbolType1.ts] +var s: symbol; +s.toString(); + +//// [ES5SymbolType1.js] +var s; +s.toString(); diff --git a/tests/baselines/reference/ES5SymbolType1.types b/tests/baselines/reference/ES5SymbolType1.types new file mode 100644 index 00000000000..79d93902fd6 --- /dev/null +++ b/tests/baselines/reference/ES5SymbolType1.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/Symbols/ES5SymbolType1.ts === +var s: symbol; +>s : symbol + +s.toString(); +>s.toString() : string +>s.toString : () => string +>s : symbol +>toString : () => string + diff --git a/tests/baselines/reference/symbolProperty48.errors.txt b/tests/baselines/reference/symbolProperty48.errors.txt new file mode 100644 index 00000000000..8d52fa48a07 --- /dev/null +++ b/tests/baselines/reference/symbolProperty48.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty48.ts(5,10): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty48.ts (1 errors) ==== + module M { + var Symbol; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty49.errors.txt b/tests/baselines/reference/symbolProperty49.errors.txt new file mode 100644 index 00000000000..8a15b359ee7 --- /dev/null +++ b/tests/baselines/reference/symbolProperty49.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty49.ts(5,10): error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty49.ts (1 errors) ==== + module M { + export var Symbol; + + class C { + [Symbol.iterator]() { } + ~~~~~~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.iterator' must be of type 'symbol'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty58.errors.txt b/tests/baselines/reference/symbolProperty58.errors.txt new file mode 100644 index 00000000000..5f8b117a74c --- /dev/null +++ b/tests/baselines/reference/symbolProperty58.errors.txt @@ -0,0 +1,13 @@ +tests/cases/conformance/es6/Symbols/symbolProperty58.ts(6,6): error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty58.ts (1 errors) ==== + interface SymbolConstructor { + foo: string; + } + + var obj = { + [Symbol.foo]: 0 + ~~~~~~~~~~ +!!! error TS2471: A computed property name of the form 'Symbol.foo' must be of type 'symbol'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty58.js b/tests/baselines/reference/symbolProperty58.js new file mode 100644 index 00000000000..94b22156b1a --- /dev/null +++ b/tests/baselines/reference/symbolProperty58.js @@ -0,0 +1,13 @@ +//// [symbolProperty58.ts] +interface SymbolConstructor { + foo: string; +} + +var obj = { + [Symbol.foo]: 0 +} + +//// [symbolProperty58.js] +var obj = { + [Symbol.foo]: 0 +}; diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty1.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty1.ts new file mode 100644 index 00000000000..8a9276416c5 --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty1.ts @@ -0,0 +1,11 @@ +//@target: ES5 +interface SymbolConstructor { + foo: string; +} +var Symbol: SymbolConstructor; + +var obj = { + [Symbol.foo]: 0 +} + +obj[Symbol.foo]; \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty2.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty2.ts new file mode 100644 index 00000000000..07c95eb27d9 --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty2.ts @@ -0,0 +1,11 @@ +//@target: ES5 +module M { + var Symbol; + + export class C { + [Symbol.iterator]() { } + } + (new C)[Symbol.iterator]; +} + +(new M.C)[Symbol.iterator]; \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty3.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty3.ts new file mode 100644 index 00000000000..262e47557f8 --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty3.ts @@ -0,0 +1,8 @@ +//@target: ES5 +var Symbol; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty4.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty4.ts new file mode 100644 index 00000000000..2b14e64a33c --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty4.ts @@ -0,0 +1,8 @@ +//@target: ES5 +var Symbol: { iterator: string }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty5.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty5.ts new file mode 100644 index 00000000000..ec46ddad21d --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty5.ts @@ -0,0 +1,8 @@ +//@target: ES5 +var Symbol: { iterator: symbol }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator](0) // Should error \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty6.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty6.ts new file mode 100644 index 00000000000..59b7d2291aa --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty6.ts @@ -0,0 +1,6 @@ +//@target: ES5 +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolProperty7.ts b/tests/cases/conformance/Symbols/ES5SymbolProperty7.ts new file mode 100644 index 00000000000..766b86f9b5d --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolProperty7.ts @@ -0,0 +1,8 @@ +//@target: ES5 +var Symbol: { iterator: any }; + +class C { + [Symbol.iterator]() { } +} + +(new C)[Symbol.iterator] \ No newline at end of file diff --git a/tests/cases/conformance/Symbols/ES5SymbolType1.ts b/tests/cases/conformance/Symbols/ES5SymbolType1.ts new file mode 100644 index 00000000000..bfd5592f8e4 --- /dev/null +++ b/tests/cases/conformance/Symbols/ES5SymbolType1.ts @@ -0,0 +1,3 @@ +//@target: ES5 +var s: symbol; +s.toString(); \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty58.ts b/tests/cases/conformance/es6/Symbols/symbolProperty58.ts new file mode 100644 index 00000000000..48cc6eb90f3 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty58.ts @@ -0,0 +1,8 @@ +//@target: ES6 +interface SymbolConstructor { + foo: string; +} + +var obj = { + [Symbol.foo]: 0 +} \ No newline at end of file From 35604426c885f3884ddee31bc198557bc93e4413 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Fri, 6 Feb 2015 20:49:58 -0800 Subject: [PATCH 037/162] Declaration emit for symbol properties --- src/compiler/emitter.ts | 27 +++++++------ src/compiler/utilities.ts | 15 ++++++++ .../reference/symbolDeclarationEmit1.js | 17 +++++++++ .../reference/symbolDeclarationEmit1.types | 9 +++++ .../reference/symbolDeclarationEmit10.js | 20 ++++++++++ .../reference/symbolDeclarationEmit10.types | 16 ++++++++ .../reference/symbolDeclarationEmit11.js | 34 +++++++++++++++++ .../reference/symbolDeclarationEmit11.types | 25 ++++++++++++ .../symbolDeclarationEmit12.errors.txt | 27 +++++++++++++ .../reference/symbolDeclarationEmit12.js | 38 +++++++++++++++++++ .../reference/symbolDeclarationEmit13.js | 32 ++++++++++++++++ .../reference/symbolDeclarationEmit13.types | 15 ++++++++ .../reference/symbolDeclarationEmit14.js | 33 ++++++++++++++++ .../reference/symbolDeclarationEmit14.types | 14 +++++++ .../reference/symbolDeclarationEmit2.js | 18 +++++++++ .../reference/symbolDeclarationEmit2.types | 9 +++++ .../reference/symbolDeclarationEmit3.js | 22 +++++++++++ .../reference/symbolDeclarationEmit3.types | 22 +++++++++++ .../reference/symbolDeclarationEmit4.js | 27 +++++++++++++ .../reference/symbolDeclarationEmit4.types | 15 ++++++++ .../reference/symbolDeclarationEmit5.js | 12 ++++++ .../reference/symbolDeclarationEmit5.types | 9 +++++ .../reference/symbolDeclarationEmit6.js | 12 ++++++ .../reference/symbolDeclarationEmit6.types | 9 +++++ .../reference/symbolDeclarationEmit7.js | 13 +++++++ .../reference/symbolDeclarationEmit7.types | 9 +++++ .../reference/symbolDeclarationEmit8.js | 15 ++++++++ .../reference/symbolDeclarationEmit8.types | 10 +++++ .../reference/symbolDeclarationEmit9.js | 16 ++++++++ .../reference/symbolDeclarationEmit9.types | 10 +++++ tests/baselines/reference/symbolProperty44.js | 7 ---- tests/baselines/reference/symbolProperty46.js | 4 -- tests/baselines/reference/symbolProperty47.js | 4 -- .../es6/Symbols/symbolDeclarationEmit1.ts | 5 +++ .../es6/Symbols/symbolDeclarationEmit10.ts | 6 +++ .../es6/Symbols/symbolDeclarationEmit11.ts | 8 ++++ .../es6/Symbols/symbolDeclarationEmit12.ts | 14 +++++++ .../es6/Symbols/symbolDeclarationEmit13.ts | 6 +++ .../es6/Symbols/symbolDeclarationEmit14.ts | 6 +++ .../es6/Symbols/symbolDeclarationEmit2.ts | 5 +++ .../es6/Symbols/symbolDeclarationEmit3.ts | 7 ++++ .../es6/Symbols/symbolDeclarationEmit4.ts | 6 +++ .../es6/Symbols/symbolDeclarationEmit5.ts | 5 +++ .../es6/Symbols/symbolDeclarationEmit6.ts | 5 +++ .../es6/Symbols/symbolDeclarationEmit7.ts | 5 +++ .../es6/Symbols/symbolDeclarationEmit8.ts | 5 +++ .../es6/Symbols/symbolDeclarationEmit9.ts | 5 +++ 47 files changed, 626 insertions(+), 27 deletions(-) create mode 100644 tests/baselines/reference/symbolDeclarationEmit1.js create mode 100644 tests/baselines/reference/symbolDeclarationEmit1.types create mode 100644 tests/baselines/reference/symbolDeclarationEmit10.js create mode 100644 tests/baselines/reference/symbolDeclarationEmit10.types create mode 100644 tests/baselines/reference/symbolDeclarationEmit11.js create mode 100644 tests/baselines/reference/symbolDeclarationEmit11.types create mode 100644 tests/baselines/reference/symbolDeclarationEmit12.errors.txt create mode 100644 tests/baselines/reference/symbolDeclarationEmit12.js create mode 100644 tests/baselines/reference/symbolDeclarationEmit13.js create mode 100644 tests/baselines/reference/symbolDeclarationEmit13.types create mode 100644 tests/baselines/reference/symbolDeclarationEmit14.js create mode 100644 tests/baselines/reference/symbolDeclarationEmit14.types create mode 100644 tests/baselines/reference/symbolDeclarationEmit2.js create mode 100644 tests/baselines/reference/symbolDeclarationEmit2.types create mode 100644 tests/baselines/reference/symbolDeclarationEmit3.js create mode 100644 tests/baselines/reference/symbolDeclarationEmit3.types create mode 100644 tests/baselines/reference/symbolDeclarationEmit4.js create mode 100644 tests/baselines/reference/symbolDeclarationEmit4.types create mode 100644 tests/baselines/reference/symbolDeclarationEmit5.js create mode 100644 tests/baselines/reference/symbolDeclarationEmit5.types create mode 100644 tests/baselines/reference/symbolDeclarationEmit6.js create mode 100644 tests/baselines/reference/symbolDeclarationEmit6.types create mode 100644 tests/baselines/reference/symbolDeclarationEmit7.js create mode 100644 tests/baselines/reference/symbolDeclarationEmit7.types create mode 100644 tests/baselines/reference/symbolDeclarationEmit8.js create mode 100644 tests/baselines/reference/symbolDeclarationEmit8.types create mode 100644 tests/baselines/reference/symbolDeclarationEmit9.js create mode 100644 tests/baselines/reference/symbolDeclarationEmit9.types create mode 100644 tests/cases/conformance/es6/Symbols/symbolDeclarationEmit1.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolDeclarationEmit10.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolDeclarationEmit11.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolDeclarationEmit13.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolDeclarationEmit14.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolDeclarationEmit2.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolDeclarationEmit3.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolDeclarationEmit4.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolDeclarationEmit5.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolDeclarationEmit6.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolDeclarationEmit7.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolDeclarationEmit8.ts create mode 100644 tests/cases/conformance/es6/Symbols/symbolDeclarationEmit9.ts diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 4d7c7f9d3b0..63099bf2c60 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -275,7 +275,7 @@ module ts { var firstAccessor: AccessorDeclaration; var getAccessor: AccessorDeclaration; var setAccessor: AccessorDeclaration; - if (accessor.name.kind === SyntaxKind.ComputedPropertyName) { + if (hasDynamicName(accessor)) { firstAccessor = accessor; if (accessor.kind === SyntaxKind.GetAccessor) { getAccessor = accessor; @@ -289,19 +289,22 @@ module ts { } else { forEach(node.members,(member: Declaration) => { - if ((member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) && - (member.name).text === (accessor.name).text && - (member.flags & NodeFlags.Static) === (accessor.flags & NodeFlags.Static)) { - if (!firstAccessor) { - firstAccessor = member; - } + if ((member.kind === SyntaxKind.GetAccessor || member.kind === SyntaxKind.SetAccessor) + && (member.flags & NodeFlags.Static) === (accessor.flags & NodeFlags.Static)) { + var memberName = getPropertyNameForPropertyNameNode(member.name); + var accessorName = getPropertyNameForPropertyNameNode(accessor.name); + if (memberName === accessorName) { + if (!firstAccessor) { + firstAccessor = member; + } - if (member.kind === SyntaxKind.GetAccessor && !getAccessor) { - getAccessor = member; - } + if (member.kind === SyntaxKind.GetAccessor && !getAccessor) { + getAccessor = member; + } - if (member.kind === SyntaxKind.SetAccessor && !setAccessor) { - setAccessor = member; + if (member.kind === SyntaxKind.SetAccessor && !setAccessor) { + setAccessor = member; + } } } }); diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 8830dacc374..16d2303a16e 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -852,6 +852,21 @@ module ts { return node.kind === SyntaxKind.PropertyAccessExpression && isESSymbolIdentifier((node).expression); } + export function getPropertyNameForPropertyNameNode(name: DeclarationName): string { + if (name.kind === SyntaxKind.Identifier || name.kind === SyntaxKind.StringLiteral || name.kind === SyntaxKind.NumericLiteral) { + return (name).text; + } + if (name.kind === SyntaxKind.ComputedPropertyName) { + var nameExpression = (name).expression; + if (isWellKnownSymbolSyntactically(nameExpression)) { + var rightHandSideName = (nameExpression).name.text; + return getPropertyNameForKnownSymbolName(rightHandSideName); + } + } + + return undefined; + } + export function getPropertyNameForKnownSymbolName(symbolName: string): string { return "__@" + symbolName; } diff --git a/tests/baselines/reference/symbolDeclarationEmit1.js b/tests/baselines/reference/symbolDeclarationEmit1.js new file mode 100644 index 00000000000..16d208db5eb --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit1.js @@ -0,0 +1,17 @@ +//// [symbolDeclarationEmit1.ts] +class C { + [Symbol.isRegExp]: number; +} + +//// [symbolDeclarationEmit1.js] +var C = (function () { + function C() { + } + return C; +})(); + + +//// [symbolDeclarationEmit1.d.ts] +declare class C { + [Symbol.isRegExp]: number; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit1.types b/tests/baselines/reference/symbolDeclarationEmit1.types new file mode 100644 index 00000000000..e35bbfe8861 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit1.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit1.ts === +class C { +>C : C + + [Symbol.isRegExp]: number; +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit10.js b/tests/baselines/reference/symbolDeclarationEmit10.js new file mode 100644 index 00000000000..7ace6617db5 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit10.js @@ -0,0 +1,20 @@ +//// [symbolDeclarationEmit10.ts] +var obj = { + get [Symbol.isConcatSpreadable]() { return '' }, + set [Symbol.isConcatSpreadable](x) { } +} + +//// [symbolDeclarationEmit10.js] +var obj = { + get [Symbol.isConcatSpreadable]() { + return ''; + }, + set [Symbol.isConcatSpreadable](x) { + } +}; + + +//// [symbolDeclarationEmit10.d.ts] +declare var obj: { + [Symbol.isConcatSpreadable]: string; +}; diff --git a/tests/baselines/reference/symbolDeclarationEmit10.types b/tests/baselines/reference/symbolDeclarationEmit10.types new file mode 100644 index 00000000000..194893ef00f --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit10.types @@ -0,0 +1,16 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit10.ts === +var obj = { +>obj : { [Symbol.isConcatSpreadable]: string; } +>{ get [Symbol.isConcatSpreadable]() { return '' }, set [Symbol.isConcatSpreadable](x) { }} : { [Symbol.isConcatSpreadable]: string; } + + get [Symbol.isConcatSpreadable]() { return '' }, +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol + + set [Symbol.isConcatSpreadable](x) { } +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +>x : string +} diff --git a/tests/baselines/reference/symbolDeclarationEmit11.js b/tests/baselines/reference/symbolDeclarationEmit11.js new file mode 100644 index 00000000000..c9c819eefa2 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit11.js @@ -0,0 +1,34 @@ +//// [symbolDeclarationEmit11.ts] +class C { + static [Symbol.iterator] = 0; + static [Symbol.toPrimitive]() { } + static get [Symbol.isRegExp]() { return ""; } + static set [Symbol.isRegExp](x) { } +} + +//// [symbolDeclarationEmit11.js] +var C = (function () { + function C() { + } + C[Symbol.toPrimitive] = function () { + }; + Object.defineProperty(C, Symbol.isRegExp, { + get: function () { + return ""; + }, + set: function (x) { + }, + enumerable: true, + configurable: true + }); + C[Symbol.iterator] = 0; + return C; +})(); + + +//// [symbolDeclarationEmit11.d.ts] +declare class C { + static [Symbol.iterator]: number; + static [Symbol.toPrimitive](): void; + static [Symbol.isRegExp]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit11.types b/tests/baselines/reference/symbolDeclarationEmit11.types new file mode 100644 index 00000000000..1bf58f205d1 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit11.types @@ -0,0 +1,25 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit11.ts === +class C { +>C : C + + static [Symbol.iterator] = 0; +>Symbol.iterator : symbol +>Symbol : SymbolConstructor +>iterator : symbol + + static [Symbol.toPrimitive]() { } +>Symbol.toPrimitive : symbol +>Symbol : SymbolConstructor +>toPrimitive : symbol + + static get [Symbol.isRegExp]() { return ""; } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + static set [Symbol.isRegExp](x) { } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : string +} diff --git a/tests/baselines/reference/symbolDeclarationEmit12.errors.txt b/tests/baselines/reference/symbolDeclarationEmit12.errors.txt new file mode 100644 index 00000000000..0e2f6b828f6 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit12.errors.txt @@ -0,0 +1,27 @@ +tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts(4,28): error TS4031: Public property '[Symbol.iterator]' of exported class has or is using private name 'I'. +tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts(5,33): error TS4073: Parameter 'x' of public method from exported class has or is using private name 'I'. +tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts(6,40): error TS4055: Return type of public method from exported class has or is using private name 'I'. +tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts(10,34): error TS4037: Parameter '[Symbol.isRegExp]' of public property setter from exported class has or is using private name 'I'. + + +==== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts (4 errors) ==== + module M { + interface I { } + export class C { + [Symbol.iterator]: I; + ~ +!!! error TS4031: Public property '[Symbol.iterator]' of exported class has or is using private name 'I'. + [Symbol.toPrimitive](x: I) { } + ~ +!!! error TS4073: Parameter 'x' of public method from exported class has or is using private name 'I'. + [Symbol.isConcatSpreadable](): I { + ~ +!!! error TS4055: Return type of public method from exported class has or is using private name 'I'. + return undefined + } + get [Symbol.isRegExp]() { return undefined; } + set [Symbol.isRegExp](x: I) { } + ~ +!!! error TS4037: Parameter '[Symbol.isRegExp]' of public property setter from exported class has or is using private name 'I'. + } + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolDeclarationEmit12.js b/tests/baselines/reference/symbolDeclarationEmit12.js new file mode 100644 index 00000000000..49ff8b35976 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit12.js @@ -0,0 +1,38 @@ +//// [symbolDeclarationEmit12.ts] +module M { + interface I { } + export class C { + [Symbol.iterator]: I; + [Symbol.toPrimitive](x: I) { } + [Symbol.isConcatSpreadable](): I { + return undefined + } + get [Symbol.isRegExp]() { return undefined; } + set [Symbol.isRegExp](x: I) { } + } +} + +//// [symbolDeclarationEmit12.js] +var M; +(function (M) { + var C = (function () { + function C() { + } + C.prototype[Symbol.toPrimitive] = function (x) { + }; + C.prototype[Symbol.isConcatSpreadable] = function () { + return undefined; + }; + Object.defineProperty(C.prototype, Symbol.isRegExp, { + get: function () { + return undefined; + }, + set: function (x) { + }, + enumerable: true, + configurable: true + }); + return C; + })(); + M.C = C; +})(M || (M = {})); diff --git a/tests/baselines/reference/symbolDeclarationEmit13.js b/tests/baselines/reference/symbolDeclarationEmit13.js new file mode 100644 index 00000000000..51b6edcece5 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit13.js @@ -0,0 +1,32 @@ +//// [symbolDeclarationEmit13.ts] +class C { + get [Symbol.isRegExp]() { return ""; } + set [Symbol.toStringTag](x) { } +} + +//// [symbolDeclarationEmit13.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.isRegExp, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, Symbol.toStringTag, { + set: function (x) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [symbolDeclarationEmit13.d.ts] +declare class C { + [Symbol.isRegExp]: string; + [Symbol.toStringTag]: any; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit13.types b/tests/baselines/reference/symbolDeclarationEmit13.types new file mode 100644 index 00000000000..6579e49c426 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit13.types @@ -0,0 +1,15 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit13.ts === +class C { +>C : C + + get [Symbol.isRegExp]() { return ""; } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + set [Symbol.toStringTag](x) { } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +>x : any +} diff --git a/tests/baselines/reference/symbolDeclarationEmit14.js b/tests/baselines/reference/symbolDeclarationEmit14.js new file mode 100644 index 00000000000..d81bc329927 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit14.js @@ -0,0 +1,33 @@ +//// [symbolDeclarationEmit14.ts] +class C { + get [Symbol.isRegExp]() { return ""; } + get [Symbol.toStringTag]() { return ""; } +} + +//// [symbolDeclarationEmit14.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.isRegExp, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(C.prototype, Symbol.toStringTag, { + get: function () { + return ""; + }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [symbolDeclarationEmit14.d.ts] +declare class C { + [Symbol.isRegExp]: string; + [Symbol.toStringTag]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit14.types b/tests/baselines/reference/symbolDeclarationEmit14.types new file mode 100644 index 00000000000..f3e7c32047c --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit14.types @@ -0,0 +1,14 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit14.ts === +class C { +>C : C + + get [Symbol.isRegExp]() { return ""; } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + get [Symbol.toStringTag]() { return ""; } +>Symbol.toStringTag : symbol +>Symbol : SymbolConstructor +>toStringTag : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit2.js b/tests/baselines/reference/symbolDeclarationEmit2.js new file mode 100644 index 00000000000..2112f9e7748 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit2.js @@ -0,0 +1,18 @@ +//// [symbolDeclarationEmit2.ts] +class C { + [Symbol.isRegExp] = ""; +} + +//// [symbolDeclarationEmit2.js] +var C = (function () { + function C() { + this[Symbol.isRegExp] = ""; + } + return C; +})(); + + +//// [symbolDeclarationEmit2.d.ts] +declare class C { + [Symbol.isRegExp]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit2.types b/tests/baselines/reference/symbolDeclarationEmit2.types new file mode 100644 index 00000000000..4844b2b8f84 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit2.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit2.ts === +class C { +>C : C + + [Symbol.isRegExp] = ""; +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit3.js b/tests/baselines/reference/symbolDeclarationEmit3.js new file mode 100644 index 00000000000..6d06c09bd69 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit3.js @@ -0,0 +1,22 @@ +//// [symbolDeclarationEmit3.ts] +class C { + [Symbol.isRegExp](x: number); + [Symbol.isRegExp](x: string); + [Symbol.isRegExp](x: any) { } +} + +//// [symbolDeclarationEmit3.js] +var C = (function () { + function C() { + } + C.prototype[Symbol.isRegExp] = function (x) { + }; + return C; +})(); + + +//// [symbolDeclarationEmit3.d.ts] +declare class C { + [Symbol.isRegExp](x: number): any; + [Symbol.isRegExp](x: string): any; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit3.types b/tests/baselines/reference/symbolDeclarationEmit3.types new file mode 100644 index 00000000000..0ea55d876b3 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit3.types @@ -0,0 +1,22 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit3.ts === +class C { +>C : C + + [Symbol.isRegExp](x: number); +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : number + + [Symbol.isRegExp](x: string); +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : string + + [Symbol.isRegExp](x: any) { } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : any +} diff --git a/tests/baselines/reference/symbolDeclarationEmit4.js b/tests/baselines/reference/symbolDeclarationEmit4.js new file mode 100644 index 00000000000..cd3fc53a5bb --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit4.js @@ -0,0 +1,27 @@ +//// [symbolDeclarationEmit4.ts] +class C { + get [Symbol.isRegExp]() { return ""; } + set [Symbol.isRegExp](x) { } +} + +//// [symbolDeclarationEmit4.js] +var C = (function () { + function C() { + } + Object.defineProperty(C.prototype, Symbol.isRegExp, { + get: function () { + return ""; + }, + set: function (x) { + }, + enumerable: true, + configurable: true + }); + return C; +})(); + + +//// [symbolDeclarationEmit4.d.ts] +declare class C { + [Symbol.isRegExp]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit4.types b/tests/baselines/reference/symbolDeclarationEmit4.types new file mode 100644 index 00000000000..aeb24fc146c --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit4.types @@ -0,0 +1,15 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit4.ts === +class C { +>C : C + + get [Symbol.isRegExp]() { return ""; } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol + + set [Symbol.isRegExp](x) { } +>Symbol.isRegExp : symbol +>Symbol : SymbolConstructor +>isRegExp : symbol +>x : string +} diff --git a/tests/baselines/reference/symbolDeclarationEmit5.js b/tests/baselines/reference/symbolDeclarationEmit5.js new file mode 100644 index 00000000000..ba1ef9a137c --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit5.js @@ -0,0 +1,12 @@ +//// [symbolDeclarationEmit5.ts] +interface I { + [Symbol.isConcatSpreadable](): string; +} + +//// [symbolDeclarationEmit5.js] + + +//// [symbolDeclarationEmit5.d.ts] +interface I { + [Symbol.isConcatSpreadable](): string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit5.types b/tests/baselines/reference/symbolDeclarationEmit5.types new file mode 100644 index 00000000000..557483cf636 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit5.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit5.ts === +interface I { +>I : I + + [Symbol.isConcatSpreadable](): string; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit6.js b/tests/baselines/reference/symbolDeclarationEmit6.js new file mode 100644 index 00000000000..2aac05bb6ea --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit6.js @@ -0,0 +1,12 @@ +//// [symbolDeclarationEmit6.ts] +interface I { + [Symbol.isConcatSpreadable]: string; +} + +//// [symbolDeclarationEmit6.js] + + +//// [symbolDeclarationEmit6.d.ts] +interface I { + [Symbol.isConcatSpreadable]: string; +} diff --git a/tests/baselines/reference/symbolDeclarationEmit6.types b/tests/baselines/reference/symbolDeclarationEmit6.types new file mode 100644 index 00000000000..714467aba12 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit6.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit6.ts === +interface I { +>I : I + + [Symbol.isConcatSpreadable]: string; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit7.js b/tests/baselines/reference/symbolDeclarationEmit7.js new file mode 100644 index 00000000000..c53c2110d11 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit7.js @@ -0,0 +1,13 @@ +//// [symbolDeclarationEmit7.ts] +var obj: { + [Symbol.isConcatSpreadable]: string; +} + +//// [symbolDeclarationEmit7.js] +var obj; + + +//// [symbolDeclarationEmit7.d.ts] +declare var obj: { + [Symbol.isConcatSpreadable]: string; +}; diff --git a/tests/baselines/reference/symbolDeclarationEmit7.types b/tests/baselines/reference/symbolDeclarationEmit7.types new file mode 100644 index 00000000000..dff109e8127 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit7.types @@ -0,0 +1,9 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit7.ts === +var obj: { +>obj : { [Symbol.isConcatSpreadable]: string; } + + [Symbol.isConcatSpreadable]: string; +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit8.js b/tests/baselines/reference/symbolDeclarationEmit8.js new file mode 100644 index 00000000000..428d0a0d60c --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit8.js @@ -0,0 +1,15 @@ +//// [symbolDeclarationEmit8.ts] +var obj = { + [Symbol.isConcatSpreadable]: 0 +} + +//// [symbolDeclarationEmit8.js] +var obj = { + [Symbol.isConcatSpreadable]: 0 +}; + + +//// [symbolDeclarationEmit8.d.ts] +declare var obj: { + [Symbol.isConcatSpreadable]: number; +}; diff --git a/tests/baselines/reference/symbolDeclarationEmit8.types b/tests/baselines/reference/symbolDeclarationEmit8.types new file mode 100644 index 00000000000..75d39748e22 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit8.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit8.ts === +var obj = { +>obj : { [Symbol.isConcatSpreadable]: number; } +>{ [Symbol.isConcatSpreadable]: 0} : { [Symbol.isConcatSpreadable]: number; } + + [Symbol.isConcatSpreadable]: 0 +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolDeclarationEmit9.js b/tests/baselines/reference/symbolDeclarationEmit9.js new file mode 100644 index 00000000000..8cdb7173144 --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit9.js @@ -0,0 +1,16 @@ +//// [symbolDeclarationEmit9.ts] +var obj = { + [Symbol.isConcatSpreadable]() { } +} + +//// [symbolDeclarationEmit9.js] +var obj = { + [Symbol.isConcatSpreadable]() { + } +}; + + +//// [symbolDeclarationEmit9.d.ts] +declare var obj: { + [Symbol.isConcatSpreadable](): void; +}; diff --git a/tests/baselines/reference/symbolDeclarationEmit9.types b/tests/baselines/reference/symbolDeclarationEmit9.types new file mode 100644 index 00000000000..a7a6b459fcc --- /dev/null +++ b/tests/baselines/reference/symbolDeclarationEmit9.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/es6/Symbols/symbolDeclarationEmit9.ts === +var obj = { +>obj : { [Symbol.isConcatSpreadable](): void; } +>{ [Symbol.isConcatSpreadable]() { }} : { [Symbol.isConcatSpreadable](): void; } + + [Symbol.isConcatSpreadable]() { } +>Symbol.isConcatSpreadable : symbol +>Symbol : SymbolConstructor +>isConcatSpreadable : symbol +} diff --git a/tests/baselines/reference/symbolProperty44.js b/tests/baselines/reference/symbolProperty44.js index ff3dc81a6fa..d4824e79318 100644 --- a/tests/baselines/reference/symbolProperty44.js +++ b/tests/baselines/reference/symbolProperty44.js @@ -19,12 +19,5 @@ var C = (function () { enumerable: true, configurable: true }); - Object.defineProperty(C.prototype, Symbol.hasInstance, { - get: function () { - return ""; - }, - enumerable: true, - configurable: true - }); return C; })(); diff --git a/tests/baselines/reference/symbolProperty46.js b/tests/baselines/reference/symbolProperty46.js index eb21e584941..255fbac0809 100644 --- a/tests/baselines/reference/symbolProperty46.js +++ b/tests/baselines/reference/symbolProperty46.js @@ -19,10 +19,6 @@ var C = (function () { get: function () { return ""; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(C.prototype, Symbol.hasInstance, { // Should take a string set: function (x) { }, diff --git a/tests/baselines/reference/symbolProperty47.js b/tests/baselines/reference/symbolProperty47.js index 9dbd03e90a1..92429c720c1 100644 --- a/tests/baselines/reference/symbolProperty47.js +++ b/tests/baselines/reference/symbolProperty47.js @@ -19,10 +19,6 @@ var C = (function () { get: function () { return ""; }, - enumerable: true, - configurable: true - }); - Object.defineProperty(C.prototype, Symbol.hasInstance, { // Should take a string set: function (x) { }, diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit1.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit1.ts new file mode 100644 index 00000000000..b99806a1eee --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit1.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +class C { + [Symbol.isRegExp]: number; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit10.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit10.ts new file mode 100644 index 00000000000..cf3496c2553 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit10.ts @@ -0,0 +1,6 @@ +//@target: ES6 +//@declaration: true +var obj = { + get [Symbol.isConcatSpreadable]() { return '' }, + set [Symbol.isConcatSpreadable](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit11.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit11.ts new file mode 100644 index 00000000000..4b88ab55980 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit11.ts @@ -0,0 +1,8 @@ +//@target: ES6 +//@declaration: true +class C { + static [Symbol.iterator] = 0; + static [Symbol.toPrimitive]() { } + static get [Symbol.isRegExp]() { return ""; } + static set [Symbol.isRegExp](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts new file mode 100644 index 00000000000..c18b470d35d --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit12.ts @@ -0,0 +1,14 @@ +//@target: ES6 +//@declaration: true +module M { + interface I { } + export class C { + [Symbol.iterator]: I; + [Symbol.toPrimitive](x: I) { } + [Symbol.isConcatSpreadable](): I { + return undefined + } + get [Symbol.isRegExp]() { return undefined; } + set [Symbol.isRegExp](x: I) { } + } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit13.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit13.ts new file mode 100644 index 00000000000..18568e853e8 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit13.ts @@ -0,0 +1,6 @@ +//@target: ES6 +//@declaration: true +class C { + get [Symbol.isRegExp]() { return ""; } + set [Symbol.toStringTag](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit14.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit14.ts new file mode 100644 index 00000000000..312476628b8 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit14.ts @@ -0,0 +1,6 @@ +//@target: ES6 +//@declaration: true +class C { + get [Symbol.isRegExp]() { return ""; } + get [Symbol.toStringTag]() { return ""; } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit2.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit2.ts new file mode 100644 index 00000000000..420e1c84906 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit2.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +class C { + [Symbol.isRegExp] = ""; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit3.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit3.ts new file mode 100644 index 00000000000..b70ee3c15ac --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit3.ts @@ -0,0 +1,7 @@ +//@target: ES6 +//@declaration: true +class C { + [Symbol.isRegExp](x: number); + [Symbol.isRegExp](x: string); + [Symbol.isRegExp](x: any) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit4.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit4.ts new file mode 100644 index 00000000000..dde80577fa4 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit4.ts @@ -0,0 +1,6 @@ +//@target: ES6 +//@declaration: true +class C { + get [Symbol.isRegExp]() { return ""; } + set [Symbol.isRegExp](x) { } +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit5.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit5.ts new file mode 100644 index 00000000000..e5acf9c9f7c --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit5.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +interface I { + [Symbol.isConcatSpreadable](): string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit6.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit6.ts new file mode 100644 index 00000000000..1d0059f954f --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit6.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +interface I { + [Symbol.isConcatSpreadable]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit7.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit7.ts new file mode 100644 index 00000000000..01f91681b15 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit7.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +var obj: { + [Symbol.isConcatSpreadable]: string; +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit8.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit8.ts new file mode 100644 index 00000000000..2682a4940f9 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit8.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +var obj = { + [Symbol.isConcatSpreadable]: 0 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit9.ts b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit9.ts new file mode 100644 index 00000000000..2c35a553600 --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolDeclarationEmit9.ts @@ -0,0 +1,5 @@ +//@target: ES6 +//@declaration: true +var obj = { + [Symbol.isConcatSpreadable]() { } +} \ No newline at end of file From 2f3c32afd659b3edda1b24599f1abc1b1b125d18 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Fri, 6 Feb 2015 21:22:44 -0800 Subject: [PATCH 038/162] Navigation bar support for symbols --- src/services/navigationBar.ts | 16 +++++++++++----- .../fourslash/scriptLexicalStructureSymbols1.ts | 17 +++++++++++++++++ .../fourslash/scriptLexicalStructureSymbols2.ts | 15 +++++++++++++++ .../fourslash/scriptLexicalStructureSymbols3.ts | 13 +++++++++++++ 4 files changed, 56 insertions(+), 5 deletions(-) create mode 100644 tests/cases/fourslash/scriptLexicalStructureSymbols1.ts create mode 100644 tests/cases/fourslash/scriptLexicalStructureSymbols2.ts create mode 100644 tests/cases/fourslash/scriptLexicalStructureSymbols3.ts diff --git a/src/services/navigationBar.ts b/src/services/navigationBar.ts index 771fe48219f..b254397f8b0 100644 --- a/src/services/navigationBar.ts +++ b/src/services/navigationBar.ts @@ -97,8 +97,7 @@ module ts.NavigationBar { function sortNodes(nodes: Node[]): Node[] { return nodes.slice(0).sort((n1: Declaration, n2: Declaration) => { if (n1.name && n2.name) { - // TODO(jfreeman): How do we sort declarations with computed names? - return (n1.name).text.localeCompare((n2.name).text); + return getPropertyNameForPropertyNameNode(n1.name).localeCompare(getPropertyNameForPropertyNameNode(n2.name)); } else if (n1.name) { return 1; @@ -426,7 +425,7 @@ module ts.NavigationBar { // Add the constructor parameters in as children of the class (for property parameters). // Note that *all* parameters will be added to the nodes array, but parameters that // are not properties will be filtered out later by createChildItem. - var nodes: Node[] = removeComputedProperties(node); + var nodes: Node[] = removeDynamicallyNamedProperties(node); if (constructor) { nodes.push.apply(nodes, constructor.parameters); } @@ -455,7 +454,7 @@ module ts.NavigationBar { } function createIterfaceItem(node: InterfaceDeclaration): ts.NavigationBarItem { - var childItems = getItemsWorker(sortNodes(removeComputedProperties(node)), createChildItem); + var childItems = getItemsWorker(sortNodes(removeDynamicallyNamedProperties(node)), createChildItem); return getNavigationBarItem( node.name.text, ts.ScriptElementKind.interfaceElement, @@ -466,10 +465,17 @@ module ts.NavigationBar { } } - function removeComputedProperties(node: ClassDeclaration | InterfaceDeclaration | EnumDeclaration): Declaration[] { + function removeComputedProperties(node: EnumDeclaration): Declaration[] { return filter(node.members, member => member.name === undefined || member.name.kind !== SyntaxKind.ComputedPropertyName); } + /** + * Like removeComputedProperties, but retains the properties with well known symbol names + */ + function removeDynamicallyNamedProperties(node: ClassDeclaration | InterfaceDeclaration): Declaration[]{ + return filter(node.members, member => !hasDynamicName(member)); + } + function getInnermostModule(node: ModuleDeclaration): ModuleDeclaration { while (node.body.kind === SyntaxKind.ModuleDeclaration) { node = node.body; diff --git a/tests/cases/fourslash/scriptLexicalStructureSymbols1.ts b/tests/cases/fourslash/scriptLexicalStructureSymbols1.ts new file mode 100644 index 00000000000..e3dde6738e9 --- /dev/null +++ b/tests/cases/fourslash/scriptLexicalStructureSymbols1.ts @@ -0,0 +1,17 @@ +/// + +////{| "itemName": "C", "kind": "class", "parentName": "" |} +////class C { +//// {| "itemName": "[Symbol.isRegExp]", "kind": "property", "parentName": "C" |} +//// [Symbol.isRegExp] = 0; +//// {| "itemName": "[Symbol.iterator]", "kind": "method", "parentName": "C" |} +//// [Symbol.iterator]() { } +//// {| "itemName": "[Symbol.isConcatSpreadable]", "kind": "getter", "parentName": "C" |} +//// get [Symbol.isConcatSpreadable]() { } +////} + +test.markers().forEach(marker => { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); +}); + +verify.getScriptLexicalStructureListCount(test.markers().length); \ No newline at end of file diff --git a/tests/cases/fourslash/scriptLexicalStructureSymbols2.ts b/tests/cases/fourslash/scriptLexicalStructureSymbols2.ts new file mode 100644 index 00000000000..d048de895ec --- /dev/null +++ b/tests/cases/fourslash/scriptLexicalStructureSymbols2.ts @@ -0,0 +1,15 @@ +/// + +////{| "itemName": "I", "kind": "interface", "parentName": "" |} +////interface I { +//// {| "itemName": "[Symbol.isRegExp]", "kind": "property", "parentName": "I" |} +//// [Symbol.isRegExp]: string; +//// {| "itemName": "[Symbol.iterator]", "kind": "method", "parentName": "I" |} +//// [Symbol.iterator](): string; +////} + +test.markers().forEach(marker => { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); +}); + +verify.getScriptLexicalStructureListCount(test.markers().length); \ No newline at end of file diff --git a/tests/cases/fourslash/scriptLexicalStructureSymbols3.ts b/tests/cases/fourslash/scriptLexicalStructureSymbols3.ts new file mode 100644 index 00000000000..19f81037559 --- /dev/null +++ b/tests/cases/fourslash/scriptLexicalStructureSymbols3.ts @@ -0,0 +1,13 @@ +/// + +////{| "itemName": "E", "kind": "enum", "parentName": "" |} +////enum E { +//// // No nav bar entry for this +//// [Symbol.isRegExp] = 0 +////} + +test.markers().forEach(marker => { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); +}); + +verify.getScriptLexicalStructureListCount(test.markers().length); \ No newline at end of file From eb5061971df26526a25633f2ba40677406489cf2 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Fri, 6 Feb 2015 21:30:51 -0800 Subject: [PATCH 039/162] Disable symbol indexer --- src/compiler/checker.ts | 10 +------ .../diagnosticInformationMap.generated.ts | 3 +-- src/compiler/diagnosticMessages.json | 7 +---- .../reference/arraySigChecking.errors.txt | 4 +-- ...eReferenceWithoutTypeArgument.d.errors.txt | 4 +-- ...ypeReferenceWithoutTypeArgument.errors.txt | 4 +-- ...peReferenceWithoutTypeArgument2.errors.txt | 4 +-- ...peReferenceWithoutTypeArgument3.errors.txt | 4 +-- .../reference/indexTypeCheck.errors.txt | 4 +-- .../parserES5SymbolIndexer1.errors.txt | 6 ++--- .../parserES5SymbolIndexer2.errors.txt | 6 ++--- .../parserES5SymbolIndexer3.errors.txt | 6 ++--- .../parserIndexSignature6.errors.txt | 4 +-- .../parserIndexSignature8.errors.txt | 8 +++--- .../reference/parserSymbolIndexer1.errors.txt | 9 +++++++ .../reference/parserSymbolIndexer1.types | 7 ----- .../reference/parserSymbolIndexer2.errors.txt | 9 +++++++ .../reference/parserSymbolIndexer2.types | 7 ----- .../reference/parserSymbolIndexer3.errors.txt | 6 ++--- .../reference/parserSymbolIndexer4.errors.txt | 9 +++++++ .../reference/parserSymbolIndexer4.types | 7 ----- .../reference/symbolProperty17.errors.txt | 14 ++++++++++ .../reference/symbolProperty17.types | 27 ------------------- .../reference/symbolProperty29.errors.txt | 12 +++++++++ .../reference/symbolProperty29.types | 17 ------------ .../reference/symbolProperty30.errors.txt | 12 +++++++++ .../reference/symbolProperty31.errors.txt | 14 ++++++++++ .../reference/symbolProperty31.types | 22 --------------- .../reference/symbolProperty32.errors.txt | 14 ++++++++++ .../reference/symbolProperty33.errors.txt | 14 ++++++++++ .../reference/symbolProperty33.types | 22 --------------- .../reference/symbolProperty34.errors.txt | 14 ++++++++++ 32 files changed, 154 insertions(+), 156 deletions(-) create mode 100644 tests/baselines/reference/parserSymbolIndexer1.errors.txt delete mode 100644 tests/baselines/reference/parserSymbolIndexer1.types create mode 100644 tests/baselines/reference/parserSymbolIndexer2.errors.txt delete mode 100644 tests/baselines/reference/parserSymbolIndexer2.types create mode 100644 tests/baselines/reference/parserSymbolIndexer4.errors.txt delete mode 100644 tests/baselines/reference/parserSymbolIndexer4.types create mode 100644 tests/baselines/reference/symbolProperty17.errors.txt delete mode 100644 tests/baselines/reference/symbolProperty17.types create mode 100644 tests/baselines/reference/symbolProperty29.errors.txt delete mode 100644 tests/baselines/reference/symbolProperty29.types create mode 100644 tests/baselines/reference/symbolProperty30.errors.txt create mode 100644 tests/baselines/reference/symbolProperty31.errors.txt delete mode 100644 tests/baselines/reference/symbolProperty31.types create mode 100644 tests/baselines/reference/symbolProperty32.errors.txt create mode 100644 tests/baselines/reference/symbolProperty33.errors.txt delete mode 100644 tests/baselines/reference/symbolProperty33.types create mode 100644 tests/baselines/reference/symbolProperty34.errors.txt diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b2f933e1194..349edf4b609 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10651,15 +10651,7 @@ module ts { return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_must_have_a_type_annotation); } if (parameter.type.kind !== SyntaxKind.StringKeyword && parameter.type.kind !== SyntaxKind.NumberKeyword) { - if (parameter.type.kind === SyntaxKind.SymbolKeyword) { - if (languageVersion < ScriptTarget.ES6) { - return grammarErrorOnNode(parameter.type, Diagnostics.symbol_indexers_are_only_available_when_targeting_ECMAScript_6_and_higher); - } - // No error for parameter type - } - else { - return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_number_or_symbol); - } + return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_or_number); } if (!node.type) { return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_a_type_annotation); diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index c491acdf2ef..9745f251e66 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -19,7 +19,7 @@ module ts { An_index_signature_parameter_cannot_have_an_initializer: { code: 1020, category: DiagnosticCategory.Error, key: "An index signature parameter cannot have an initializer." }, An_index_signature_must_have_a_type_annotation: { code: 1021, category: DiagnosticCategory.Error, key: "An index signature must have a type annotation." }, An_index_signature_parameter_must_have_a_type_annotation: { code: 1022, category: DiagnosticCategory.Error, key: "An index signature parameter must have a type annotation." }, - An_index_signature_parameter_type_must_be_string_number_or_symbol: { code: 1023, category: DiagnosticCategory.Error, key: "An index signature parameter type must be 'string', 'number', or 'symbol'." }, + An_index_signature_parameter_type_must_be_string_or_number: { code: 1023, category: DiagnosticCategory.Error, key: "An index signature parameter type must be 'string' or 'number'." }, A_class_or_interface_declaration_can_only_have_one_extends_clause: { code: 1024, category: DiagnosticCategory.Error, key: "A class or interface declaration can only have one 'extends' clause." }, An_extends_clause_must_precede_an_implements_clause: { code: 1025, category: DiagnosticCategory.Error, key: "An 'extends' clause must precede an 'implements' clause." }, A_class_can_only_extend_a_single_class: { code: 1026, category: DiagnosticCategory.Error, key: "A class can only extend a single class." }, @@ -147,7 +147,6 @@ module ts { Merge_conflict_marker_encountered: { code: 1185, category: DiagnosticCategory.Error, key: "Merge conflict marker encountered." }, A_rest_element_cannot_have_an_initializer: { code: 1186, category: DiagnosticCategory.Error, key: "A rest element cannot have an initializer." }, A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: DiagnosticCategory.Error, key: "A parameter property may not be a binding pattern." }, - symbol_indexers_are_only_available_when_targeting_ECMAScript_6_and_higher: { code: 1188, category: DiagnosticCategory.Error, key: "'symbol' indexers are only available when targeting ECMAScript 6 and higher.", isEarly: true }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index e3f8a880111..fd09a49d3fb 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -67,7 +67,7 @@ "category": "Error", "code": 1022 }, - "An index signature parameter type must be 'string', 'number', or 'symbol'.": { + "An index signature parameter type must be 'string' or 'number'.": { "category": "Error", "code": 1023 }, @@ -579,11 +579,6 @@ "category": "Error", "code": 1187 }, - "'symbol' indexers are only available when targeting ECMAScript 6 and higher.": { - "category": "Error", - "code": 1188, - "isEarly": true - }, "Duplicate identifier '{0}'.": { "category": "Error", diff --git a/tests/baselines/reference/arraySigChecking.errors.txt b/tests/baselines/reference/arraySigChecking.errors.txt index 85948381ff5..b70b659773c 100644 --- a/tests/baselines/reference/arraySigChecking.errors.txt +++ b/tests/baselines/reference/arraySigChecking.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/arraySigChecking.ts(11,17): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. +tests/cases/compiler/arraySigChecking.ts(11,17): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/compiler/arraySigChecking.ts(18,5): error TS2322: Type 'void[]' is not assignable to type 'string[]'. Type 'void' is not assignable to type 'string'. tests/cases/compiler/arraySigChecking.ts(22,1): error TS2322: Type 'number[][]' is not assignable to type 'number[][][]'. @@ -20,7 +20,7 @@ tests/cases/compiler/arraySigChecking.ts(22,1): error TS2322: Type 'number[][]' var foo: { [index: any]; }; // expect an error here ~~~~~ -!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. } interface myInt { diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt index 5d7da139c2b..6c98d419dec 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.d.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(10,21): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(11,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(11,26): error TS2314: Generic type 'C' requires 1 type argument(s). -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,19): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,19): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(12,26): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.d.ts(14,23): error TS2314: Generic type 'C' requires 1 type argument(s). @@ -36,7 +36,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc !!! error TS2314: Generic type 'C' requires 1 type argument(s). declare var d: { [x: C]: C }; ~ -!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. ~ !!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt index 7b5116356c7..d57f3c2fc0d 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(10,13): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(11,14): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(11,18): error TS2314: Generic type 'C' requires 1 type argument(s). -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,11): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,11): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,14): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(12,18): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument.ts(14,13): error TS2314: Generic type 'C' requires 1 type argument(s). @@ -46,7 +46,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc !!! error TS2314: Generic type 'C' requires 1 type argument(s). var d: { [x: C]: C }; ~ -!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. ~ !!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt index 136682b1ca1..745da9aa106 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument2.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(10,13): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(11,14): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(11,18): error TS2314: Generic type 'I' requires 1 type argument(s). -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,11): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,11): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,14): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(12,18): error TS2314: Generic type 'I' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument2.ts(14,13): error TS2314: Generic type 'I' requires 1 type argument(s). @@ -46,7 +46,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc !!! error TS2314: Generic type 'I' requires 1 type argument(s). var d: { [x: I]: I }; ~ -!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. ~ !!! error TS2314: Generic type 'I' requires 1 type argument(s). ~ diff --git a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt index d755a9120a8..1fec52356a2 100644 --- a/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt +++ b/tests/baselines/reference/genericTypeReferenceWithoutTypeArgument3.errors.txt @@ -2,7 +2,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(10,21): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(11,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(11,26): error TS2314: Generic type 'C' requires 1 type argument(s). -tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,19): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. +tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,19): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,22): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(12,26): error TS2314: Generic type 'C' requires 1 type argument(s). tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenceWithoutTypeArgument3.ts(14,23): error TS2314: Generic type 'C' requires 1 type argument(s). @@ -36,7 +36,7 @@ tests/cases/conformance/types/specifyingTypes/typeReferences/genericTypeReferenc !!! error TS2314: Generic type 'C' requires 1 type argument(s). declare var d: { [x: C]: C }; ~ -!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. ~ !!! error TS2314: Generic type 'C' requires 1 type argument(s). ~ diff --git a/tests/baselines/reference/indexTypeCheck.errors.txt b/tests/baselines/reference/indexTypeCheck.errors.txt index 5d3e6dc9268..9f4b403ca2e 100644 --- a/tests/baselines/reference/indexTypeCheck.errors.txt +++ b/tests/baselines/reference/indexTypeCheck.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/indexTypeCheck.ts(17,2): error TS2413: Numeric index type ' tests/cases/compiler/indexTypeCheck.ts(22,2): error TS2413: Numeric index type 'Orange' is not assignable to string index type 'Yellow'. tests/cases/compiler/indexTypeCheck.ts(27,2): error TS2413: Numeric index type 'number' is not assignable to string index type 'string'. tests/cases/compiler/indexTypeCheck.ts(32,3): error TS1096: An index signature must have exactly one parameter. -tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. +tests/cases/compiler/indexTypeCheck.ts(36,3): error TS1023: An index signature parameter type must be 'string' or 'number'. tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression argument must be of type 'string', 'number', 'symbol, or 'any'. @@ -58,7 +58,7 @@ tests/cases/compiler/indexTypeCheck.ts(51,1): error TS2342: An index expression interface Magenta { [p:Purple]; // error ~ -!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. } var yellow: Yellow; diff --git a/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt index a3c4f22a87e..adfac8f700f 100644 --- a/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt +++ b/tests/baselines/reference/parserES5SymbolIndexer1.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts(2,9): error TS1188: 'symbol' indexers are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. ==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer1.ts (1 errors) ==== interface I { [s: symbol]: string; - ~~~~~~ -!!! error TS1188: 'symbol' indexers are only available when targeting ECMAScript 6 and higher. + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt index 39d8aa41d77..12eef8ec049 100644 --- a/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt +++ b/tests/baselines/reference/parserES5SymbolIndexer2.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts(2,9): error TS1188: 'symbol' indexers are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. ==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer2.ts (1 errors) ==== class C { [s: symbol]: string; - ~~~~~~ -!!! error TS1188: 'symbol' indexers are only available when targeting ECMAScript 6 and higher. + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt b/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt index 34dea325439..c9cd9db4fab 100644 --- a/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt +++ b/tests/baselines/reference/parserES5SymbolIndexer3.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts(2,9): error TS1188: 'symbol' indexers are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. ==== tests/cases/conformance/parser/ecmascript5/Symbols/parserES5SymbolIndexer3.ts (1 errors) ==== var x: { [s: symbol]: string; - ~~~~~~ -!!! error TS1188: 'symbol' indexers are only available when targeting ECMAScript 6 and higher. + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexSignature6.errors.txt b/tests/baselines/reference/parserIndexSignature6.errors.txt index 52a3b28a519..db53f219832 100644 --- a/tests/baselines/reference/parserIndexSignature6.errors.txt +++ b/tests/baselines/reference/parserIndexSignature6.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature6.ts(2,4): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature6.ts(2,4): error TS1023: An index signature parameter type must be 'string' or 'number'. ==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature6.ts (1 errors) ==== interface I { [a:boolean] ~ -!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserIndexSignature8.errors.txt b/tests/baselines/reference/parserIndexSignature8.errors.txt index efed14e9577..87369df1b76 100644 --- a/tests/baselines/reference/parserIndexSignature8.errors.txt +++ b/tests/baselines/reference/parserIndexSignature8.errors.txt @@ -1,12 +1,12 @@ -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts(1,13): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. -tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts(2,14): error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts(1,13): error TS1023: An index signature parameter type must be 'string' or 'number'. +tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts(2,14): error TS1023: An index signature parameter type must be 'string' or 'number'. ==== tests/cases/conformance/parser/ecmascript5/IndexSignatures/parserIndexSignature8.ts (2 errors) ==== var foo: { [index: any]; }; // expect an error here ~~~~~ -!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. var foo2: { [index: RegExp]; }; // expect an error here ~~~~~ -!!! error TS1023: An index signature parameter type must be 'string', 'number', or 'symbol'. +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer1.errors.txt b/tests/baselines/reference/parserSymbolIndexer1.errors.txt new file mode 100644 index 00000000000..5c6c38d52b1 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer1.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts (1 errors) ==== + interface I { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer1.types b/tests/baselines/reference/parserSymbolIndexer1.types deleted file mode 100644 index 6723ef12726..00000000000 --- a/tests/baselines/reference/parserSymbolIndexer1.types +++ /dev/null @@ -1,7 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer1.ts === -interface I { ->I : I - - [s: symbol]: string; ->s : symbol -} diff --git a/tests/baselines/reference/parserSymbolIndexer2.errors.txt b/tests/baselines/reference/parserSymbolIndexer2.errors.txt new file mode 100644 index 00000000000..3961f4942de --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer2.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts (1 errors) ==== + class C { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer2.types b/tests/baselines/reference/parserSymbolIndexer2.types deleted file mode 100644 index d8d620c7def..00000000000 --- a/tests/baselines/reference/parserSymbolIndexer2.types +++ /dev/null @@ -1,7 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer2.ts === -class C { ->C : C - - [s: symbol]: string; ->s : symbol -} diff --git a/tests/baselines/reference/parserSymbolIndexer3.errors.txt b/tests/baselines/reference/parserSymbolIndexer3.errors.txt index df3b9596f79..5484a096d4c 100644 --- a/tests/baselines/reference/parserSymbolIndexer3.errors.txt +++ b/tests/baselines/reference/parserSymbolIndexer3.errors.txt @@ -1,9 +1,9 @@ -tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts(2,5): error TS1145: Modifiers not permitted on index signature members. +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts(2,13): error TS1023: An index signature parameter type must be 'string' or 'number'. ==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer3.ts (1 errors) ==== class C { static [s: symbol]: string; - ~~~~~~ -!!! error TS1145: Modifiers not permitted on index signature members. + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer4.errors.txt b/tests/baselines/reference/parserSymbolIndexer4.errors.txt new file mode 100644 index 00000000000..1cf184a4847 --- /dev/null +++ b/tests/baselines/reference/parserSymbolIndexer4.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts(2,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts (1 errors) ==== + var x: { + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserSymbolIndexer4.types b/tests/baselines/reference/parserSymbolIndexer4.types deleted file mode 100644 index 7509072a12c..00000000000 --- a/tests/baselines/reference/parserSymbolIndexer4.types +++ /dev/null @@ -1,7 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/Symbols/parserSymbolIndexer4.ts === -var x: { ->x : {} - - [s: symbol]: string; ->s : symbol -} diff --git a/tests/baselines/reference/symbolProperty17.errors.txt b/tests/baselines/reference/symbolProperty17.errors.txt new file mode 100644 index 00000000000..51f77646f0d --- /dev/null +++ b/tests/baselines/reference/symbolProperty17.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty17.ts(3,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty17.ts (1 errors) ==== + interface I { + [Symbol.iterator]: number; + [s: symbol]: string; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + "__@iterator": string; + } + + var i: I; + var it = i[Symbol.iterator]; \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty17.types b/tests/baselines/reference/symbolProperty17.types deleted file mode 100644 index f804943c212..00000000000 --- a/tests/baselines/reference/symbolProperty17.types +++ /dev/null @@ -1,27 +0,0 @@ -=== tests/cases/conformance/es6/Symbols/symbolProperty17.ts === -interface I { ->I : I - - [Symbol.iterator]: number; ->Symbol.iterator : symbol ->Symbol : SymbolConstructor ->iterator : symbol - - [s: symbol]: string; ->s : symbol - - "__@iterator": string; -} - -var i: I; ->i : I ->I : I - -var it = i[Symbol.iterator]; ->it : number ->i[Symbol.iterator] : number ->i : I ->Symbol.iterator : symbol ->Symbol : SymbolConstructor ->iterator : symbol - diff --git a/tests/baselines/reference/symbolProperty29.errors.txt b/tests/baselines/reference/symbolProperty29.errors.txt new file mode 100644 index 00000000000..1efaeb2b3bf --- /dev/null +++ b/tests/baselines/reference/symbolProperty29.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/Symbols/symbolProperty29.ts(5,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty29.ts (1 errors) ==== + class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: string }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty29.types b/tests/baselines/reference/symbolProperty29.types deleted file mode 100644 index eb47ccae859..00000000000 --- a/tests/baselines/reference/symbolProperty29.types +++ /dev/null @@ -1,17 +0,0 @@ -=== tests/cases/conformance/es6/Symbols/symbolProperty29.ts === -class C1 { ->C1 : C1 - - [Symbol.toStringTag]() { ->Symbol.toStringTag : symbol ->Symbol : SymbolConstructor ->toStringTag : symbol - - return { x: "" }; ->{ x: "" } : { x: string; } ->x : string - } - [s: symbol]: () => { x: string }; ->s : symbol ->x : string -} diff --git a/tests/baselines/reference/symbolProperty30.errors.txt b/tests/baselines/reference/symbolProperty30.errors.txt new file mode 100644 index 00000000000..b839d11d1b8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty30.errors.txt @@ -0,0 +1,12 @@ +tests/cases/conformance/es6/Symbols/symbolProperty30.ts(5,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty30.ts (1 errors) ==== + class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + [s: symbol]: () => { x: number }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty31.errors.txt b/tests/baselines/reference/symbolProperty31.errors.txt new file mode 100644 index 00000000000..39735c017b2 --- /dev/null +++ b/tests/baselines/reference/symbolProperty31.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty31.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty31.ts (1 errors) ==== + class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + } + class C2 extends C1 { + [s: symbol]: () => { x: string }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty31.types b/tests/baselines/reference/symbolProperty31.types deleted file mode 100644 index 52a6523d4ed..00000000000 --- a/tests/baselines/reference/symbolProperty31.types +++ /dev/null @@ -1,22 +0,0 @@ -=== tests/cases/conformance/es6/Symbols/symbolProperty31.ts === -class C1 { ->C1 : C1 - - [Symbol.toStringTag]() { ->Symbol.toStringTag : symbol ->Symbol : SymbolConstructor ->toStringTag : symbol - - return { x: "" }; ->{ x: "" } : { x: string; } ->x : string - } -} -class C2 extends C1 { ->C2 : C2 ->C1 : C1 - - [s: symbol]: () => { x: string }; ->s : symbol ->x : string -} diff --git a/tests/baselines/reference/symbolProperty32.errors.txt b/tests/baselines/reference/symbolProperty32.errors.txt new file mode 100644 index 00000000000..4051f8f91c8 --- /dev/null +++ b/tests/baselines/reference/symbolProperty32.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty32.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty32.ts (1 errors) ==== + class C1 { + [Symbol.toStringTag]() { + return { x: "" }; + } + } + class C2 extends C1 { + [s: symbol]: () => { x: number }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty33.errors.txt b/tests/baselines/reference/symbolProperty33.errors.txt new file mode 100644 index 00000000000..25a16b045ab --- /dev/null +++ b/tests/baselines/reference/symbolProperty33.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty33.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty33.ts (1 errors) ==== + class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } + } + class C2 { + [s: symbol]: () => { x: string }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty33.types b/tests/baselines/reference/symbolProperty33.types deleted file mode 100644 index aed8a97e60b..00000000000 --- a/tests/baselines/reference/symbolProperty33.types +++ /dev/null @@ -1,22 +0,0 @@ -=== tests/cases/conformance/es6/Symbols/symbolProperty33.ts === -class C1 extends C2 { ->C1 : C1 ->C2 : C2 - - [Symbol.toStringTag]() { ->Symbol.toStringTag : symbol ->Symbol : SymbolConstructor ->toStringTag : symbol - - return { x: "" }; ->{ x: "" } : { x: string; } ->x : string - } -} -class C2 { ->C2 : C2 - - [s: symbol]: () => { x: string }; ->s : symbol ->x : string -} diff --git a/tests/baselines/reference/symbolProperty34.errors.txt b/tests/baselines/reference/symbolProperty34.errors.txt new file mode 100644 index 00000000000..4339af94788 --- /dev/null +++ b/tests/baselines/reference/symbolProperty34.errors.txt @@ -0,0 +1,14 @@ +tests/cases/conformance/es6/Symbols/symbolProperty34.ts(7,6): error TS1023: An index signature parameter type must be 'string' or 'number'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty34.ts (1 errors) ==== + class C1 extends C2 { + [Symbol.toStringTag]() { + return { x: "" }; + } + } + class C2 { + [s: symbol]: () => { x: number }; + ~ +!!! error TS1023: An index signature parameter type must be 'string' or 'number'. + } \ No newline at end of file From 52cb13e9d6265417a960b43e32ffce6a53b48d2a Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Fri, 6 Feb 2015 21:38:32 -0800 Subject: [PATCH 040/162] Uncomment symbol properties in es6.d.ts --- src/lib/es6.d.ts | 52 ++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/lib/es6.d.ts b/src/lib/es6.d.ts index 4d4f435145c..50238e94bb4 100644 --- a/src/lib/es6.d.ts +++ b/src/lib/es6.d.ts @@ -7,7 +7,7 @@ interface Symbol { /** Returns the primitive value of the specified object. */ valueOf(): Object; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface SymbolConstructor { @@ -230,7 +230,7 @@ interface ArrayLike { interface Array { /** Iterator */ - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; /** * Returns an array of key, value pairs for every entry in the array @@ -329,7 +329,7 @@ interface ArrayConstructor { interface String { /** Iterator */ - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; /** * Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point @@ -447,12 +447,12 @@ interface IteratorResult { } interface Iterator { - //[Symbol.iterator](): Iterator; + [Symbol.iterator](): Iterator; next(): IteratorResult; } interface Iterable { - //[Symbol.iterator](): Iterator; + [Symbol.iterator](): Iterator; } interface GeneratorFunction extends Function { @@ -474,7 +474,7 @@ interface Generator extends Iterator { next(value?: any): IteratorResult; throw (exception: any): IteratorResult; return (value: T): IteratorResult; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface Math { @@ -588,11 +588,11 @@ interface Math { */ cbrt(x: number): number; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface RegExp { - // [Symbol.isRegExp]: boolean; + [Symbol.isRegExp]: boolean; /** * Matches a string with a regular expression, and returns an array containing the results of @@ -649,8 +649,8 @@ interface Map { set(key: K, value?: V): Map; size: number; values(): Iterator; - // [Symbol.iterator]():Iterator<[K,V]>; - // [Symbol.toStringTag]: string; + [Symbol.iterator]():Iterator<[K,V]>; + [Symbol.toStringTag]: string; } interface MapConstructor { @@ -666,7 +666,7 @@ interface WeakMap { get(key: K): V; has(key: K): boolean; set(key: K, value?: V): WeakMap; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface WeakMapConstructor { @@ -686,8 +686,8 @@ interface Set { keys(): Iterator; size: number; values(): Iterator; - // [Symbol.iterator]():Iterator; - // [Symbol.toStringTag]: string; + [Symbol.iterator]():Iterator; + [Symbol.toStringTag]: string; } interface SetConstructor { @@ -702,7 +702,7 @@ interface WeakSet { clear(): void; delete(value: T): boolean; has(value: T): boolean; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface WeakSetConstructor { @@ -713,7 +713,7 @@ interface WeakSetConstructor { declare var WeakSet: WeakSetConstructor; interface JSON { - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } /** @@ -733,7 +733,7 @@ interface ArrayBuffer { */ slice(begin: number, end?: number): ArrayBuffer; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface ArrayBufferConstructor { @@ -870,7 +870,7 @@ interface DataView { */ setUint32(byteOffset: number, value: number, littleEndian: boolean): void; - // [Symbol.toStringTag]: string; + [Symbol.toStringTag]: string; } interface DataViewConstructor { @@ -1137,7 +1137,7 @@ interface Int8Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int8ArrayConstructor { @@ -1427,7 +1427,7 @@ interface Uint8Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint8ArrayConstructor { @@ -1717,7 +1717,7 @@ interface Uint8ClampedArray { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint8ClampedArrayConstructor { @@ -2007,7 +2007,7 @@ interface Int16Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int16ArrayConstructor { @@ -2297,7 +2297,7 @@ interface Uint16Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint16ArrayConstructor { @@ -2587,7 +2587,7 @@ interface Int32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Int32ArrayConstructor { @@ -2877,7 +2877,7 @@ interface Uint32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Uint32ArrayConstructor { @@ -3167,7 +3167,7 @@ interface Float32Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Float32ArrayConstructor { @@ -3457,7 +3457,7 @@ interface Float64Array { values(): Iterator; [index: number]: number; - // [Symbol.iterator] (): Iterator; + [Symbol.iterator] (): Iterator; } interface Float64ArrayConstructor { From 75382c14f9aabc4f1e120d21df757a1d4e70cc25 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Fri, 6 Feb 2015 21:38:53 -0800 Subject: [PATCH 041/162] Accept baselines after rebase --- tests/baselines/reference/ES5SymbolProperty2.js | 3 +-- tests/baselines/reference/ES5SymbolProperty3.js | 3 +-- tests/baselines/reference/ES5SymbolProperty4.js | 3 +-- tests/baselines/reference/ES5SymbolProperty5.js | 3 +-- tests/baselines/reference/ES5SymbolProperty6.js | 3 +-- tests/baselines/reference/ES5SymbolProperty7.js | 3 +-- tests/baselines/reference/parserES5SymbolProperty7.js | 3 +-- tests/baselines/reference/parserSymbolProperty7.js | 3 +-- tests/baselines/reference/symbolDeclarationEmit10.js | 3 +-- tests/baselines/reference/symbolDeclarationEmit11.js | 6 ++---- tests/baselines/reference/symbolDeclarationEmit12.js | 6 ++---- tests/baselines/reference/symbolDeclarationEmit13.js | 3 +-- tests/baselines/reference/symbolDeclarationEmit3.js | 3 +-- tests/baselines/reference/symbolDeclarationEmit4.js | 3 +-- tests/baselines/reference/symbolDeclarationEmit9.js | 3 +-- tests/baselines/reference/symbolProperty1.js | 3 +-- tests/baselines/reference/symbolProperty18.js | 3 +-- tests/baselines/reference/symbolProperty2.js | 3 +-- tests/baselines/reference/symbolProperty3.js | 3 +-- tests/baselines/reference/symbolProperty4.js | 3 +-- tests/baselines/reference/symbolProperty48.js | 3 +-- tests/baselines/reference/symbolProperty49.js | 3 +-- tests/baselines/reference/symbolProperty5.js | 3 +-- tests/baselines/reference/symbolProperty50.js | 3 +-- tests/baselines/reference/symbolProperty51.js | 3 +-- tests/baselines/reference/symbolProperty6.js | 3 +-- tests/baselines/reference/symbolProperty7.js | 3 +-- tests/baselines/reference/symbolType13.js | 9 +++------ 28 files changed, 32 insertions(+), 64 deletions(-) diff --git a/tests/baselines/reference/ES5SymbolProperty2.js b/tests/baselines/reference/ES5SymbolProperty2.js index a1efd6ae7ba..effd1e610f4 100644 --- a/tests/baselines/reference/ES5SymbolProperty2.js +++ b/tests/baselines/reference/ES5SymbolProperty2.js @@ -17,8 +17,7 @@ var M; var C = (function () { function C() { } - C.prototype[Symbol.iterator] = function () { - }; + C.prototype[Symbol.iterator] = function () { }; return C; })(); M.C = C; diff --git a/tests/baselines/reference/ES5SymbolProperty3.js b/tests/baselines/reference/ES5SymbolProperty3.js index 7ef892cb3c4..52ea7e091ee 100644 --- a/tests/baselines/reference/ES5SymbolProperty3.js +++ b/tests/baselines/reference/ES5SymbolProperty3.js @@ -12,8 +12,7 @@ var Symbol; var C = (function () { function C() { } - C.prototype[Symbol.iterator] = function () { - }; + C.prototype[Symbol.iterator] = function () { }; return C; })(); (new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty4.js b/tests/baselines/reference/ES5SymbolProperty4.js index d4022066bb8..ae8a539f351 100644 --- a/tests/baselines/reference/ES5SymbolProperty4.js +++ b/tests/baselines/reference/ES5SymbolProperty4.js @@ -12,8 +12,7 @@ var Symbol; var C = (function () { function C() { } - C.prototype[Symbol.iterator] = function () { - }; + C.prototype[Symbol.iterator] = function () { }; return C; })(); (new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty5.js b/tests/baselines/reference/ES5SymbolProperty5.js index c433b0ab443..63b12667d0f 100644 --- a/tests/baselines/reference/ES5SymbolProperty5.js +++ b/tests/baselines/reference/ES5SymbolProperty5.js @@ -12,8 +12,7 @@ var Symbol; var C = (function () { function C() { } - C.prototype[Symbol.iterator] = function () { - }; + C.prototype[Symbol.iterator] = function () { }; return C; })(); (new C)[Symbol.iterator](0); // Should error diff --git a/tests/baselines/reference/ES5SymbolProperty6.js b/tests/baselines/reference/ES5SymbolProperty6.js index 949ce722aa7..10eda091e5e 100644 --- a/tests/baselines/reference/ES5SymbolProperty6.js +++ b/tests/baselines/reference/ES5SymbolProperty6.js @@ -9,8 +9,7 @@ class C { var C = (function () { function C() { } - C.prototype[Symbol.iterator] = function () { - }; + C.prototype[Symbol.iterator] = function () { }; return C; })(); (new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/ES5SymbolProperty7.js b/tests/baselines/reference/ES5SymbolProperty7.js index f98e792e8cd..d3f796ce758 100644 --- a/tests/baselines/reference/ES5SymbolProperty7.js +++ b/tests/baselines/reference/ES5SymbolProperty7.js @@ -12,8 +12,7 @@ var Symbol; var C = (function () { function C() { } - C.prototype[Symbol.iterator] = function () { - }; + C.prototype[Symbol.iterator] = function () { }; return C; })(); (new C)[Symbol.iterator]; diff --git a/tests/baselines/reference/parserES5SymbolProperty7.js b/tests/baselines/reference/parserES5SymbolProperty7.js index b6096b798df..102d10af417 100644 --- a/tests/baselines/reference/parserES5SymbolProperty7.js +++ b/tests/baselines/reference/parserES5SymbolProperty7.js @@ -7,7 +7,6 @@ class C { var C = (function () { function C() { } - C.prototype[Symbol.toStringTag] = function () { - }; + C.prototype[Symbol.toStringTag] = function () { }; return C; })(); diff --git a/tests/baselines/reference/parserSymbolProperty7.js b/tests/baselines/reference/parserSymbolProperty7.js index 9d34b9e3bce..9368fd12855 100644 --- a/tests/baselines/reference/parserSymbolProperty7.js +++ b/tests/baselines/reference/parserSymbolProperty7.js @@ -7,7 +7,6 @@ class C { var C = (function () { function C() { } - C.prototype[Symbol.toStringTag] = function () { - }; + C.prototype[Symbol.toStringTag] = function () { }; return C; })(); diff --git a/tests/baselines/reference/symbolDeclarationEmit10.js b/tests/baselines/reference/symbolDeclarationEmit10.js index 7ace6617db5..090adc03a1c 100644 --- a/tests/baselines/reference/symbolDeclarationEmit10.js +++ b/tests/baselines/reference/symbolDeclarationEmit10.js @@ -9,8 +9,7 @@ var obj = { get [Symbol.isConcatSpreadable]() { return ''; }, - set [Symbol.isConcatSpreadable](x) { - } + set [Symbol.isConcatSpreadable](x) { } }; diff --git a/tests/baselines/reference/symbolDeclarationEmit11.js b/tests/baselines/reference/symbolDeclarationEmit11.js index c9c819eefa2..eeaf66db3e0 100644 --- a/tests/baselines/reference/symbolDeclarationEmit11.js +++ b/tests/baselines/reference/symbolDeclarationEmit11.js @@ -10,14 +10,12 @@ class C { var C = (function () { function C() { } - C[Symbol.toPrimitive] = function () { - }; + C[Symbol.toPrimitive] = function () { }; Object.defineProperty(C, Symbol.isRegExp, { get: function () { return ""; }, - set: function (x) { - }, + set: function (x) { }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/symbolDeclarationEmit12.js b/tests/baselines/reference/symbolDeclarationEmit12.js index 49ff8b35976..e39e62f62ed 100644 --- a/tests/baselines/reference/symbolDeclarationEmit12.js +++ b/tests/baselines/reference/symbolDeclarationEmit12.js @@ -18,8 +18,7 @@ var M; var C = (function () { function C() { } - C.prototype[Symbol.toPrimitive] = function (x) { - }; + C.prototype[Symbol.toPrimitive] = function (x) { }; C.prototype[Symbol.isConcatSpreadable] = function () { return undefined; }; @@ -27,8 +26,7 @@ var M; get: function () { return undefined; }, - set: function (x) { - }, + set: function (x) { }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/symbolDeclarationEmit13.js b/tests/baselines/reference/symbolDeclarationEmit13.js index 51b6edcece5..83e2a2501e4 100644 --- a/tests/baselines/reference/symbolDeclarationEmit13.js +++ b/tests/baselines/reference/symbolDeclarationEmit13.js @@ -16,8 +16,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, Symbol.toStringTag, { - set: function (x) { - }, + set: function (x) { }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/symbolDeclarationEmit3.js b/tests/baselines/reference/symbolDeclarationEmit3.js index 6d06c09bd69..e3b22d883c8 100644 --- a/tests/baselines/reference/symbolDeclarationEmit3.js +++ b/tests/baselines/reference/symbolDeclarationEmit3.js @@ -9,8 +9,7 @@ class C { var C = (function () { function C() { } - C.prototype[Symbol.isRegExp] = function (x) { - }; + C.prototype[Symbol.isRegExp] = function (x) { }; return C; })(); diff --git a/tests/baselines/reference/symbolDeclarationEmit4.js b/tests/baselines/reference/symbolDeclarationEmit4.js index cd3fc53a5bb..85906167b11 100644 --- a/tests/baselines/reference/symbolDeclarationEmit4.js +++ b/tests/baselines/reference/symbolDeclarationEmit4.js @@ -12,8 +12,7 @@ var C = (function () { get: function () { return ""; }, - set: function (x) { - }, + set: function (x) { }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/symbolDeclarationEmit9.js b/tests/baselines/reference/symbolDeclarationEmit9.js index 8cdb7173144..d38171767a5 100644 --- a/tests/baselines/reference/symbolDeclarationEmit9.js +++ b/tests/baselines/reference/symbolDeclarationEmit9.js @@ -5,8 +5,7 @@ var obj = { //// [symbolDeclarationEmit9.js] var obj = { - [Symbol.isConcatSpreadable]() { - } + [Symbol.isConcatSpreadable]() { } }; diff --git a/tests/baselines/reference/symbolProperty1.js b/tests/baselines/reference/symbolProperty1.js index 1537883f4ec..0117dd3b1c2 100644 --- a/tests/baselines/reference/symbolProperty1.js +++ b/tests/baselines/reference/symbolProperty1.js @@ -12,8 +12,7 @@ var x = { var s; var x = { [s]: 0, - [s]() { - }, + [s]() { }, get [s]() { return 0; } diff --git a/tests/baselines/reference/symbolProperty18.js b/tests/baselines/reference/symbolProperty18.js index ff69588be31..17570e2f007 100644 --- a/tests/baselines/reference/symbolProperty18.js +++ b/tests/baselines/reference/symbolProperty18.js @@ -15,8 +15,7 @@ var i = { [Symbol.toStringTag]() { return ""; }, - set [Symbol.toPrimitive](p) { - } + set [Symbol.toPrimitive](p) { } }; var it = i[Symbol.iterator]; var str = i[Symbol.toStringTag](); diff --git a/tests/baselines/reference/symbolProperty2.js b/tests/baselines/reference/symbolProperty2.js index 5c0f89b0257..0158366f9d5 100644 --- a/tests/baselines/reference/symbolProperty2.js +++ b/tests/baselines/reference/symbolProperty2.js @@ -12,8 +12,7 @@ var x = { var s = Symbol(); var x = { [s]: 0, - [s]() { - }, + [s]() { }, get [s]() { return 0; } diff --git a/tests/baselines/reference/symbolProperty3.js b/tests/baselines/reference/symbolProperty3.js index 6159b10f9f3..dda9ca23d32 100644 --- a/tests/baselines/reference/symbolProperty3.js +++ b/tests/baselines/reference/symbolProperty3.js @@ -12,8 +12,7 @@ var x = { var s = Symbol; var x = { [s]: 0, - [s]() { - }, + [s]() { }, get [s]() { return 0; } diff --git a/tests/baselines/reference/symbolProperty4.js b/tests/baselines/reference/symbolProperty4.js index be7cdab5f85..6072d6bbf72 100644 --- a/tests/baselines/reference/symbolProperty4.js +++ b/tests/baselines/reference/symbolProperty4.js @@ -10,8 +10,7 @@ var x = { //// [symbolProperty4.js] var x = { [Symbol()]: 0, - [Symbol()]() { - }, + [Symbol()]() { }, get [Symbol()]() { return 0; } diff --git a/tests/baselines/reference/symbolProperty48.js b/tests/baselines/reference/symbolProperty48.js index b0dc2b46dba..48717470f2f 100644 --- a/tests/baselines/reference/symbolProperty48.js +++ b/tests/baselines/reference/symbolProperty48.js @@ -14,8 +14,7 @@ var M; var C = (function () { function C() { } - C.prototype[Symbol.iterator] = function () { - }; + C.prototype[Symbol.iterator] = function () { }; return C; })(); })(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty49.js b/tests/baselines/reference/symbolProperty49.js index ea6e6f2c523..6c115a89ae4 100644 --- a/tests/baselines/reference/symbolProperty49.js +++ b/tests/baselines/reference/symbolProperty49.js @@ -14,8 +14,7 @@ var M; var C = (function () { function C() { } - C.prototype[M.Symbol.iterator] = function () { - }; + C.prototype[M.Symbol.iterator] = function () { }; return C; })(); })(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty5.js b/tests/baselines/reference/symbolProperty5.js index 9f0ff3d688f..c7c88681f8a 100644 --- a/tests/baselines/reference/symbolProperty5.js +++ b/tests/baselines/reference/symbolProperty5.js @@ -10,8 +10,7 @@ var x = { //// [symbolProperty5.js] var x = { [Symbol.iterator]: 0, - [Symbol.isRegExp]() { - }, + [Symbol.isRegExp]() { }, get [Symbol.toStringTag]() { return 0; } diff --git a/tests/baselines/reference/symbolProperty50.js b/tests/baselines/reference/symbolProperty50.js index 0a668e95509..61ded053938 100644 --- a/tests/baselines/reference/symbolProperty50.js +++ b/tests/baselines/reference/symbolProperty50.js @@ -13,8 +13,7 @@ var M; var C = (function () { function C() { } - C.prototype[Symbol.iterator] = function () { - }; + C.prototype[Symbol.iterator] = function () { }; return C; })(); })(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty51.js b/tests/baselines/reference/symbolProperty51.js index b3b9902fcd6..246dbaaa173 100644 --- a/tests/baselines/reference/symbolProperty51.js +++ b/tests/baselines/reference/symbolProperty51.js @@ -13,8 +13,7 @@ var M; var C = (function () { function C() { } - C.prototype[Symbol.iterator] = function () { - }; + C.prototype[Symbol.iterator] = function () { }; return C; })(); })(M || (M = {})); diff --git a/tests/baselines/reference/symbolProperty6.js b/tests/baselines/reference/symbolProperty6.js index 114999dc873..aee61b97435 100644 --- a/tests/baselines/reference/symbolProperty6.js +++ b/tests/baselines/reference/symbolProperty6.js @@ -13,8 +13,7 @@ var C = (function () { function C() { this[Symbol.iterator] = 0; } - C.prototype[Symbol.isRegExp] = function () { - }; + C.prototype[Symbol.isRegExp] = function () { }; Object.defineProperty(C.prototype, Symbol.toStringTag, { get: function () { return 0; diff --git a/tests/baselines/reference/symbolProperty7.js b/tests/baselines/reference/symbolProperty7.js index 42d19616ce3..781113572a1 100644 --- a/tests/baselines/reference/symbolProperty7.js +++ b/tests/baselines/reference/symbolProperty7.js @@ -13,8 +13,7 @@ var C = (function () { function C() { this[Symbol()] = 0; } - C.prototype[Symbol()] = function () { - }; + C.prototype[Symbol()] = function () { }; Object.defineProperty(C.prototype, Symbol(), { get: function () { return 0; diff --git a/tests/baselines/reference/symbolType13.js b/tests/baselines/reference/symbolType13.js index 56aef2cc8e6..afd62079bb5 100644 --- a/tests/baselines/reference/symbolType13.js +++ b/tests/baselines/reference/symbolType13.js @@ -9,9 +9,6 @@ for (var y in s) { } //// [symbolType13.js] var s = Symbol(); var x; -for (s in {}) { -} -for (x in s) { -} -for (var y in s) { -} +for (s in {}) { } +for (x in s) { } +for (var y in s) { } From bf7bb517e08b9e10003905c6cb8f2c6d39d087bb Mon Sep 17 00:00:00 2001 From: Jason Ramsay Date: Mon, 9 Feb 2015 12:56:54 -0800 Subject: [PATCH 042/162] Replace endsWith() with isDefaultLib() There are a couple of issues with using the current endsWith() function to determine if we should allow a rename for default lib files: 1. XXXX-lib.d.ts would not allow renames even though it should as the preceding characters are not being verified for directory separators 2. There is the potential for false matches as there is currently no check to verify indexOf was successful (index >= 0) --- src/services/services.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index 56e68b2f5a1..ad6643faf3c 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -5520,7 +5520,7 @@ module ts { var defaultLibFile = getDefaultLibFileName(host.getCompilationSettings()); for (var i = 0; i < declarations.length; i++) { var sourceFile = declarations[i].getSourceFile(); - if (sourceFile && endsWith(sourceFile.fileName, defaultLibFile)) { + if (sourceFile && isDefaultLibFile(sourceFile.fileName, defaultLibFile)) { return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); } } @@ -5543,8 +5543,14 @@ module ts { return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_this_element.key)); - function endsWith(string: string, value: string): boolean { - return string.lastIndexOf(value) + value.length === string.length; + function isDefaultLibFile(fileName: string, defaultLibFile: string): boolean { + var hasValidPrefix = true; + var index = fileName.lastIndexOf(defaultLibFile); + if (index - 1 >= 0) { + var prefix = fileName[index - 1]; + hasValidPrefix = (prefix === "\\" || prefix === "/"); + } + return index >= 0 && hasValidPrefix && (index + defaultLibFile.length === fileName.length); } function getRenameInfoError(localizedErrorMessage: string): RenameInfo { From 18276e526754b14d1f0f30ef794f19a64d193767 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 10 Feb 2015 16:13:28 -0800 Subject: [PATCH 043/162] Address feedback from @yuit --- src/compiler/checker.ts | 64 +++++++++++-------- .../diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- src/compiler/utilities.ts | 5 ++ .../reference/symbolProperty59.errors.txt | 9 +++ tests/baselines/reference/symbolProperty59.js | 6 ++ .../reference/symbolType12.errors.txt | 12 ++-- .../reference/symbolType3.errors.txt | 16 ++--- .../reference/symbolType6.errors.txt | 24 +++---- .../reference/symbolType8.errors.txt | 40 ++++++------ .../es6/Symbols/symbolProperty59.ts | 4 ++ 11 files changed, 110 insertions(+), 74 deletions(-) create mode 100644 tests/baselines/reference/symbolProperty59.errors.txt create mode 100644 tests/baselines/reference/symbolProperty59.js create mode 100644 tests/cases/conformance/es6/Symbols/symbolProperty59.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 349edf4b609..ad417c4c8d8 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2502,9 +2502,9 @@ module ts { return getPropertiesOfObjectType(getApparentType(type)); } - // For a type parameter, return the base constraint of the type parameter. For the string, number, and - // boolean primitive types, return the corresponding object types.Otherwise return the type itself. - // Note that the apparent type of a union type is the union type itself. + // For a type parameter, return the base constraint of the type parameter. For the string, number, + // boolean, and symbol primitive types, return the corresponding object types.Otherwise return the + // type itself. Note that the apparent type of a union type is the union type itself. function getApparentType(type: Type): Type { if (type.flags & TypeFlags.TypeParameter) { do { @@ -5543,8 +5543,8 @@ module ts { if (!isTypeOfKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.ESSymbol)) { error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } - else if (isWellKnownSymbolSyntactically(node.expression)) { - checkSymbolNameIsProperSymbolReference(node.expression, links.resolvedType, /*reportError*/ true); + else { + checkThatExpressionIsProperSymbolReference(node.expression, links.resolvedType, /*reportError*/ true); } } @@ -5848,11 +5848,9 @@ module ts { if (indexArgumentExpression.kind === SyntaxKind.StringLiteral || indexArgumentExpression.kind === SyntaxKind.NumericLiteral) { return (indexArgumentExpression).text; } - if (isWellKnownSymbolSyntactically(indexArgumentExpression)) { - if (checkSymbolNameIsProperSymbolReference(indexArgumentExpression, indexArgumentType, /*reportError*/ false)) { - var rightHandSideName = ((indexArgumentExpression).name).text; - return getPropertyNameForKnownSymbolName(rightHandSideName); - } + if (checkThatExpressionIsProperSymbolReference(indexArgumentExpression, indexArgumentType, /*reportError*/ false)) { + var rightHandSideName = ((indexArgumentExpression).name).text; + return getPropertyNameForKnownSymbolName(rightHandSideName); } return undefined; @@ -5860,34 +5858,33 @@ module ts { /** * A proper symbol reference requires the following: - * 1. The expression is of the form Symbol. - * 2. Symbol in this context resolves to the global Symbol object - * 3. The property access denotes a property that is present on the global Symbol object - * 4. The property on the global Symbol object is of the primitive type symbol. + * 1. The property access denotes a property that exists + * 2. The expression is of the form Symbol. + * 3. The property access is of the primitive type symbol. + * 4. Symbol in this context resolves to the global Symbol object */ - function checkSymbolNameIsProperSymbolReference(wellKnownSymbolName: PropertyAccessExpression, propertyNameType: Type, reportError: boolean): boolean { - if (propertyNameType === unknownType) { + function checkThatExpressionIsProperSymbolReference(expression: Expression, expressionType: Type, reportError: boolean): boolean { + if (expressionType === unknownType) { // There is already an error, so no need to report one. return false; } - Debug.assert(isWellKnownSymbolSyntactically(wellKnownSymbolName)); + if (!isWellKnownSymbolSyntactically(expression)) { + return false; + } // Make sure the property type is the primitive symbol type - if ((propertyNameType.flags & TypeFlags.ESSymbol) === 0) { + if ((expressionType.flags & TypeFlags.ESSymbol) === 0) { if (reportError) { - error(wellKnownSymbolName, Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, getTextOfNode(wellKnownSymbolName)); + error(expression, Diagnostics.A_computed_property_name_of_the_form_0_must_be_of_type_symbol, getTextOfNode(expression)); } return false; } // The name is Symbol., so make sure Symbol actually resolves to the // global Symbol object - var leftHandSide = (wellKnownSymbolName).expression; - // Look up the global symbol, but don't report an error, since checking the actual expression - // would have reported an error. - var leftHandSideSymbol = resolveName(wellKnownSymbolName, (leftHandSide).text, - SymbolFlags.Value, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined); + var leftHandSide = (expression).expression; + var leftHandSideSymbol = getResolvedSymbol(leftHandSide); if (!leftHandSideSymbol) { return false; } @@ -6936,7 +6933,7 @@ module ts { case SyntaxKind.MinusToken: case SyntaxKind.TildeToken: if (hasSomeTypeOfKind(operandType, TypeFlags.ESSymbol)) { - error(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_a_value_of_type_symbol, tokenToString(node.operator)); + error(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator)); } return numberType; case SyntaxKind.ExclamationToken: @@ -7270,7 +7267,7 @@ module ts { hasSomeTypeOfKind(rightType, TypeFlags.ESSymbol) ? node.right : undefined; if (offendingSymbolOperand) { - error(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_a_value_of_type_symbol, tokenToString(operator)); + error(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator)); return false; } @@ -7362,6 +7359,9 @@ module ts { } function checkPropertyAssignment(node: PropertyAssignment, contextualMapper?: TypeMapper): Type { + // Do not use hasDynamicName here, because that returns false for well known symbols. + // We want to perform checkComputedPropertyName for all computed properties, including + // well known symbols. if (node.name.kind === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.name); } @@ -7373,6 +7373,9 @@ module ts { // Grammar checking checkGrammarMethod(node); + // Do not use hasDynamicName here, because that returns false for well known symbols. + // We want to perform checkComputedPropertyName for all computed properties, including + // well known symbols. if (node.name.kind === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.name); } @@ -8185,6 +8188,9 @@ module ts { function checkFunctionLikeDeclaration(node: FunctionLikeDeclaration): void { checkSignatureDeclaration(node); + // Do not use hasDynamicName here, because that returns false for well known symbols. + // We want to perform checkComputedPropertyName for all computed properties, including + // well known symbols. if (node.name.kind === SyntaxKind.ComputedPropertyName) { // This check will account for methods in class/interface declarations, // as well as accessors in classes/object literals @@ -8420,6 +8426,9 @@ module ts { function checkVariableLikeDeclaration(node: VariableLikeDeclaration) { checkSourceElement(node.type); // For a computed property, just check the initializer and exit + // Do not use hasDynamicName here, because that returns false for well known symbols. + // We want to perform checkComputedPropertyName for all computed properties, including + // well known symbols. if (node.name.kind === SyntaxKind.ComputedPropertyName) { checkComputedPropertyName(node.name); if (node.initializer) { @@ -11159,6 +11168,9 @@ module ts { var inAmbientContext = isInAmbientContext(enumDecl); for (var i = 0, n = enumDecl.members.length; i < n; i++) { var node = enumDecl.members[i]; + // Do not use hasDynamicName here, because that returns false for well known symbols. + // We want to perform checkComputedPropertyName for all computed properties, including + // well known symbols. if (node.name.kind === SyntaxKind.ComputedPropertyName) { hasError = grammarErrorOnNode(node.name, Diagnostics.Computed_property_names_are_not_allowed_in_enums); } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 9745f251e66..7d5681c706a 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -304,7 +304,7 @@ module ts { super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in a computed property name." }, A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2467, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." }, Cannot_find_global_value_0: { code: 2468, category: DiagnosticCategory.Error, key: "Cannot find global value '{0}'." }, - The_0_operator_cannot_be_applied_to_a_value_of_type_symbol: { code: 2469, category: DiagnosticCategory.Error, key: "The '{0}' operator cannot be applied to a value of type 'symbol'." }, + The_0_operator_cannot_be_applied_to_type_symbol: { code: 2469, category: DiagnosticCategory.Error, key: "The '{0}' operator cannot be applied to type 'symbol'." }, Symbol_reference_does_not_refer_to_the_global_Symbol_constructor_object: { code: 2470, category: DiagnosticCategory.Error, key: "'Symbol' reference does not refer to the global Symbol constructor object." }, A_computed_property_name_of_the_form_0_must_be_of_type_symbol: { code: 2471, category: DiagnosticCategory.Error, key: "A computed property name of the form '{0}' must be of type 'symbol'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index fd09a49d3fb..e3c3be59a01 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1208,7 +1208,7 @@ "category": "Error", "code": 2468 }, - "The '{0}' operator cannot be applied to a value of type 'symbol'.": { + "The '{0}' operator cannot be applied to type 'symbol'.": { "category": "Error", "code": 2469 }, diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 16d2303a16e..0656bed7d5f 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -848,6 +848,11 @@ module ts { !isWellKnownSymbolSyntactically((declaration.name).expression); } + /** + * Checks if the expression is of the form: + * Symbol.name + * where Symbol is literally the word "Symbol", and name is any identifierName + */ export function isWellKnownSymbolSyntactically(node: Expression): boolean { return node.kind === SyntaxKind.PropertyAccessExpression && isESSymbolIdentifier((node).expression); } diff --git a/tests/baselines/reference/symbolProperty59.errors.txt b/tests/baselines/reference/symbolProperty59.errors.txt new file mode 100644 index 00000000000..dfb2ece3d21 --- /dev/null +++ b/tests/baselines/reference/symbolProperty59.errors.txt @@ -0,0 +1,9 @@ +tests/cases/conformance/es6/Symbols/symbolProperty59.ts(2,5): error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + + +==== tests/cases/conformance/es6/Symbols/symbolProperty59.ts (1 errors) ==== + interface I { + [Symbol.keyFor]: string; + ~~~~~~~~~~~~~~~ +!!! error TS2464: A computed property name must be of type 'string', 'number', 'symbol', or 'any'. + } \ No newline at end of file diff --git a/tests/baselines/reference/symbolProperty59.js b/tests/baselines/reference/symbolProperty59.js new file mode 100644 index 00000000000..78d1d212f28 --- /dev/null +++ b/tests/baselines/reference/symbolProperty59.js @@ -0,0 +1,6 @@ +//// [symbolProperty59.ts] +interface I { + [Symbol.keyFor]: string; +} + +//// [symbolProperty59.js] diff --git a/tests/baselines/reference/symbolType12.errors.txt b/tests/baselines/reference/symbolType12.errors.txt index 85db01ff5d2..adceb58ae56 100644 --- a/tests/baselines/reference/symbolType12.errors.txt +++ b/tests/baselines/reference/symbolType12.errors.txt @@ -9,8 +9,8 @@ tests/cases/conformance/es6/Symbols/symbolType12.ts(7,6): error TS2363: The righ tests/cases/conformance/es6/Symbols/symbolType12.ts(8,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es6/Symbols/symbolType12.ts(9,1): error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'symbol'. tests/cases/conformance/es6/Symbols/symbolType12.ts(10,1): error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'number'. -tests/cases/conformance/es6/Symbols/symbolType12.ts(11,1): error TS2469: The '+=' operator cannot be applied to a value of type 'symbol'. -tests/cases/conformance/es6/Symbols/symbolType12.ts(12,8): error TS2469: The '+=' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(11,1): error TS2469: The '+=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(12,8): error TS2469: The '+=' operator cannot be applied to type 'symbol'. tests/cases/conformance/es6/Symbols/symbolType12.ts(13,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es6/Symbols/symbolType12.ts(13,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es6/Symbols/symbolType12.ts(14,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -32,7 +32,7 @@ tests/cases/conformance/es6/Symbols/symbolType12.ts(24,1): error TS2362: The lef tests/cases/conformance/es6/Symbols/symbolType12.ts(25,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es6/Symbols/symbolType12.ts(25,6): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es6/Symbols/symbolType12.ts(26,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es6/Symbols/symbolType12.ts(28,8): error TS2469: The '+=' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType12.ts(28,8): error TS2469: The '+=' operator cannot be applied to type 'symbol'. ==== tests/cases/conformance/es6/Symbols/symbolType12.ts (35 errors) ==== @@ -70,10 +70,10 @@ tests/cases/conformance/es6/Symbols/symbolType12.ts(28,8): error TS2469: The '+= !!! error TS2365: Operator '+=' cannot be applied to types 'symbol' and 'number'. s += ""; ~ -!!! error TS2469: The '+=' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '+=' operator cannot be applied to type 'symbol'. str += s; ~ -!!! error TS2469: The '+=' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '+=' operator cannot be applied to type 'symbol'. s -= s; ~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. @@ -133,4 +133,4 @@ tests/cases/conformance/es6/Symbols/symbolType12.ts(28,8): error TS2469: The '+= str += (s || str); ~~~~~~~~~~ -!!! error TS2469: The '+=' operator cannot be applied to a value of type 'symbol'. \ No newline at end of file +!!! error TS2469: The '+=' operator cannot be applied to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType3.errors.txt b/tests/baselines/reference/symbolType3.errors.txt index 384ccb06c05..7cc9e82b3b3 100644 --- a/tests/baselines/reference/symbolType3.errors.txt +++ b/tests/baselines/reference/symbolType3.errors.txt @@ -1,9 +1,9 @@ tests/cases/conformance/es6/Symbols/symbolType3.ts(5,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. tests/cases/conformance/es6/Symbols/symbolType3.ts(6,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es6/Symbols/symbolType3.ts(7,3): error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. -tests/cases/conformance/es6/Symbols/symbolType3.ts(8,3): error TS2469: The '-' operator cannot be applied to a value of type 'symbol'. -tests/cases/conformance/es6/Symbols/symbolType3.ts(9,3): error TS2469: The '~' operator cannot be applied to a value of type 'symbol'. -tests/cases/conformance/es6/Symbols/symbolType3.ts(12,2): error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType3.ts(7,3): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType3.ts(8,3): error TS2469: The '-' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType3.ts(9,3): error TS2469: The '~' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType3.ts(12,2): error TS2469: The '+' operator cannot be applied to type 'symbol'. ==== tests/cases/conformance/es6/Symbols/symbolType3.ts (6 errors) ==== @@ -19,15 +19,15 @@ tests/cases/conformance/es6/Symbols/symbolType3.ts(12,2): error TS2469: The '+' !!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. + Symbol(); ~~~~~~~~ -!!! error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. - Symbol(); ~~~~~~~~ -!!! error TS2469: The '-' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '-' operator cannot be applied to type 'symbol'. ~ Symbol(); ~~~~~~~~ -!!! error TS2469: The '~' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '~' operator cannot be applied to type 'symbol'. ! Symbol(); +(Symbol() || 0); ~~~~~~~~~~~~~~~ -!!! error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. \ No newline at end of file +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType6.errors.txt b/tests/baselines/reference/symbolType6.errors.txt index 9ad7321063f..29d894c2afb 100644 --- a/tests/baselines/reference/symbolType6.errors.txt +++ b/tests/baselines/reference/symbolType6.errors.txt @@ -1,16 +1,16 @@ tests/cases/conformance/es6/Symbols/symbolType6.ts(3,1): error TS2365: Operator '+' cannot be applied to types 'symbol' and 'symbol'. tests/cases/conformance/es6/Symbols/symbolType6.ts(4,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/es6/Symbols/symbolType6.ts(4,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es6/Symbols/symbolType6.ts(5,1): error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. -tests/cases/conformance/es6/Symbols/symbolType6.ts(6,1): error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(5,1): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(6,1): error TS2469: The '+' operator cannot be applied to type 'symbol'. tests/cases/conformance/es6/Symbols/symbolType6.ts(7,1): error TS2365: Operator '+' cannot be applied to types 'symbol' and 'number'. -tests/cases/conformance/es6/Symbols/symbolType6.ts(8,6): error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. -tests/cases/conformance/es6/Symbols/symbolType6.ts(9,5): error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(8,6): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(9,5): error TS2469: The '+' operator cannot be applied to type 'symbol'. tests/cases/conformance/es6/Symbols/symbolType6.ts(10,1): error TS2365: Operator '+' cannot be applied to types 'number' and 'symbol'. tests/cases/conformance/es6/Symbols/symbolType6.ts(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/es6/Symbols/symbolType6.ts(12,5): error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. -tests/cases/conformance/es6/Symbols/symbolType6.ts(14,1): error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. -tests/cases/conformance/es6/Symbols/symbolType6.ts(15,6): error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(14,1): error TS2469: The '+' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType6.ts(15,6): error TS2469: The '+' operator cannot be applied to type 'symbol'. ==== tests/cases/conformance/es6/Symbols/symbolType6.ts (13 errors) ==== @@ -26,19 +26,19 @@ tests/cases/conformance/es6/Symbols/symbolType6.ts(15,6): error TS2469: The '+' !!! error TS2363: The right-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. s + ""; ~ -!!! error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. s + a; ~ -!!! error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. s + 0; ~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'symbol' and 'number'. "" + s; ~ -!!! error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. a + s; ~ -!!! error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. 0 + s; ~~~~~ !!! error TS2365: Operator '+' cannot be applied to types 'number' and 'symbol'. @@ -51,7 +51,7 @@ tests/cases/conformance/es6/Symbols/symbolType6.ts(15,6): error TS2469: The '+' (s || "") + ""; ~~~~~~~~~ -!!! error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. "" + (s || ""); ~~~~~~~~~ -!!! error TS2469: The '+' operator cannot be applied to a value of type 'symbol'. \ No newline at end of file +!!! error TS2469: The '+' operator cannot be applied to type 'symbol'. \ No newline at end of file diff --git a/tests/baselines/reference/symbolType8.errors.txt b/tests/baselines/reference/symbolType8.errors.txt index e72d0d619e4..8df7db61feb 100644 --- a/tests/baselines/reference/symbolType8.errors.txt +++ b/tests/baselines/reference/symbolType8.errors.txt @@ -1,45 +1,45 @@ -tests/cases/conformance/es6/Symbols/symbolType8.ts(2,1): error TS2469: The '<' operator cannot be applied to a value of type 'symbol'. -tests/cases/conformance/es6/Symbols/symbolType8.ts(3,1): error TS2469: The '<' operator cannot be applied to a value of type 'symbol'. -tests/cases/conformance/es6/Symbols/symbolType8.ts(4,1): error TS2469: The '>' operator cannot be applied to a value of type 'symbol'. -tests/cases/conformance/es6/Symbols/symbolType8.ts(5,1): error TS2469: The '>' operator cannot be applied to a value of type 'symbol'. -tests/cases/conformance/es6/Symbols/symbolType8.ts(6,1): error TS2469: The '<=' operator cannot be applied to a value of type 'symbol'. -tests/cases/conformance/es6/Symbols/symbolType8.ts(7,1): error TS2469: The '<=' operator cannot be applied to a value of type 'symbol'. -tests/cases/conformance/es6/Symbols/symbolType8.ts(8,1): error TS2469: The '>=' operator cannot be applied to a value of type 'symbol'. -tests/cases/conformance/es6/Symbols/symbolType8.ts(9,1): error TS2469: The '>=' operator cannot be applied to a value of type 'symbol'. -tests/cases/conformance/es6/Symbols/symbolType8.ts(11,6): error TS2469: The '>=' operator cannot be applied to a value of type 'symbol'. -tests/cases/conformance/es6/Symbols/symbolType8.ts(12,1): error TS2469: The '>=' operator cannot be applied to a value of type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(2,1): error TS2469: The '<' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(3,1): error TS2469: The '<' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(4,1): error TS2469: The '>' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(5,1): error TS2469: The '>' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(6,1): error TS2469: The '<=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(7,1): error TS2469: The '<=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(8,1): error TS2469: The '>=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(9,1): error TS2469: The '>=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(11,6): error TS2469: The '>=' operator cannot be applied to type 'symbol'. +tests/cases/conformance/es6/Symbols/symbolType8.ts(12,1): error TS2469: The '>=' operator cannot be applied to type 'symbol'. ==== tests/cases/conformance/es6/Symbols/symbolType8.ts (10 errors) ==== var s = Symbol.for("compare"); s < s; ~ -!!! error TS2469: The '<' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '<' operator cannot be applied to type 'symbol'. s < 0; ~ -!!! error TS2469: The '<' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '<' operator cannot be applied to type 'symbol'. s > s; ~ -!!! error TS2469: The '>' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '>' operator cannot be applied to type 'symbol'. s > 0; ~ -!!! error TS2469: The '>' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '>' operator cannot be applied to type 'symbol'. s <= s; ~ -!!! error TS2469: The '<=' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '<=' operator cannot be applied to type 'symbol'. s <= 0; ~ -!!! error TS2469: The '<=' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '<=' operator cannot be applied to type 'symbol'. s >= s; ~ -!!! error TS2469: The '>=' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '>=' operator cannot be applied to type 'symbol'. s >= 0; ~ -!!! error TS2469: The '>=' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '>=' operator cannot be applied to type 'symbol'. 0 >= (s || 0); ~~~~~~~~ -!!! error TS2469: The '>=' operator cannot be applied to a value of type 'symbol'. +!!! error TS2469: The '>=' operator cannot be applied to type 'symbol'. (s || 0) >= s; ~~~~~~~~ -!!! error TS2469: The '>=' operator cannot be applied to a value of type 'symbol'. \ No newline at end of file +!!! error TS2469: The '>=' operator cannot be applied to type 'symbol'. \ No newline at end of file diff --git a/tests/cases/conformance/es6/Symbols/symbolProperty59.ts b/tests/cases/conformance/es6/Symbols/symbolProperty59.ts new file mode 100644 index 00000000000..bdea9dab62c --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolProperty59.ts @@ -0,0 +1,4 @@ +//@target: ES6 +interface I { + [Symbol.keyFor]: string; +} \ No newline at end of file From 9735b74def6e1f6e35788bc9a09ca8323ad7eb41 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 11 Feb 2015 16:12:33 -0800 Subject: [PATCH 044/162] Add support for stat and modified time on sys --- src/compiler/sys.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index 5f10a747d42..c666ca991cf 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -18,6 +18,8 @@ module ts { readDirectory(path: string, extension?: string): string[]; getMemoryUsage? (): number; exit(exitCode?: number): void; + getModififedTime? (fileName: string): Date; + stat? (fileName: string, callback?: (err: any, stats: any) => any): void; } export interface FileWatcher { @@ -303,6 +305,13 @@ module ts { }, exit(exitCode?: number): void { process.exit(exitCode); + }, + getModififedTime(fileName: string): Date { + var stats = _fs.statSync(fileName); + return stats.mtime; + }, + stat(fileName: string, callback?: (err: any, stats: any) => any) { + _fs.stat(fileName, callback); } }; } From 27a908478570c4a36d0a80f7f94d043b34238969 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 11 Feb 2015 16:13:04 -0800 Subject: [PATCH 045/162] Add indexer on the Formatting options interface --- src/services/services.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/services/services.ts b/src/services/services.ts index 56e68b2f5a1..05884b9bb98 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -991,6 +991,7 @@ module ts { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number| string; } export interface DefinitionInfo { From 17f19b26a03a2f7fc1c5c35214c27d174e05f375 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 11 Feb 2015 19:42:44 -0800 Subject: [PATCH 046/162] Initial checkin for server code --- src/server/client.ts | 392 +++++++ src/server/editorServices.ts | 1850 ++++++++++++++++++++++++++++++++++ src/server/node.d.ts | 677 +++++++++++++ src/server/protocol.ts | 1309 ++++++++++++++++++++++++ src/server/protodef.d.ts | 591 +++++++++++ src/server/server.ts | 134 +++ 6 files changed, 4953 insertions(+) create mode 100644 src/server/client.ts create mode 100644 src/server/editorServices.ts create mode 100644 src/server/node.d.ts create mode 100644 src/server/protocol.ts create mode 100644 src/server/protodef.d.ts create mode 100644 src/server/server.ts diff --git a/src/server/client.ts b/src/server/client.ts new file mode 100644 index 00000000000..1fb93329e03 --- /dev/null +++ b/src/server/client.ts @@ -0,0 +1,392 @@ +/// + +module ts.server { + + export interface SessionClientHost extends LanguageServiceHost { + lineColToPosition(fileName: string, line: number, col: number): number; + positionToZeroBasedLineCol(fileName: string, position: number): ts.LineAndCharacter; + } + + export class SessionClient implements LanguageService { + private session: Session; + private sequence: number; + private lastReply: string; + + constructor(private host: SessionClientHost) { + this.sequence = 0; + + this.session = new Session({ + args: [], + newLine: host.getNewLine(), + useCaseSensitiveFileNames: true, + write: (s) => this.lastReply = s, + readFile: (fileName): string => { + var snapshot = host.getScriptSnapshot(fileName); + return snapshot && snapshot.getText(0, snapshot.getLength()); + }, + writeFile: (name, text, writeByteOrderMark) => { + }, + resolvePath: (path) => path, + fileExists: (path) => !!host.getScriptSnapshot(path), + directoryExists: (path) => false, + getExecutingFilePath: () => "", + exit: (exitCode) => { }, + createDirectory: (directoryName: string) => { }, + + getCurrentDirectory: () => host.getCurrentDirectory(), + readDirectory: (path: string, extension?: string) => [], + getModififedTime: (fileName) => new Date(), + stat: (path, callback) => { throw new Error("Not implemented Yet."); }, + }, { + close: () => { }, + info: (m) => this.host.log(m), + msg: (m) => this.host.log(m), + endGroup: () => { }, + perftrc: (m) => this.host.log(m), + startGroup: () => { } + }, /* useProtocol */ true, /*prettyJSON*/ true); + } + + private lineColToPosition(fileName: string, lineCol: ServerProtocol.LineCol): number { + return this.host.lineColToPosition(fileName, lineCol.line, lineCol.col); + } + + private getFileLength(fileName: string): number { + return this.host.getScriptSnapshot(fileName).getLength(); + } + + private positionToOneBasedLineCol(fileName: string, position: number): ServerProtocol.LineCol { + var lineCol = this.host.positionToZeroBasedLineCol(fileName, position); + return { + line: lineCol.line + 1, + col: lineCol.character + 1 + }; + } + + private convertCodeEditsToTextChange(fileName: string, codeEdit: ServerProtocol.CodeEdit): ts.TextChange { + var start = this.lineColToPosition(fileName, codeEdit.start); + var end = this.lineColToPosition(fileName, codeEdit.end); + + return { + span: ts.createTextSpanFromBounds(start, end), + newText: codeEdit.newText + }; + } + + private processRequest(command: "open", arguments: ServerProtocol.FileRequestArgs): ServerProtocol.OpenRequest; + private processRequest(command: "close", arguments: ServerProtocol.FileRequestArgs): ServerProtocol.CloseRequest; + private processRequest(command: "change", arguments: ServerProtocol.ChangeRequestArgs): ServerProtocol.ChangeRequest; + private processRequest(command: "quickinfo", arguments: ServerProtocol.FileRequestArgs): ServerProtocol.QuickInfoRequest; + private processRequest(command: "format", arguments: ServerProtocol.FormatRequestArgs): ServerProtocol.FormatRequest; + private processRequest(command: "formatonkey", arguments: ServerProtocol.FormatOnKeyRequestArgs): ServerProtocol.FormatRequest; + private processRequest(command: "definition", arguments: ServerProtocol.FileRequestArgs): ServerProtocol.DefinitionRequest; + private processRequest(command: "references", arguments: ServerProtocol.FileRequestArgs): ServerProtocol.ReferencesRequest; + private processRequest(command: "completions", arguments: ServerProtocol.CompletionsRequestArgs): ServerProtocol.CompletionsRequest; + private processRequest(command: "navto", arguments: ServerProtocol.NavtoRequestArgs): ServerProtocol.NavtoRequest; + private processRequest(command: "saveto", arguments: ServerProtocol.SavetoRequestArgs): ServerProtocol.SavetoRequest; + private processRequest(command: string, arguments: any): ServerProtocol.Request; + private processRequest(command: string, arguments: any): ServerProtocol.Request { + var request: ServerProtocol.Request = { + seq: this.sequence++, + type: "request", + command: command, + arguments: arguments + }; + + this.session.executeJSONcmd(JSON.stringify(request)); + + return request; + } + + private processResponse(request: ServerProtocol.Request): T { + debugger; + + // Read the content length + var contentLengthPrefix = "Content-Length: "; + var lines = this.lastReply.split("\r\n"); + Debug.assert(lines.length >= 2, "Malformed response: Expected 3 lines in the response."); + + var contentLengthText = lines[0]; + Debug.assert(contentLengthText.indexOf(contentLengthPrefix) === 0, "Malformed response: Response text did not contain content-length header."); + var contentLength = parseInt(contentLengthText.substring(contentLengthPrefix.length)); + + // Read the body + var responseBody = lines[2]; + + // Verify content length + Debug.assert(responseBody.length + 1 === contentLength, "Malformed response: Content length did not match the response's body length."); + + try { + var response: T = JSON.parse(responseBody); + } + catch (e) { + throw new Error("Malformed response: Failed to parse server response: " + this.lastReply + ". \r\n Error detailes: " + e.message); + } + + // verify the sequence numbers + Debug.assert(response.request_seq === request.seq, "Malformed response: response sequance number did not match request sequence number."); + + // unmarshal errors + if (!response.success) { + throw new Error("Error " + response.message); + } + + Debug.assert(!!response.body, "Malformed response: Unexpected empty response body."); + + return response; + } + + openFile(fileName: string): void { + this.processRequest("open", { + file: fileName + }); + } + + closeFile(fileName: string): void { + this.processRequest("close", { + file: fileName + }); + } + + changeFile(fileName: string, start: number, end: number, newText: string): void { + var lineCol = this.positionToOneBasedLineCol(fileName, start); + + this.processRequest("change", { + file: fileName, + line: lineCol.line, + col: lineCol.col, + insertLen: end - start, + deleteLen: end - start, + insertString: newText + }); + } + + getQuickInfoAtPosition(fileName: string, position: number): QuickInfo { + var request = this.processRequest("quickinfo", { + file: fileName, + line: 0, + col: 1 + }); + + var response = this.processResponse(request); + + var start = this.lineColToPosition(fileName, response.body.start); + var end = this.lineColToPosition(fileName, response.body.end); + + return { + kind: response.body.kind, + kindModifiers: response.body.kindModifiers, + textSpan: ts.createTextSpanFromBounds(start, end), + displayParts: undefined, + documentation: undefined, + documentationString: response.body.documentation, + displayString: response.body.displayString + }; + } + + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var request = this.processRequest("completions", { + file: fileName, + line: lineCol.line, + col: lineCol.col, + }); + + var response = this.processResponse(request); + + return { + isMemberCompletion: false, + isNewIdentifierLocation: false, + entries: response.body.map(entry => ({ kind: entry.kind, kindModifiers: entry.kindModifiers, name: entry.name })) + }; + } + + getNavigateToItems(seatchTerm: string): NavigateToItem[] { + var request = this.processRequest("navto", { seatchTerm }); + + var response = this.processResponse(request); + return response.body.map(entry => { + var start = this.lineColToPosition(entry.file.toString(), entry.start); + var end = this.lineColToPosition(entry.file.toString(), entry.end); + return { + name: entry.name, + containerName: entry.containerName, + containerKind: entry.containerKind, + kind: entry.kind, + kindModifiers: entry.kindModifiers, + matchKind: entry.matchKind, + fileName: entry.file.toString(), + textSpan: ts.createTextSpanFromBounds(start, end) + }; + }); + } + + getFormattingEditsForRange(fileName: string, start: number, end: number, options: ts.FormatCodeOptions): ts.TextChange[] { + var startLineCol = this.positionToOneBasedLineCol(fileName, start); + var endLineCol = this.positionToOneBasedLineCol(fileName, end); + // TODO: handle FormatCodeOptions + var request = this.processRequest("format", { + file: fileName, + line: startLineCol.line, + col: startLineCol.col, + endLine: endLineCol.line, + endCol: endLineCol.col, + }); + + var response = this.processResponse(request); + + return response.body.map(entry=> this.convertCodeEditsToTextChange(fileName, entry)); + } + + getFormattingEditsForDocument(fileName: string, options: ts.FormatCodeOptions): ts.TextChange[] { + return this.getFormattingEditsForRange(fileName, 0, this.getFileLength(fileName), options); + } + + getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): ts.TextChange[] { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + // TODO: handle FormatCodeOptions + var request = this.processRequest("formatonkey", { + file: fileName, + line: lineCol.line, + col: lineCol.col, + key: key + }); + + var response = this.processResponse(request); + return response.body.map(entry=> this.convertCodeEditsToTextChange(fileName, entry)); + } + + getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var request = this.processRequest("definition", { + file: fileName, + line: lineCol.line, + col: lineCol.col, + }); + + var response = this.processResponse(request); + return response.body.map(entry => { + var start = this.lineColToPosition(fileName, entry.start); + var end = this.lineColToPosition(fileName, entry.end); + return { + containerKind: "", + containerName: "", + fileName: entry.file, + textSpan: ts.createTextSpanFromBounds(start, end), + kind: "", + name: "" + }; + }); + } + + getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[] { + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var request = this.processRequest("references", { + file: fileName, + line: lineCol.line, + col: lineCol.col, + }); + + var response = this.processResponse(request); + + return response.body.refs.map(entry => { + var start = this.lineColToPosition(fileName, entry.start); + var end = this.lineColToPosition(fileName, entry.end); + return { + fileName: entry.file, + textSpan: ts.createTextSpanFromBounds(start, end), + isWriteAccess: false, + }; + }); + } + + getEmitOutput(fileName: string): EmitOutput { + throw new Error("Not Implemented Yet."); + } + + getSyntacticDiagnostics(fileName: string): Diagnostic[] { + throw new Error("Not Implemented Yet."); + } + + getSemanticDiagnostics(fileName: string): Diagnostic[] { + throw new Error("Not Implemented Yet."); + } + + getCompilerOptionsDiagnostics(): Diagnostic[] { + throw new Error("Not Implemented Yet."); + } + + getRenameInfo(fileName: string, position: number): RenameInfo { + throw new Error("Not Implemented Yet."); + } + + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[] { + throw new Error("Not Implemented Yet."); + } + + getNavigationBarItems(fileName: string): NavigationBarItem[] { + throw new Error("Not Implemented Yet."); + } + + getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan { + throw new Error("Not Implemented Yet."); + } + + getBreakpointStatementAtPosition(fileName: string, position: number): TextSpan { + throw new Error("Not Implemented Yet."); + } + + getSignatureHelpItems(fileName: string, position: number): SignatureHelpItems { + throw new Error("Not Implemented Yet."); + } + + getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[] { + throw new Error("Not Implemented Yet."); + } + + getOutliningSpans(fileName: string): OutliningSpan[] { + throw new Error("Not Implemented Yet."); + } + + getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[] { + throw new Error("Not Implemented Yet."); + } + + getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[] { + throw new Error("Not Implemented Yet."); + } + + getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number { + throw new Error("Not Implemented Yet."); + } + + getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] { + throw new Error("Not Implemented Yet."); + } + + getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] { + throw new Error("Not Implemented Yet."); + } + + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails { + throw new Error("Not Implemented Yet."); + } + + + getProgram(): Program { + throw new Error("SourceFile objects are not serializable through the server protocol."); + } + + getSourceFile(fileName: string): SourceFile { + throw new Error("SourceFile objects are not serializable through the server protocol."); + } + + cleanupSemanticCache(): void { + throw new Error("cleanupSemanticCache is not available through the server layer."); + } + + dispose(): void { + throw new Error("dispose is not available through the server layer."); + } + } +} diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts new file mode 100644 index 00000000000..933435f93a1 --- /dev/null +++ b/src/server/editorServices.ts @@ -0,0 +1,1850 @@ +/// +/// +/// + +module ts.server { + export interface Logger { + close(): void; + perftrc(s: string): void; + info(s: string): void; + startGroup(): void; + endGroup(): void; + msg(s: string, type?: string): void; + } + + var measurePerf = false; + var lineCollectionCapacity = 4; + var indentStrings: string[] = []; + var indentBase = " "; + function getIndent(indentAmt: number) { + if (!indentStrings[indentAmt]) { + indentStrings[indentAmt] = ""; + for (var i = 0; i < indentAmt; i++) { + indentStrings[indentAmt] += indentBase; + } + } + return indentStrings[indentAmt]; + } + + export function printLine(s: string) { + ts.sys.write(s + '\n'); + } + + function showLines(s: string) { + var strBuilder = ""; + for (var i = 0, len = s.length; i < len; i++) { + if (s.charCodeAt(i) == 10) { + strBuilder += '\\n'; + } + else if (s.charCodeAt(i) == 13) { + strBuilder += '\\r'; + } + else { + strBuilder += s.charAt(i); + } + } + return strBuilder; + } + + function calibrateTimer() { + var count = 20; + var total = 0; + for (var i = 0; i < count; i++) { + var start = process.hrtime(); + var elapsed = process.hrtime(start); + var elapsedNano = 1e9 * elapsed[0] + elapsed[1]; + total += elapsedNano; + } + } + + export class ScriptInfo { + svc: ScriptVersionCache; + children: ScriptInfo[] = []; // files referenced by this file + + defaultProject: Project; // project to use by default for file + mtime: Date; + + constructor(private host: ServerHost, public filename: string, public content: string, public isOpen = false) { + this.svc = ScriptVersionCache.fromString(content); + if (!isOpen) { + this.mtime = this.host.getModififedTime(filename); + } + } + + close() { + this.isOpen = false; + this.mtime = this.host.getModififedTime(this.filename); + } + + addChild(childInfo: ScriptInfo) { + this.children.push(childInfo); + } + + snap() { + return this.svc.getSnapshot(); + } + + getText() { + var snap = this.snap(); + return snap.getText(0, snap.getLength()); + } + + getLineInfo(line: number) { + var snap = this.snap(); + return snap.index.lineNumberToInfo(line); + } + + editContent(start: number, end: number, newText: string): void { + this.svc.edit(start, end - start, newText); + } + + getTextChangeRangeBetweenVersions(startVersion: number, endVersion: number): ts.TextChangeRange { + return this.svc.getTextChangesBetweenVersions(startVersion, endVersion); + } + + getChangeRange(oldSnapshot: ts.IScriptSnapshot): ts.TextChangeRange { + return this.snap().getChangeRange(oldSnapshot); + } + } + + export class CancellationToken { + public static None = new CancellationToken(); + + requestPending = false; + + constructor() { + } + + cancel() { + this.requestPending = true; + } + + reset() { + this.requestPending = false; + } + + public isCancellationRequested() { + var temp = this.requestPending; + return temp; + } + } + + export class LSHost implements ts.LanguageServiceHost { + ls: ts.LanguageService = null; + compilationSettings: ts.CompilerOptions; + filenameToScript: ts.Map = {}; + + constructor(public host: ServerHost, public project: Project, private cancellationToken: CancellationToken = CancellationToken.None) { + } + + getDefaultLibFileName() { + var nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath())); + + if (this.compilationSettings && this.compilationSettings.target == ts.ScriptTarget.ES6) { + return nodeModuleBinDir + "/lib.es6.d.ts"; + } + else { + return nodeModuleBinDir + "/lib.d.ts"; + } + } + + cancel() { + this.cancellationToken.cancel(); + } + + reset() { + this.cancellationToken.reset(); + } + + getScriptSnapshot(filename: string): ts.IScriptSnapshot { + var scriptInfo = this.getScriptInfo(filename); + if (scriptInfo) { + return scriptInfo.snap(); + } + } + + setCompilationSettings(opt: ts.CompilerOptions) { + this.compilationSettings = opt; + } + + lineAffectsRefs(filename: string, line: number) { + var info = this.getScriptInfo(filename); + var lineInfo = info.getLineInfo(line); + if (lineInfo && lineInfo.text) { + var regex = /reference|import|\/\*|\*\//; + return regex.test(lineInfo.text); + } + } + + getCompilationSettings() { + // change this to return active project settings for file + return this.compilationSettings; + } + + getScriptFileNames() { + var filenames: string[] = []; + for (var filename in this.filenameToScript) { + if (this.filenameToScript[filename] && this.filenameToScript[filename].isOpen) { + filenames.push(filename); + } + } + return filenames; + } + + getScriptVersion(filename: string) { + return this.getScriptInfo(filename).svc.latestVersion().toString(); + } + + getCancellationToken(): ts.CancellationToken { + return this.cancellationToken; + } + + getCurrentDirectory(): string { + return ""; + } + + getScriptIsOpen(filename: string) { + return this.getScriptInfo(filename).isOpen; + } + + removeReferencedFile(info: ScriptInfo) { + if (!info.isOpen) { + this.filenameToScript[info.filename] = undefined; + } + } + + getScriptInfo(filename: string): ScriptInfo { + var scriptInfo = ts.lookUp(this.filenameToScript, filename); + if (!scriptInfo) { + scriptInfo = this.project.openReferencedFile(filename); + if (scriptInfo) { + this.filenameToScript[scriptInfo.filename] = scriptInfo; + } + } + else { + } + return scriptInfo; + } + + addRoot(info: ScriptInfo) { + var scriptInfo = ts.lookUp(this.filenameToScript, info.filename); + if (!scriptInfo) { + this.filenameToScript[info.filename] = info; + return info; + } + } + + saveTo(filename: string, tmpfilename: string) { + var script = this.getScriptInfo(filename); + if (script) { + var snap = script.snap(); + this.host.writeFile(tmpfilename, snap.getText(0, snap.getLength())); + } + } + + reloadScript(filename: string, tmpfilename: string, cb: () => any) { + var script = this.getScriptInfo(filename); + if (script) { + script.svc.reloadFromFile(tmpfilename, cb); + } + } + + editScript(filename: string, start: number, end: number, newText: string) { + var script = this.getScriptInfo(filename); + if (script) { + script.editContent(start, end, newText); + return; + } + + throw new Error("No script with name '" + filename + "'"); + } + + resolvePath(path: string): string { + var start = new Date().getTime(); + var result = this.host.resolvePath(path); + return result; + } + + fileExists(path: string): boolean { + var start = new Date().getTime(); + var result = this.host.fileExists(path); + return result; + } + + directoryExists(path: string): boolean { + return this.host.directoryExists(path); + } + + /** + * @param line 1 based index + */ + lineToTextSpan(filename: string, line: number): ts.TextSpan { + var script: ScriptInfo = this.filenameToScript[filename]; + var index = script.snap().index; + + var lineInfo = index.lineNumberToInfo(line + 1); + var len: number; + if (lineInfo.leaf) { + len = lineInfo.leaf.text.length; + } + else { + var nextLineInfo = index.lineNumberToInfo(line + 2); + len = nextLineInfo.col - lineInfo.col; + } + return ts.createTextSpan(lineInfo.col, len); + } + + /** + * @param line 1 based index + * @param col 1 based index + */ + lineColToPosition(filename: string, line: number, col: number): number { + var script: ScriptInfo = this.filenameToScript[filename]; + var index = script.snap().index; + + var lineInfo = index.lineNumberToInfo(line); + // TODO: assert this column is actually on the line + return (lineInfo.col + col - 1); + } + + /** + * @param line 1-based index + * @param col 1-based index + */ + positionToLineCol(filename: string, position: number): ILineInfo { + var script: ScriptInfo = this.filenameToScript[filename]; + var index = script.snap().index; + var lineCol = index.charOffsetToLineNumberAndPos(position); + return { line: lineCol.line, col: lineCol.col + 1 }; + } + } + + // assumes normalized paths + function getAbsolutePath(filename: string, directory: string) { + var rootLength = ts.getRootLength(filename); + if (rootLength > 0) { + return filename; + } + else { + var splitFilename = filename.split('/'); + var splitDir = directory.split('/'); + var i = 0; + var dirTail = 0; + var sflen = splitFilename.length; + while ((i < sflen) && (splitFilename[i].charAt(0) == '.')) { + var dots = splitFilename[i]; + if (dots == '..') { + dirTail++; + } + else if (dots != '.') { + return undefined; + } + i++; + } + return splitDir.slice(0, splitDir.length - dirTail).concat(splitFilename.slice(i)).join('/'); + } + } + + export interface ProjectOptions { + // these fields can be present in the project file + files?: string[]; + formatCodeOptions?: ts.FormatCodeOptions; + compilerOptions?: ts.CompilerOptions; + } + + export class Project { + compilerService: CompilerService; + projectOptions: ProjectOptions; + projectFilename: string; + program: ts.Program; + filenameToSourceFile: ts.Map = {}; + updateGraphSeq = 0; + + constructor(public projectService: ProjectService) { + this.compilerService = new CompilerService(this); + } + + openReferencedFile(filename: string) { + return this.projectService.openFile(filename, false); + } + + getSourceFile(info: ScriptInfo) { + return this.filenameToSourceFile[info.filename]; + } + + getSourceFileFromName(filename: string) { + var info = this.projectService.getScriptInfo(filename); + if (info) { + return this.getSourceFile(info); + } + } + + removeReferencedFile(info: ScriptInfo) { + this.compilerService.host.removeReferencedFile(info); + this.updateGraph(); + } + + updateFileMap() { + this.filenameToSourceFile = {}; + var sourceFiles = this.program.getSourceFiles(); + for (var i = 0, len = sourceFiles.length; i < len; i++) { + var normFilename = ts.normalizePath(sourceFiles[i].fileName); + this.filenameToSourceFile[normFilename] = sourceFiles[i]; + } + } + + finishGraph() { + this.updateGraph(); + this.compilerService.languageService.getNavigateToItems(".*"); + } + + updateGraph() { + this.program = this.compilerService.languageService.getProgram(); + this.updateFileMap(); + } + + isConfiguredProject() { + return this.projectFilename; + } + + // add a root file to project + addRoot(info: ScriptInfo) { + info.defaultProject = this; + return this.compilerService.host.addRoot(info); + } + + filesToString() { + var strBuilder = ""; + ts.forEachValue(this.filenameToSourceFile, + sourceFile => { strBuilder += sourceFile.fileName + "\n"; }); + return strBuilder; + } + + setProjectOptions(projectOptions: ProjectOptions) { + this.projectOptions = projectOptions; + if (projectOptions.compilerOptions) { + this.compilerService.setCompilerOptions(projectOptions.compilerOptions); + } + // TODO: format code options } + } + + export interface ProjectOpenResult { + success?: boolean; + errorMsg?: string; + project?: Project; + } + + function copyListRemovingItem(item: T, list: T[]) { + var copiedList: T[] = []; + for (var i = 0, len = list.length; i < len; i++) { + if (list[i] != item) { + copiedList.push(list[i]); + } + } + return copiedList; + } + + // REVIEW: for now this implementation uses polling. + // The advantage of polling is that it works reliably + // on all os and with network mounted files. + // For 90 referenced files, the average time to detect + // changes is 2*msInterval (by default 5 seconds). + // The overhead of this is .04 percent (1/2500) with + // average pause of < 1 millisecond (and max + // pause less than 1.5 milliseconds); question is + // do we anticipate reference sets in the 100s and + // do we care about waiting 10-20 seconds to detect + // changes for large reference sets? If so, do we want + // to increase the chunk size or decrease the interval + // time dynamically to match the large reference set? + export class WatchedFileSet { + watchedFiles: ScriptInfo[] = []; + nextFileToCheck = 0; + watchTimer: NodeJS.Timer; + + // average async stat takes about 30 microseconds + // set chunk size to do 30 files in < 1 millisecond + constructor(private host: ServerHost, public fileEvent: (info: ScriptInfo, eventName: string) => void, + public msInterval = 2500, public chunkSize = 30) { + } + + checkWatchedFileChanged(checkedIndex: number, stats: NodeJS.fs.Stats) { + var info = this.watchedFiles[checkedIndex]; + if (info && (!info.isOpen)) { + if (info.mtime.getTime() != stats.mtime.getTime()) { + info.svc.reloadFromFile(info.filename); + } + } + } + + fileDeleted(info: ScriptInfo) { + if (this.fileEvent) { + this.fileEvent(info, "deleted"); + } + } + + static fileDeleted = 34; + + poll(checkedIndex: number) { + var watchedFile = this.watchedFiles[checkedIndex]; + if (!watchedFile) { + return; + } + if (measurePerf) { + var start = process.hrtime(); + } + this.host.stat(watchedFile.filename,(err, stats) => { + if (err) { + var msg = err.message; + if (err.errno) { + msg += " errno: " + err.errno.toString(); + } + if (err.errno == WatchedFileSet.fileDeleted) { + this.fileDeleted(watchedFile); + } + } + else { + this.checkWatchedFileChanged(checkedIndex, stats); + } + }); + if (measurePerf) { + var elapsed = process.hrtime(start); + var elapsedNano = 1e9 * elapsed[0] + elapsed[1]; + } + } + + // this implementation uses polling and + // stat due to inconsistencies of fs.watch + // and efficiency of stat on modern filesystems + startWatchTimer() { + this.watchTimer = setInterval(() => { + var count = 0; + var nextToCheck = this.nextFileToCheck; + var firstCheck = -1; + while ((count < this.chunkSize) && (nextToCheck != firstCheck)) { + this.poll(nextToCheck); + if (firstCheck < 0) { + firstCheck = nextToCheck; + } + nextToCheck++; + if (nextToCheck == this.watchedFiles.length) { + nextToCheck = 0; + } + count++; + } + this.nextFileToCheck = nextToCheck; + }, this.msInterval); + } + + // TODO: remove watch file if opened by editor or no longer referenced + // assume normalized and absolute pathname + addFile(info: ScriptInfo) { + this.watchedFiles.push(info); + if (this.watchedFiles.length == 1) { + this.startWatchTimer(); + } + } + + removeFile(info: ScriptInfo) { + this.watchedFiles = copyListRemovingItem(info, this.watchedFiles); + } + } + + interface ProjectServiceEventHandler { + (eventName: string, project: Project): void; + } + + export class ProjectService { + filenameToScriptInfo: ts.Map = {}; + // open, non-configured files in two lists + openFileRoots: ScriptInfo[] = []; + openFilesReferenced: ScriptInfo[] = []; + // projects covering open files + inferredProjects: Project[] = []; + watchedFileSet: WatchedFileSet; + + constructor(public host: ServerHost, public psLogger: Logger, public eventHandler?: ProjectServiceEventHandler) { + if (measurePerf) { + calibrateTimer(); + } + ts.disableIncrementalParsing = true; + this.watchedFileSet = new WatchedFileSet(this.host,(info, eventName) => { + if (eventName == "deleted") { + this.fileDeletedInFilesystem(info); + } + }); + } + + log(msg: string, type = "Err") { + this.psLogger.msg(msg, type); + } + + closeLog() { + this.psLogger.close(); + } + + createInferredProject(root: ScriptInfo) { + var iproj = new Project(this); + iproj.addRoot(root); + iproj.finishGraph(); + this.inferredProjects.push(iproj); + return iproj; + } + + fileDeletedInFilesystem(info: ScriptInfo) { + this.psLogger.info(info.filename + " deleted"); + this.watchedFileSet.removeFile(info); + + if (!info.isOpen) { + this.filenameToScriptInfo[info.filename] = undefined; + var referencingProjects = this.findReferencingProjects(info); + for (var i = 0, len = referencingProjects.length; i < len; i++) { + referencingProjects[i].removeReferencedFile(info); + } + } + this.printProjects(); + } + + addOpenFile(info: ScriptInfo) { + this.findReferencingProjects(info); + if (info.defaultProject) { + this.openFilesReferenced.push(info); + } + else { + // create new inferred project p with the newly opened file as root + info.defaultProject = this.createInferredProject(info); + var openFileRoots: ScriptInfo[] = []; + // for each inferred project root r + for (var i = 0, len = this.openFileRoots.length; i < len; i++) { + var r = this.openFileRoots[i]; + // if r referenced by the new project + if (info.defaultProject.getSourceFile(r)) { + // remove project rooted at r + this.inferredProjects = + copyListRemovingItem(r.defaultProject, this.inferredProjects); + // put r in referenced open file list + this.openFilesReferenced.push(r); + // set default project of r to the new project + r.defaultProject = info.defaultProject; + } + else { + // otherwise, keep r as root of inferred project + openFileRoots.push(r); + } + } + this.openFileRoots = openFileRoots; + this.openFileRoots.push(info); + } + } + + closeOpenFile(info: ScriptInfo) { + var openFileRoots: ScriptInfo[] = []; + var removedProject: Project; + for (var i = 0, len = this.openFileRoots.length; i < len; i++) { + // if closed file is root of project + if (info == this.openFileRoots[i]) { + // remove that project and remember it + removedProject = info.defaultProject; + } + else { + openFileRoots.push(this.openFileRoots[i]); + } + } + this.openFileRoots = openFileRoots; + if (removedProject) { + // remove project from inferred projects list + this.inferredProjects = copyListRemovingItem(removedProject, this.inferredProjects); + var openFilesReferenced: ScriptInfo[] = []; + var orphanFiles: ScriptInfo[] = []; + // for all open, referenced files f + for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) { + var f = this.openFilesReferenced[i]; + // if f was referenced by the removed project, remember it + if (f.defaultProject == removedProject) { + f.defaultProject = undefined; + orphanFiles.push(f); + } + else { + // otherwise add it back to the list of referenced files + openFilesReferenced.push(f); + } + } + this.openFilesReferenced = openFilesReferenced; + // treat orphaned files as newly opened + for (var i = 0, len = orphanFiles.length; i < len; i++) { + this.addOpenFile(orphanFiles[i]); + } + } + else { + this.openFilesReferenced = copyListRemovingItem(info, this.openFilesReferenced); + } + info.close(); + } + + findReferencingProjects(info: ScriptInfo) { + var referencingProjects: Project[] = []; + info.defaultProject = undefined; + for (var i = 0, len = this.inferredProjects.length; i < len; i++) { + this.inferredProjects[i].updateGraph(); + if (this.inferredProjects[i].getSourceFile(info)) { + info.defaultProject = this.inferredProjects[i]; + referencingProjects.push(this.inferredProjects[i]); + } + } + return referencingProjects; + } + + getScriptInfo(filename: string) { + filename = ts.normalizePath(filename); + return ts.lookUp(this.filenameToScriptInfo, filename); + } + + /** + * @param filename is absolute pathname + */ + openFile(filename: string, openedByClient = false) { + filename = ts.normalizePath(filename); + var info = ts.lookUp(this.filenameToScriptInfo, filename); + if (!info) { + var content: string; + if (this.host.fileExists(filename)) { + content = this.host.readFile(filename); + } + if (!content) { + if (openedByClient) { + content = ""; + } + } + if (content !== undefined) { + info = new ScriptInfo(this.host, filename, content, openedByClient); + this.filenameToScriptInfo[filename] = info; + if (!info.isOpen) { + this.watchedFileSet.addFile(info); + } + } + } + if (info) { + if (openedByClient) { + info.isOpen = true; + } + } + return info; + } + + /** + * Open file whose contents is managed by the client + * @param filename is absolute pathname + */ + + openClientFile(filename: string) { + // TODO: tsconfig check + var info = this.openFile(filename, true); + this.addOpenFile(info); + this.printProjects(); + return info; + } + + /** + * Close file whose contents is managed by the client + * @param filename is absolute pathname + */ + + closeClientFile(filename: string) { + // TODO: tsconfig check + var info = ts.lookUp(this.filenameToScriptInfo, filename); + if (info) { + this.closeOpenFile(info); + info.isOpen = false; + } + this.printProjects(); + } + + getProjectsReferencingFile(filename: string) { + var scriptInfo = ts.lookUp(this.filenameToScriptInfo, filename); + if (scriptInfo) { + var projects: Project[] = []; + for (var i = 0, len = this.inferredProjects.length; i < len; i++) { + if (this.inferredProjects[i].getSourceFile(scriptInfo)) { + projects.push(this.inferredProjects[i]); + } + } + return projects; + } + } + + getProjectForFile(filename: string) { + var scriptInfo = ts.lookUp(this.filenameToScriptInfo, filename); + if (scriptInfo) { + return scriptInfo.defaultProject; + } + } + + printProjectsForFile(filename: string) { + var scriptInfo = ts.lookUp(this.filenameToScriptInfo, filename); + if (scriptInfo) { + this.psLogger.startGroup(); + this.psLogger.info("Projects for " + filename) + var projects = this.getProjectsReferencingFile(filename); + for (var i = 0, len = projects.length; i < len; i++) { + this.psLogger.info("Inferred Project " + i.toString()); + } + this.psLogger.endGroup(); + } + else { + this.psLogger.info(filename + " not in any project"); + } + } + + printProjects() { + this.psLogger.startGroup(); + for (var i = 0, len = this.inferredProjects.length; i < len; i++) { + var project = this.inferredProjects[i]; + this.psLogger.info("Project " + i.toString()); + this.psLogger.info(project.filesToString()); + this.psLogger.info("-----------------------------------------------"); + } + this.psLogger.info("Open file roots: ") + for (var i = 0, len = this.openFileRoots.length; i < len; i++) { + this.psLogger.info(this.openFileRoots[i].filename); + } + this.psLogger.info("Open files referenced: ") + for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) { + this.psLogger.info(this.openFilesReferenced[i].filename); + } + this.psLogger.endGroup(); + } + + openConfigFile(configFilename: string): ProjectOpenResult { + configFilename = ts.normalizePath(configFilename); + // file references will be relative to dirPath (or absolute) + var dirPath = ts.getDirectoryPath(configFilename); + var rawConfig = ts.readConfigFile(configFilename); + if (!rawConfig) { + return { errorMsg: "tsconfig syntax error" }; + } + else { + // REVIEW: specify no base path so can get absolute path below + var parsedCommandLine = ts.parseConfigFile(rawConfig); + + if (parsedCommandLine.errors) { + // TODO: gather diagnostics and transmit + return { errorMsg: "tsconfig option errors" }; + } + else if (parsedCommandLine.fileNames) { + var proj = this.createProject(configFilename); + for (var i = 0, len = parsedCommandLine.fileNames.length; i < len; i++) { + var rootFilename = parsedCommandLine.fileNames[i]; + var normRootFilename = ts.normalizePath(rootFilename); + normRootFilename = getAbsolutePath(normRootFilename, dirPath); + if (this.host.fileExists(normRootFilename)) { + var info = this.openFile(normRootFilename); + proj.addRoot(info); + } + else { + return { errorMsg: "specified file " + rootFilename + " not found" }; + } + } + var projectOptions: ProjectOptions = { + files: parsedCommandLine.fileNames, + compilerOptions: parsedCommandLine.options + }; + if (rawConfig.formatCodeOptions) { + projectOptions.formatCodeOptions = rawConfig.formatCodeOptions; + } + proj.setProjectOptions(projectOptions); + return { success: true, project: proj }; + } + else { + return { errorMsg: "no files found" }; + } + } + } + + createProject(projectFilename: string) { + var eproj = new Project(this); + eproj.projectFilename = projectFilename; + return eproj; + } + + } + + export class CompilerService { + cancellationToken = new CancellationToken(); + host: LSHost; + languageService: ts.LanguageService; + classifier: ts.Classifier; + settings = ts.getDefaultCompilerOptions(); + documentRegistry = ts.createDocumentRegistry(); + formatCodeOptions: ts.FormatCodeOptions = CompilerService.defaultFormatCodeOptions; + + constructor(public project: Project) { + this.host = new LSHost(project.projectService.host, project, this.cancellationToken); + // override default ES6 (remove when compiler default back at ES5) + this.settings.target = ts.ScriptTarget.ES5; + this.host.setCompilationSettings(this.settings); + this.languageService = ts.createLanguageService(this.host, this.documentRegistry); + this.classifier = ts.createClassifier(); + } + + setCompilerOptions(opt: ts.CompilerOptions) { + this.settings = opt; + this.host.setCompilationSettings(opt); + } + + isExternalModule(filename: string): boolean { + var sourceFile = this.languageService.getSourceFile(filename); + return ts.isExternalModule(sourceFile); + } + + static defaultFormatCodeOptions: ts.FormatCodeOptions = { + IndentSize: 4, + TabSize: 4, + NewLineCharacter: ts.sys.newLine, + ConvertTabsToSpaces: true, + InsertSpaceAfterCommaDelimiter: true, + InsertSpaceAfterSemicolonInForStatements: true, + InsertSpaceBeforeAndAfterBinaryOperators: true, + InsertSpaceAfterKeywordsInControlFlowStatements: true, + InsertSpaceAfterFunctionKeywordForAnonymousFunctions: false, + InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: false, + PlaceOpenBraceOnNewLineForFunctions: false, + PlaceOpenBraceOnNewLineForControlBlocks: false, + } + + } + + export interface LineCollection { + charCount(): number; + lineCount(): number; + isLeaf(): boolean; + walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker): void; + print(indentAmt: number): void; + } + + export interface ILineInfo { + line: number; + col: number; + text?: string; + leaf?: LineLeaf; + } + + export enum CharRangeSection { + PreStart, + Start, + Entire, + Mid, + End, + PostEnd + } + + export interface ILineIndexWalker { + goSubtree: boolean; + done: boolean; + leaf(relativeStart: number, relativeLength: number, lineCollection: LineLeaf): void; + pre? (relativeStart: number, relativeLength: number, lineCollection: LineCollection, + parent: LineNode, nodeType: CharRangeSection): LineCollection; + post? (relativeStart: number, relativeLength: number, lineCollection: LineCollection, + parent: LineNode, nodeType: CharRangeSection): LineCollection; + } + + class BaseLineIndexWalker implements ILineIndexWalker { + goSubtree = true; + done = false; + leaf(rangeStart: number, rangeLength: number, ll: LineLeaf) { + } + } + + class EditWalker extends BaseLineIndexWalker { + lineIndex = new LineIndex(); + // path to start of range + startPath: LineCollection[]; + endBranch: LineCollection[] = []; + branchNode: LineNode; + // path to current node + stack: LineNode[]; + state = CharRangeSection.Entire; + lineCollectionAtBranch: LineCollection; + initialText = ""; + trailingText = ""; + suppressTrailingText = false; + + constructor() { + super(); + this.lineIndex.root = new LineNode(); + this.startPath = [this.lineIndex.root]; + this.stack = [this.lineIndex.root]; + } + + insertLines(insertedText: string) { + if (this.suppressTrailingText) { + this.trailingText = ""; + } + if (insertedText) { + insertedText = this.initialText + insertedText + this.trailingText; + } + else { + insertedText = this.initialText + this.trailingText; + } + var lm = LineIndex.linesFromText(insertedText); + var lines = lm.lines; + if (lines.length > 1) { + if (lines[lines.length - 1] == "") { + lines.length--; + } + } + var branchParent: LineNode; + var lastZeroCount: LineCollection; + + for (var k = this.endBranch.length - 1; k >= 0; k--) { + (this.endBranch[k]).updateCounts(); + if (this.endBranch[k].charCount() == 0) { + lastZeroCount = this.endBranch[k]; + if (k > 0) { + branchParent = this.endBranch[k - 1]; + } + else { + branchParent = this.branchNode; + } + } + } + if (lastZeroCount) { + branchParent.remove(lastZeroCount); + } + + // path at least length two (root and leaf) + var insertionNode = this.startPath[this.startPath.length - 2]; + var leafNode = this.startPath[this.startPath.length - 1]; + var len = lines.length; + + if (len > 0) { + leafNode.text = lines[0]; + + if (len > 1) { + var insertedNodes = new Array(len - 1); + var startNode = leafNode; + for (var i = 1, len = lines.length; i < len; i++) { + insertedNodes[i - 1] = new LineLeaf(lines[i]); + } + var pathIndex = this.startPath.length - 2; + while (pathIndex >= 0) { + insertionNode = this.startPath[pathIndex]; + insertedNodes = insertionNode.insertAt(startNode, insertedNodes); + pathIndex--; + startNode = insertionNode; + } + var insertedNodesLen = insertedNodes.length; + while (insertedNodesLen > 0) { + var newRoot = new LineNode(); + newRoot.add(this.lineIndex.root); + insertedNodes = newRoot.insertAt(this.lineIndex.root, insertedNodes); + insertedNodesLen = insertedNodes.length; + this.lineIndex.root = newRoot; + } + this.lineIndex.root.updateCounts(); + } + else { + for (var j = this.startPath.length - 2; j >= 0; j--) { + (this.startPath[j]).updateCounts(); + } + } + } + else { + // no content for leaf node, so delete it + insertionNode.remove(leafNode); + for (var j = this.startPath.length - 2; j >= 0; j--) { + (this.startPath[j]).updateCounts(); + } + } + + return this.lineIndex; + } + + post(relativeStart: number, relativeLength: number, lineCollection: LineCollection, parent: LineCollection, nodeType: CharRangeSection): LineCollection { + // have visited the path for start of range, now looking for end + // if range is on single line, we will never make this state transition + if (lineCollection == this.lineCollectionAtBranch) { + this.state = CharRangeSection.End; + } + // always pop stack because post only called when child has been visited + this.stack.length--; + return undefined; + } + + pre(relativeStart: number, relativeLength: number, lineCollection: LineCollection, parent: LineCollection, nodeType: CharRangeSection) { + // currentNode corresponds to parent, but in the new tree + var currentNode = this.stack[this.stack.length - 1]; + + if ((this.state == CharRangeSection.Entire) && (nodeType == CharRangeSection.Start)) { + // if range is on single line, we will never make this state transition + this.state = CharRangeSection.Start; + this.branchNode = currentNode; + this.lineCollectionAtBranch = lineCollection; + } + + var child: LineCollection; + function fresh(node: LineCollection): LineCollection { + if (node.isLeaf()) { + return new LineLeaf(""); + } + else return new LineNode(); + } + switch (nodeType) { + case CharRangeSection.PreStart: + this.goSubtree = false; + if (this.state != CharRangeSection.End) { + currentNode.add(lineCollection); + } + break; + case CharRangeSection.Start: + if (this.state == CharRangeSection.End) { + this.goSubtree = false; + } + else { + child = fresh(lineCollection); + currentNode.add(child); + this.startPath[this.startPath.length] = child; + } + break; + case CharRangeSection.Entire: + if (this.state != CharRangeSection.End) { + child = fresh(lineCollection); + currentNode.add(child); + this.startPath[this.startPath.length] = child; + } + else { + if (!lineCollection.isLeaf()) { + child = fresh(lineCollection); + currentNode.add(child); + this.endBranch[this.endBranch.length] = child; + } + } + break; + case CharRangeSection.Mid: + this.goSubtree = false; + break; + case CharRangeSection.End: + if (this.state != CharRangeSection.End) { + this.goSubtree = false; + } + else { + if (!lineCollection.isLeaf()) { + child = fresh(lineCollection); + currentNode.add(child); + this.endBranch[this.endBranch.length] = child; + } + } + break; + case CharRangeSection.PostEnd: + this.goSubtree = false; + if (this.state != CharRangeSection.Start) { + currentNode.add(lineCollection); + } + break; + } + if (this.goSubtree) { + this.stack[this.stack.length] = child; + } + return lineCollection; + } + // just gather text from the leaves + leaf(relativeStart: number, relativeLength: number, ll: LineLeaf) { + if (this.state == CharRangeSection.Start) { + this.initialText = ll.text.substring(0, relativeStart); + } + else if (this.state == CharRangeSection.Entire) { + this.initialText = ll.text.substring(0, relativeStart); + this.trailingText = ll.text.substring(relativeStart + relativeLength); + } + else { + // state is CharRangeSection.End + this.trailingText = ll.text.substring(relativeStart + relativeLength); + } + } + } + + // text change information + export class TextChange { + constructor(public pos: number, public deleteLen: number, public insertedText?: string) { + } + + getTextChangeRange() { + return ts.createTextChangeRange(ts.createTextSpan(this.pos, this.deleteLen), + this.insertedText ? this.insertedText.length : 0); + } + } + + export class ScriptVersionCache { + changes: TextChange[] = []; + versions: LineIndexSnapshot[] = []; + minVersion = 0; // no versions earlier than min version will maintain change history + private currentVersion = 0; + + static changeNumberThreshold = 8; + static changeLengthThreshold = 256; + + // REVIEW: can optimize by coalescing simple edits + edit(pos: number, deleteLen: number, insertedText?: string) { + this.changes[this.changes.length] = new TextChange(pos, deleteLen, insertedText); + if ((this.changes.length > ScriptVersionCache.changeNumberThreshold) || + (deleteLen > ScriptVersionCache.changeLengthThreshold) || + (insertedText && (insertedText.length > ScriptVersionCache.changeLengthThreshold))) { + this.getSnapshot(); + } + } + + latest() { + return this.versions[this.currentVersion]; + } + + latestVersion() { + if (this.changes.length > 0) { + this.getSnapshot(); + } + return this.currentVersion; + } + + reloadFromFile(filename: string, cb?: () => any) { + var content = ts.sys.readFile(filename); + this.reload(content); + if (cb) + cb(); + } + + // reload whole script, leaving no change history behind reload + reload(script: string) { + this.currentVersion++; + this.changes = []; // history wiped out by reload + var snap = new LineIndexSnapshot(this.currentVersion, this); + this.versions[this.currentVersion] = snap; + snap.index = new LineIndex(); + var lm = LineIndex.linesFromText(script); + snap.index.load(lm.lines); + // REVIEW: could use linked list + for (var i = this.minVersion; i < this.currentVersion; i++) { + this.versions[i] = undefined; + } + this.minVersion = this.currentVersion; + + } + + getSnapshot() { + var snap = this.versions[this.currentVersion]; + if (this.changes.length > 0) { + var snapIndex = this.latest().index; + for (var i = 0, len = this.changes.length; i < len; i++) { + var change = this.changes[i]; + snapIndex = snapIndex.edit(change.pos, change.deleteLen, change.insertedText); + } + snap = new LineIndexSnapshot(this.currentVersion + 1, this); + snap.index = snapIndex; + snap.changesSincePreviousVersion = this.changes; + this.currentVersion = snap.version; + this.versions[snap.version] = snap; + this.changes = []; + } + return snap; + } + + getTextChangesBetweenVersions(oldVersion: number, newVersion: number) { + if (oldVersion < newVersion) { + if (oldVersion >= this.minVersion) { + var textChangeRanges: ts.TextChangeRange[] = []; + for (var i = oldVersion + 1; i <= newVersion; i++) { + var snap = this.versions[i]; + for (var j = 0, len = snap.changesSincePreviousVersion.length; j < len; j++) { + var textChange = snap.changesSincePreviousVersion[j]; + textChangeRanges[textChangeRanges.length] = textChange.getTextChangeRange(); + } + } + return ts.collapseTextChangeRangesAcrossMultipleVersions(textChangeRanges); + } + else { + return undefined; + } + } + else { + return ts.unchangedTextChangeRange; + } + } + + static fromString(script: string) { + var svc = new ScriptVersionCache(); + var snap = new LineIndexSnapshot(0, svc); + svc.versions[svc.currentVersion] = snap; + snap.index = new LineIndex(); + var lm = LineIndex.linesFromText(script); + snap.index.load(lm.lines); + return svc; + } + } + + export class LineIndexSnapshot implements ts.IScriptSnapshot { + index: LineIndex; + changesSincePreviousVersion: TextChange[] = []; + + constructor(public version: number, public cache: ScriptVersionCache) { + } + + getText(rangeStart: number, rangeEnd: number) { + return this.index.getText(rangeStart, rangeEnd - rangeStart); + } + + getLength() { + return this.index.root.charCount(); + } + + // this requires linear space so don't hold on to these + getLineStartPositions(): number[] { + var starts: number[] = [-1]; + var count = 1; + var pos = 0; + this.index.every((ll, s, len) => { + starts[count++] = pos; + pos += ll.text.length; + return true; + }, 0); + return starts; + } + + getLineMapper() { + return ((line: number) => { + return this.index.lineNumberToInfo(line).col; + }); + } + + getTextChangeRangeSinceVersion(scriptVersion: number) { + if (this.version <= scriptVersion) { + return ts.unchangedTextChangeRange; + } + else { + return this.cache.getTextChangesBetweenVersions(scriptVersion, this.version); + } + } + getChangeRange(oldSnapshot: ts.IScriptSnapshot): ts.TextChangeRange { + var oldSnap = oldSnapshot; + return this.getTextChangeRangeSinceVersion(oldSnap.version); + } + } + + + export class LineIndex { + root: LineNode; + // set this to true to check each edit for accuracy + checkEdits = false; + + charOffsetToLineNumberAndPos(charOffset: number) { + return this.root.charOffsetToLineNumberAndPos(1, charOffset); + } + + lineNumberToInfo(lineNumber: number): ILineInfo { + var lineCount = this.root.lineCount(); + if (lineNumber <= lineCount) { + var lineInfo = this.root.lineNumberToInfo(lineNumber, 0); + lineInfo.line = lineNumber; + return lineInfo; + } + else { + return { + line: lineNumber, + col: this.root.charCount() + } + } + } + + print() { + printLine("index TC " + this.root.charCount() + " TL " + this.root.lineCount()); + this.root.print(0); + printLine(""); + } + + load(lines: string[]) { + if (lines.length > 0) { + var leaves: LineLeaf[] = []; + for (var i = 0, len = lines.length; i < len; i++) { + leaves[i] = new LineLeaf(lines[i]); + } + this.root = LineIndex.buildTreeFromBottom(leaves); + } + else { + this.root = new LineNode(); + } + } + + walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker) { + this.root.walk(rangeStart, rangeLength, walkFns); + } + + getText(rangeStart: number, rangeLength: number) { + var accum = ""; + if (rangeLength > 0) { + this.walk(rangeStart, rangeLength, { + goSubtree: true, + done: false, + leaf: (relativeStart: number, relativeLength: number, ll: LineLeaf) => { + accum = accum.concat(ll.text.substring(relativeStart, relativeStart + relativeLength)); + } + }); + } + return accum; + } + + every(f: (ll: LineLeaf, s: number, len: number) => boolean, rangeStart: number, rangeEnd?: number) { + if (!rangeEnd) { + rangeEnd = this.root.charCount(); + } + var walkFns = { + goSubtree: true, + done: false, + leaf: function (relativeStart: number, relativeLength: number, ll: LineLeaf) { + if (!f(ll, relativeStart, relativeLength)) { + this.done = true; + } + } + } + this.walk(rangeStart, rangeEnd - rangeStart, walkFns); + return !walkFns.done; + } + + edit(pos: number, deleteLength: number, newText?: string) { + function editFlat(source: string, s: number, dl: number, nt = "") { + return source.substring(0, s) + nt + source.substring(s + dl, source.length); + } + if (this.root.charCount() == 0) { + // TODO: assert deleteLength == 0 + if (newText) { + this.load(LineIndex.linesFromText(newText).lines); + return this; + } + } + else { + if (this.checkEdits) { + var checkText = editFlat(this.getText(0, this.root.charCount()), pos, deleteLength, newText); + } + var walker = new EditWalker(); + if (deleteLength > 0) { + // check whether last characters deleted are line break + var e = pos + deleteLength; + var lineInfo = this.charOffsetToLineNumberAndPos(e); + if ((lineInfo && (lineInfo.col == 0))) { + // move range end just past line that will merge with previous line + deleteLength += lineInfo.text.length; + // store text by appending to end of insertedText + if (newText) { + newText = newText + lineInfo.text; + } + else { + newText = lineInfo.text; + } + } + } + else if (pos >= this.root.charCount()) { + // insert at end + var endString = this.getText(pos - 1, 1); + if (newText) { + newText = endString + newText; + } + else { + newText = endString; + } + pos = pos - 1; + deleteLength = 0; + walker.suppressTrailingText = true; + } + this.root.walk(pos, deleteLength, walker); + walker.insertLines(newText); + if (this.checkEdits) { + var updatedText = this.getText(0, this.root.charCount()); + Debug.assert(checkText == updatedText, "buffer edit mismatch"); + } + return walker.lineIndex; + } + } + + static buildTreeFromBottom(nodes: LineCollection[]): LineNode { + var nodeCount = Math.ceil(nodes.length / lineCollectionCapacity); + var interiorNodes: LineNode[] = []; + var nodeIndex = 0; + for (var i = 0; i < nodeCount; i++) { + interiorNodes[i] = new LineNode(); + var charCount = 0; + var lineCount = 0; + for (var j = 0; j < lineCollectionCapacity; j++) { + if (nodeIndex < nodes.length) { + interiorNodes[i].add(nodes[nodeIndex]); + charCount += nodes[nodeIndex].charCount(); + lineCount += nodes[nodeIndex].lineCount(); + } + else { + break; + } + nodeIndex++; + } + interiorNodes[i].totalChars = charCount; + interiorNodes[i].totalLines = lineCount; + } + if (interiorNodes.length == 1) { + return interiorNodes[0]; + } + else { + return this.buildTreeFromBottom(interiorNodes); + } + } + + static linesFromText(text: string) { + var lineStarts = ts.computeLineStarts(text); + + if (lineStarts.length == 0) { + return { lines: [], lineMap: lineStarts }; + } + var lines = new Array(lineStarts.length); + var lc = lineStarts.length - 1; + for (var lmi = 0; lmi < lc; lmi++) { + lines[lmi] = text.substring(lineStarts[lmi], lineStarts[lmi + 1]); + } + + var endText = text.substring(lineStarts[lc]); + if (endText.length > 0) { + lines[lc] = endText; + } + else { + lines.length--; + } + return { lines: lines, lineMap: lineStarts }; + } + } + + export class LineNode implements LineCollection { + totalChars = 0; + totalLines = 0; + children: LineCollection[] = []; + + isLeaf() { + return false; + } + + print(indentAmt: number) { + var strBuilder = getIndent(indentAmt); + strBuilder += ("node ch " + this.children.length + " TC " + this.totalChars + " TL " + this.totalLines + " :"); + printLine(strBuilder); + for (var ch = 0, clen = this.children.length; ch < clen; ch++) { + this.children[ch].print(indentAmt + 1); + } + } + + updateCounts() { + this.totalChars = 0; + this.totalLines = 0; + for (var i = 0, len = this.children.length; i < len; i++) { + var child = this.children[i]; + this.totalChars += child.charCount(); + this.totalLines += child.lineCount(); + } + } + + execWalk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker, childIndex: number, nodeType: CharRangeSection) { + if (walkFns.pre) { + walkFns.pre(rangeStart, rangeLength, this.children[childIndex], this, nodeType); + } + if (walkFns.goSubtree) { + this.children[childIndex].walk(rangeStart, rangeLength, walkFns); + if (walkFns.post) { + walkFns.post(rangeStart, rangeLength, this.children[childIndex], this, nodeType); + } + } + else { + walkFns.goSubtree = true; + } + return walkFns.done; + } + + skipChild(relativeStart: number, relativeLength: number, childIndex: number, walkFns: ILineIndexWalker, nodeType: CharRangeSection) { + if (walkFns.pre && (!walkFns.done)) { + walkFns.pre(relativeStart, relativeLength, this.children[childIndex], this, nodeType); + walkFns.goSubtree = true; + } + } + + walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker) { + // assume (rangeStart < this.totalChars) && (rangeLength <= this.totalChars) + var childIndex = 0; + var child = this.children[0]; + var childCharCount = child.charCount(); + // find sub-tree containing start + var adjustedStart = rangeStart; + while (adjustedStart >= childCharCount) { + this.skipChild(adjustedStart, rangeLength, childIndex, walkFns, CharRangeSection.PreStart); + adjustedStart -= childCharCount; + child = this.children[++childIndex]; + childCharCount = child.charCount(); + } + // Case I: both start and end of range in same subtree + if ((adjustedStart + rangeLength) <= childCharCount) { + if (this.execWalk(adjustedStart, rangeLength, walkFns, childIndex, CharRangeSection.Entire)) { + return; + } + } + else { + // Case II: start and end of range in different subtrees (possibly with subtrees in the middle) + if (this.execWalk(adjustedStart, childCharCount - adjustedStart, walkFns, childIndex, CharRangeSection.Start)) { + return; + } + var adjustedLength = rangeLength - (childCharCount - adjustedStart); + child = this.children[++childIndex]; + if (!child) { + this.print(2); + } + childCharCount = child.charCount(); + while (adjustedLength > childCharCount) { + if (this.execWalk(0, childCharCount, walkFns, childIndex, CharRangeSection.Mid)) { + return; + } + adjustedLength -= childCharCount; + child = this.children[++childIndex]; + childCharCount = child.charCount(); + } + if (adjustedLength > 0) { + if (this.execWalk(0, adjustedLength, walkFns, childIndex, CharRangeSection.End)) { + return; + } + } + } + // Process any subtrees after the one containing range end + if (walkFns.pre) { + var clen = this.children.length; + if (childIndex < (clen - 1)) { + for (var ej = childIndex + 1; ej < clen; ej++) { + this.skipChild(0, 0, ej, walkFns, CharRangeSection.PostEnd); + } + } + } + } + + charOffsetToLineNumberAndPos(lineNumber: number, charOffset: number): ILineInfo { + var childInfo = this.childFromCharOffset(lineNumber, charOffset); + if (!childInfo.child) { + return { + line: lineNumber, + col: charOffset, + } + } + else if (childInfo.childIndex < this.children.length) { + if (childInfo.child.isLeaf()) { + return { + line: childInfo.lineNumber, + col: childInfo.charOffset, + text: ((childInfo.child)).text, + leaf: ((childInfo.child)) + }; + } + else { + var lineNode = (childInfo.child); + return lineNode.charOffsetToLineNumberAndPos(childInfo.lineNumber, childInfo.charOffset); + } + } + else { + var lineInfo = this.lineNumberToInfo(this.lineCount(), 0); + return { line: this.lineCount(), col: lineInfo.leaf.charCount() }; + } + } + + lineNumberToInfo(lineNumber: number, charOffset: number): ILineInfo { + var childInfo = this.childFromLineNumber(lineNumber, charOffset); + if (!childInfo.child) { + return { + line: lineNumber, + col: charOffset + } + } + else if (childInfo.child.isLeaf()) { + return { + line: lineNumber, + col: childInfo.charOffset, + text: ((childInfo.child)).text, + leaf: ((childInfo.child)) + } + } + else { + var lineNode = (childInfo.child); + return lineNode.lineNumberToInfo(childInfo.relativeLineNumber, childInfo.charOffset); + } + } + + childFromLineNumber(lineNumber: number, charOffset: number) { + var child: LineCollection; + var relativeLineNumber = lineNumber; + for (var i = 0, len = this.children.length; i < len; i++) { + child = this.children[i]; + var childLineCount = child.lineCount(); + if (childLineCount >= relativeLineNumber) { + break; + } + else { + relativeLineNumber -= childLineCount; + charOffset += child.charCount(); + } + } + return { + child: child, + childIndex: i, + relativeLineNumber: relativeLineNumber, + charOffset: charOffset + }; + } + + childFromCharOffset(lineNumber: number, charOffset: number) { + var child: LineCollection; + for (var i = 0, len = this.children.length; i < len; i++) { + child = this.children[i]; + if (child.charCount() > charOffset) { + break; + } + else { + charOffset -= child.charCount(); + lineNumber += child.lineCount(); + } + } + return { + child: child, + childIndex: i, + charOffset: charOffset, + lineNumber: lineNumber + } + } + + splitAfter(childIndex: number) { + var splitNode: LineNode; + var clen = this.children.length; + childIndex++; + var endLength = childIndex; + if (childIndex < clen) { + splitNode = new LineNode(); + while (childIndex < clen) { + splitNode.add(this.children[childIndex++]); + } + splitNode.updateCounts(); + } + this.children.length = endLength; + return splitNode; + } + + remove(child: LineCollection) { + var childIndex = this.findChildIndex(child); + var clen = this.children.length; + if (childIndex < (clen - 1)) { + for (var i = childIndex; i < (clen - 1); i++) { + this.children[i] = this.children[i + 1]; + } + } + this.children.length--; + } + + findChildIndex(child: LineCollection) { + var childIndex = 0; + var clen = this.children.length; + while ((this.children[childIndex] != child) && (childIndex < clen)) childIndex++; + return childIndex; + } + + insertAt(child: LineCollection, nodes: LineCollection[]) { + var childIndex = this.findChildIndex(child); + var clen = this.children.length; + var nodeCount = nodes.length; + // if child is last and there is more room and only one node to place, place it + if ((clen < lineCollectionCapacity) && (childIndex == (clen - 1)) && (nodeCount == 1)) { + this.add(nodes[0]); + this.updateCounts(); + return []; + } + else { + var shiftNode = this.splitAfter(childIndex); + var nodeIndex = 0; + childIndex++; + while ((childIndex < lineCollectionCapacity) && (nodeIndex < nodeCount)) { + this.children[childIndex++] = nodes[nodeIndex++]; + } + var splitNodes: LineNode[] = []; + var splitNodeCount = 0; + if (nodeIndex < nodeCount) { + splitNodeCount = Math.ceil((nodeCount - nodeIndex) / lineCollectionCapacity); + splitNodes = new Array(splitNodeCount); + var splitNodeIndex = 0; + for (var i = 0; i < splitNodeCount; i++) { + splitNodes[i] = new LineNode(); + } + var splitNode = splitNodes[0]; + while (nodeIndex < nodeCount) { + splitNode.add(nodes[nodeIndex++]); + if (splitNode.children.length == lineCollectionCapacity) { + splitNodeIndex++; + splitNode = splitNodes[splitNodeIndex]; + } + } + for (i = splitNodes.length - 1; i >= 0; i--) { + if (splitNodes[i].children.length == 0) { + splitNodes.length--; + } + } + } + if (shiftNode) { + splitNodes[splitNodes.length] = shiftNode; + } + this.updateCounts(); + for (i = 0; i < splitNodeCount; i++) { + (splitNodes[i]).updateCounts(); + } + return splitNodes; + } + } + + // assume there is room for the item; return true if more room + add(collection: LineCollection) { + this.children[this.children.length] = collection; + return (this.children.length < lineCollectionCapacity); + } + + charCount() { + return this.totalChars; + } + + lineCount() { + return this.totalLines; + } + } + + export class LineLeaf implements LineCollection { + udata: any; + + constructor(public text: string) { + + } + + setUdata(data: any) { + this.udata = data; + } + + getUdata() { + return this.udata; + } + + isLeaf() { + return true; + } + + walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker) { + walkFns.leaf(rangeStart, rangeLength, this); + } + + charCount() { + return this.text.length; + } + + lineCount() { + return 1; + } + + print(indentAmt: number) { + var strBuilder = getIndent(indentAmt); + printLine(strBuilder + showLines(this.text)); + } + } +} \ No newline at end of file diff --git a/src/server/node.d.ts b/src/server/node.d.ts new file mode 100644 index 00000000000..2002f973a37 --- /dev/null +++ b/src/server/node.d.ts @@ -0,0 +1,677 @@ +// Type definitions for Node.js v0.10.1 +// Project: http://nodejs.org/ +// Definitions by: Microsoft TypeScript , DefinitelyTyped +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/************************************************ +* * +* Node.js v0.10.1 API * +* * +************************************************/ + +/************************************************ +* * +* GLOBAL * +* * +************************************************/ +declare var process: NodeJS.Process; +declare var global: any; + +declare var __filename: string; +declare var __dirname: string; + +declare function setTimeout(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; +declare function clearTimeout(timeoutId: NodeJS.Timer): void; +declare function setInterval(callback: (...args: any[]) => void, ms: number, ...args: any[]): NodeJS.Timer; +declare function clearInterval(intervalId: NodeJS.Timer): void; +declare function setImmediate(callback: (...args: any[]) => void, ...args: any[]): any; +declare function clearImmediate(immediateId: any): void; + +declare var require: { + (id: string): any; + resolve(id: string): string; + cache: any; + extensions: any; + main: any; +}; + +declare var module: { + exports: any; + require(id: string): any; + id: string; + filename: string; + loaded: boolean; + parent: any; + children: any[]; +}; + +// Same as module.exports +declare var exports: any; +declare var SlowBuffer: { + new (str: string, encoding?: string): Buffer; + new (size: number): Buffer; + new (size: Uint8Array): Buffer; + new (array: any[]): Buffer; + prototype: Buffer; + isBuffer(obj: any): boolean; + byteLength(string: string, encoding?: string): number; + concat(list: Buffer[], totalLength?: number): Buffer; +}; + + +// Buffer class +interface Buffer extends NodeBuffer { } +interface BufferConstructor { + new (str: string, encoding ?: string): Buffer; + new (size: number): Buffer; + new (size: Uint8Array): Buffer; + new (array: any[]): Buffer; + prototype: Buffer; + isBuffer(obj: any): boolean; + byteLength(string: string, encoding ?: string): number; + concat(list: Buffer[], totalLength ?: number): Buffer; +} +declare var Buffer: BufferConstructor; + +/************************************************ +* * +* GLOBAL INTERFACES * +* * +************************************************/ +declare module NodeJS { + export interface ErrnoException extends Error { + errno?: any; + code?: string; + path?: string; + syscall?: string; + } + + export interface EventEmitter { + addListener(event: string, listener: Function): EventEmitter; + on(event: string, listener: Function): EventEmitter; + once(event: string, listener: Function): EventEmitter; + removeListener(event: string, listener: Function): EventEmitter; + removeAllListeners(event?: string): EventEmitter; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + } + + export interface ReadableStream extends EventEmitter { + readable: boolean; + read(size?: number): any; + setEncoding(encoding: string): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): void; + unshift(chunk: string): void; + unshift(chunk: Buffer): void; + wrap(oldStream: ReadableStream): ReadableStream; + } + + export interface WritableStream extends EventEmitter { + writable: boolean; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + } + + export interface ReadWriteStream extends ReadableStream, WritableStream { } + + export interface Process extends EventEmitter { + stdout: WritableStream; + stderr: WritableStream; + stdin: ReadableStream; + argv: string[]; + execPath: string; + abort(): void; + chdir(directory: string): void; + cwd(): string; + env: any; + exit(code?: number): void; + getgid(): number; + setgid(id: number): void; + setgid(id: string): void; + getuid(): number; + setuid(id: number): void; + setuid(id: string): void; + version: string; + versions: { + http_parser: string; + node: string; + v8: string; + ares: string; + uv: string; + zlib: string; + openssl: string; + }; + config: { + target_defaults: { + cflags: any[]; + default_configuration: string; + defines: string[]; + include_dirs: string[]; + libraries: string[]; + }; + variables: { + clang: number; + host_arch: string; + node_install_npm: boolean; + node_install_waf: boolean; + node_prefix: string; + node_shared_openssl: boolean; + node_shared_v8: boolean; + node_shared_zlib: boolean; + node_use_dtrace: boolean; + node_use_etw: boolean; + node_use_openssl: boolean; + target_arch: string; + v8_no_strict_aliasing: number; + v8_use_snapshot: boolean; + visibility: string; + }; + }; + kill(pid: number, signal?: string): void; + pid: number; + title: string; + arch: string; + platform: string; + memoryUsage(): { rss: number; heapTotal: number; heapUsed: number; }; + nextTick(callback: Function): void; + umask(mask?: number): number; + uptime(): number; + hrtime(time?: number[]): number[]; + + // Worker + send? (message: any, sendHandle?: any): void; + } + + export interface Timer { + ref(): void; + unref(): void; + } +} + + +/** + * @deprecated + */ +interface NodeBuffer { + [index: number]: number; + write(string: string, offset?: number, length?: number, encoding?: string): number; + toString(encoding?: string, start?: number, end?: number): string; + toJSON(): any; + length: number; + copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; + slice(start?: number, end?: number): Buffer; + readUInt8(offset: number, noAsset?: boolean): number; + readUInt16LE(offset: number, noAssert?: boolean): number; + readUInt16BE(offset: number, noAssert?: boolean): number; + readUInt32LE(offset: number, noAssert?: boolean): number; + readUInt32BE(offset: number, noAssert?: boolean): number; + readInt8(offset: number, noAssert?: boolean): number; + readInt16LE(offset: number, noAssert?: boolean): number; + readInt16BE(offset: number, noAssert?: boolean): number; + readInt32LE(offset: number, noAssert?: boolean): number; + readInt32BE(offset: number, noAssert?: boolean): number; + readFloatLE(offset: number, noAssert?: boolean): number; + readFloatBE(offset: number, noAssert?: boolean): number; + readDoubleLE(offset: number, noAssert?: boolean): number; + readDoubleBE(offset: number, noAssert?: boolean): number; + writeUInt8(value: number, offset: number, noAssert?: boolean): void; + writeUInt16LE(value: number, offset: number, noAssert?: boolean): void; + writeUInt16BE(value: number, offset: number, noAssert?: boolean): void; + writeUInt32LE(value: number, offset: number, noAssert?: boolean): void; + writeUInt32BE(value: number, offset: number, noAssert?: boolean): void; + writeInt8(value: number, offset: number, noAssert?: boolean): void; + writeInt16LE(value: number, offset: number, noAssert?: boolean): void; + writeInt16BE(value: number, offset: number, noAssert?: boolean): void; + writeInt32LE(value: number, offset: number, noAssert?: boolean): void; + writeInt32BE(value: number, offset: number, noAssert?: boolean): void; + writeFloatLE(value: number, offset: number, noAssert?: boolean): void; + writeFloatBE(value: number, offset: number, noAssert?: boolean): void; + writeDoubleLE(value: number, offset: number, noAssert?: boolean): void; + writeDoubleBE(value: number, offset: number, noAssert?: boolean): void; + fill(value: any, offset?: number, end?: number): void; +} + +declare module NodeJS { + export interface Path { + normalize(p: string): string; + join(...paths: any[]): string; + resolve(...pathSegments: any[]): string; + relative(from: string, to: string): string; + dirname(p: string): string; + basename(p: string, ext?: string): string; + extname(p: string): string; + sep: string; + } +} + +declare module NodeJS { + export interface ReadLineInstance extends EventEmitter { + setPrompt(prompt: string, length: number): void; + prompt(preserveCursor?: boolean): void; + question(query: string, callback: Function): void; + pause(): void; + resume(): void; + close(): void; + write(data: any, key?: any): void; + } + export interface ReadLineOptions { + input: NodeJS.ReadableStream; + output: NodeJS.WritableStream; + completer?: Function; + terminal?: boolean; + } + + export interface ReadLine { + createInterface(options: ReadLineOptions): ReadLineInstance; + } +} + +declare module NodeJS { + module events { + export class EventEmitter implements NodeJS.EventEmitter { + static listenerCount(emitter: EventEmitter, event: string): number; + + addListener(event: string, listener: Function): EventEmitter; + on(event: string, listener: Function): EventEmitter; + once(event: string, listener: Function): EventEmitter; + removeListener(event: string, listener: Function): EventEmitter; + removeAllListeners(event?: string): EventEmitter; + setMaxListeners(n: number): void; + listeners(event: string): Function[]; + emit(event: string, ...args: any[]): boolean; + } + } +} + +declare module NodeJS { + module stream { + + export interface Stream extends events.EventEmitter { + pipe(destination: T, options?: { end?: boolean; }): T; + } + + export interface ReadableOptions { + highWaterMark?: number; + encoding?: string; + objectMode?: boolean; + } + + export class Readable extends events.EventEmitter implements NodeJS.ReadableStream { + readable: boolean; + constructor(opts?: ReadableOptions); + _read(size: number): void; + read(size?: number): any; + setEncoding(encoding: string): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): void; + unshift(chunk: string): void; + unshift(chunk: Buffer): void; + wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; + push(chunk: any, encoding?: string): boolean; + } + + export interface WritableOptions { + highWaterMark?: number; + decodeStrings?: boolean; + } + + export class Writable extends events.EventEmitter implements NodeJS.WritableStream { + writable: boolean; + constructor(opts?: WritableOptions); + _write(data: Buffer, encoding: string, callback: Function): void; + _write(data: string, encoding: string, callback: Function): void; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + } + + export interface DuplexOptions extends ReadableOptions, WritableOptions { + allowHalfOpen?: boolean; + } + + // Note: Duplex extends both Readable and Writable. + export class Duplex extends Readable implements NodeJS.ReadWriteStream { + writable: boolean; + constructor(opts?: DuplexOptions); + _write(data: Buffer, encoding: string, callback: Function): void; + _write(data: string, encoding: string, callback: Function): void; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + } + + export interface TransformOptions extends ReadableOptions, WritableOptions { } + + // Note: Transform lacks the _read and _write methods of Readable/Writable. + export class Transform extends events.EventEmitter implements NodeJS.ReadWriteStream { + readable: boolean; + writable: boolean; + constructor(opts?: TransformOptions); + _transform(chunk: Buffer, encoding: string, callback: Function): void; + _transform(chunk: string, encoding: string, callback: Function): void; + _flush(callback: Function): void; + read(size?: number): any; + setEncoding(encoding: string): void; + pause(): void; + resume(): void; + pipe(destination: T, options?: { end?: boolean; }): T; + unpipe(destination?: T): void; + unshift(chunk: string): void; + unshift(chunk: Buffer): void; + wrap(oldStream: NodeJS.ReadableStream): NodeJS.ReadableStream; + push(chunk: any, encoding?: string): boolean; + write(buffer: Buffer, cb?: Function): boolean; + write(str: string, cb?: Function): boolean; + write(str: string, encoding?: string, cb?: Function): boolean; + end(): void; + end(buffer: Buffer, cb?: Function): void; + end(str: string, cb?: Function): void; + end(str: string, encoding?: string, cb?: Function): void; + } + + export class PassThrough extends Transform { } + } +} + +declare module NodeJS { + module fs { + interface Stats { + isFile(): boolean; + isDirectory(): boolean; + isBlockDevice(): boolean; + isCharacterDevice(): boolean; + isSymbolicLink(): boolean; + isFIFO(): boolean; + isSocket(): boolean; + dev: number; + ino: number; + mode: number; + nlink: number; + uid: number; + gid: number; + rdev: number; + size: number; + blksize: number; + blocks: number; + atime: Date; + mtime: Date; + ctime: Date; + } + interface FSWatcher extends events.EventEmitter { + close(): void; + } + + export interface ReadStream extends stream.Readable { } + export interface WriteStream extends stream.Writable { } + + export function rename(oldPath: string, newPath: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function renameSync(oldPath: string, newPath: string): void; + export function truncate(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function truncate(path: string, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function truncateSync(path: string, len?: number): void; + export function ftruncate(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function ftruncate(fd: number, len: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function ftruncateSync(fd: number, len?: number): void; + export function chown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function chownSync(path: string, uid: number, gid: number): void; + export function fchown(fd: number, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fchownSync(fd: number, uid: number, gid: number): void; + export function lchown(path: string, uid: number, gid: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function lchownSync(path: string, uid: number, gid: number): void; + export function chmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function chmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function chmodSync(path: string, mode: number): void; + export function chmodSync(path: string, mode: string): void; + export function fchmod(fd: number, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fchmod(fd: number, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fchmodSync(fd: number, mode: number): void; + export function fchmodSync(fd: number, mode: string): void; + export function lchmod(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function lchmod(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function lchmodSync(path: string, mode: number): void; + export function lchmodSync(path: string, mode: string): void; + export function stat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; + export function lstat(path: string, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; + export function fstat(fd: number, callback?: (err: NodeJS.ErrnoException, stats: Stats) => any): void; + export function statSync(path: string): Stats; + export function lstatSync(path: string): Stats; + export function fstatSync(fd: number): Stats; + export function link(srcpath: string, dstpath: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function linkSync(srcpath: string, dstpath: string): void; + export function symlink(srcpath: string, dstpath: string, type?: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function symlinkSync(srcpath: string, dstpath: string, type?: string): void; + export function readlink(path: string, callback?: (err: NodeJS.ErrnoException, linkString: string) => any): void; + export function readlinkSync(path: string): string; + export function realpath(path: string, callback?: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; + export function realpath(path: string, cache: { [path: string]: string }, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void; + export function realpathSync(path: string, cache?: { [path: string]: string }): string; + export function unlink(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function unlinkSync(path: string): void; + export function rmdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function rmdirSync(path: string): void; + export function mkdir(path: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function mkdir(path: string, mode: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function mkdir(path: string, mode: string, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function mkdirSync(path: string, mode?: number): void; + export function mkdirSync(path: string, mode?: string): void; + export function readdir(path: string, callback?: (err: NodeJS.ErrnoException, files: string[]) => void): void; + export function readdirSync(path: string): string[]; + export function close(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function closeSync(fd: number): void; + export function open(path: string, flags: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; + export function open(path: string, flags: string, mode: number, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; + export function open(path: string, flags: string, mode: string, callback?: (err: NodeJS.ErrnoException, fd: number) => any): void; + export function openSync(path: string, flags: string, mode?: number): number; + export function openSync(path: string, flags: string, mode?: string): number; + export function utimes(path: string, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function utimes(path: string, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function utimesSync(path: string, atime: number, mtime: number): void; + export function utimesSync(path: string, atime: Date, mtime: Date): void; + export function futimes(fd: number, atime: number, mtime: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function futimes(fd: number, atime: Date, mtime: Date, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function futimesSync(fd: number, atime: number, mtime: number): void; + export function futimesSync(fd: number, atime: Date, mtime: Date): void; + export function fsync(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; + export function fsyncSync(fd: number): void; + export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void; + export function writeSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; + export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number, callback?: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void; + export function readSync(fd: number, buffer: Buffer, offset: number, length: number, position: number): number; + export function readFile(filename: string, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + export function readFile(filename: string, options: { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: string) => void): void; + export function readFile(filename: string, options: { flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + export function readFile(filename: string, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void; + export function readFileSync(filename: string, encoding: string): string; + export function readFileSync(filename: string, options: { encoding: string; flag?: string; }): string; + export function readFileSync(filename: string, options?: { flag?: string; }): Buffer; + export function writeFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; + export function writeFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: number; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, options: { encoding?: string; mode?: string; flag?: string; }, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFile(filename: string, data: any, callback?: (err: NodeJS.ErrnoException) => void): void; + export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: number; flag?: string; }): void; + export function appendFileSync(filename: string, data: any, options?: { encoding?: string; mode?: string; flag?: string; }): void; + export function watchFile(filename: string, listener: (curr: Stats, prev: Stats) => void): void; + export function watchFile(filename: string, options: { persistent?: boolean; interval?: number; }, listener: (curr: Stats, prev: Stats) => void): void; + export function unwatchFile(filename: string, listener?: (curr: Stats, prev: Stats) => void): void; + export function watch(filename: string, listener?: (event: string, filename: string) => any): FSWatcher; + export function watch(filename: string, options: { persistent?: boolean; }, listener?: (event: string, filename: string) => any): FSWatcher; + export function exists(path: string, callback?: (exists: boolean) => void): void; + export function existsSync(path: string): boolean; + export function createReadStream(path: string, options?: { + flags?: string; + encoding?: string; + fd?: string; + mode?: number; + bufferSize?: number; + }): ReadStream; + export function createReadStream(path: string, options?: { + flags?: string; + encoding?: string; + fd?: string; + mode?: string; + bufferSize?: number; + }): ReadStream; + export function createWriteStream(path: string, options?: { + flags?: string; + encoding?: string; + string?: string; + }): WriteStream; + } +} + +declare module NodeJS { + module path { + export function normalize(p: string): string; + export function join(...paths: any[]): string; + export function resolve(...pathSegments: any[]): string; + export function relative(from: string, to: string): string; + export function dirname(p: string): string; + export function basename(p: string, ext?: string): string; + export function extname(p: string): string; + export var sep: string; + } +} + +declare module NodeJS { + module _debugger { + export interface Packet { + raw: string; + headers: string[]; + body: Message; + } + + export interface Message { + seq: number; + type: string; + } + + export interface RequestInfo { + command: string; + arguments: any; + } + + export interface Request extends Message, RequestInfo { + } + + export interface Event extends Message { + event: string; + body?: any; + } + + export interface Response extends Message { + request_seq: number; + success: boolean; + /** Contains error message if success == false. */ + message?: string; + /** Contains message body if success == true. */ + body?: any; + } + + export interface BreakpointMessageBody { + type: string; + target: number; + line: number; + } + + export class Protocol { + res: Packet; + state: string; + execute(data: string): void; + serialize(rq: Request): string; + onResponse: (pkt: Packet) => void; + } + + export var NO_FRAME: number; + export var port: number; + + export interface ScriptDesc { + name: string; + id: number; + isNative?: boolean; + handle?: number; + type: string; + lineOffset?: number; + columnOffset?: number; + lineCount?: number; + } + + export interface Breakpoint { + id: number; + scriptId: number; + script: ScriptDesc; + line: number; + condition?: string; + scriptReq?: string; + } + + export interface RequestHandler { + (err: boolean, body: Message, res: Packet): void; + request_seq?: number; + } + + export interface ResponseBodyHandler { + (err: boolean, body?: any): void; + request_seq?: number; + } + + export interface ExceptionInfo { + text: string; + } + + export interface BreakResponse { + script?: ScriptDesc; + exception?: ExceptionInfo; + sourceLine: number; + sourceLineText: string; + sourceColumn: number; + } + + export function SourceInfo(body: BreakResponse): string; + + export class Client extends events.EventEmitter { + protocol: Protocol; + scripts: ScriptDesc[]; + handles: ScriptDesc[]; + breakpoints: Breakpoint[]; + currentSourceLine: number; + currentSourceColumn: number; + currentSourceLineText: string; + currentFrame: number; + currentScript: string; + + connect(port: number, host: string): void; + req(req: any, cb: RequestHandler): void; + reqFrameEval(code: string, frame: number, cb: RequestHandler): void; + mirrorObject(obj: any, depth: number, cb: ResponseBodyHandler): void; + setBreakpoint(rq: BreakpointMessageBody, cb: RequestHandler): void; + clearBreakpoint(rq: Request, cb: RequestHandler): void; + listbreakpoints(cb: RequestHandler): void; + reqSource(from: number, to: number, cb: RequestHandler): void; + reqScripts(cb: any): void; + reqContinue(cb: RequestHandler): void; + } + } +} \ No newline at end of file diff --git a/src/server/protocol.ts b/src/server/protocol.ts new file mode 100644 index 00000000000..abbce0b3588 --- /dev/null +++ b/src/server/protocol.ts @@ -0,0 +1,1309 @@ +/// +/// +/// +/// +/// + +module ts { + export interface NavigationBarItem { + displayString?: string; + docString?: string; + } + + export interface System { + getModififedTime? (fileName: string): Date; + stat? (path: string, callback?: (err: any, stats: any) => any): void; + } +} + +module ts.server { + var paddedLength = 8; + + var typeNames = ["interface", "class", "enum", "module", "alias", "type"]; + + var spaceCache = [" ", " ", " ", " "]; + + interface StackTraceError extends Error { + stack?: string; + } + + function generateSpaces(n: number): string { + if (!spaceCache[n]) { + var strBuilder = ""; + for (var i = 0; i < n; i++) { + strBuilder += " "; + } + spaceCache[n] = strBuilder; + } + return spaceCache[n]; + } + + function isTypeName(name: string, suffix?: string) { + for (var i = 0, len = typeNames.length; i < len; i++) { + if (typeNames[i] == name) { + return true; + } + else if (suffix && ((typeNames[i] + suffix) == name)) { + return true; + } + } + return false; + } + + function parseTypeName(displayParts: ts.SymbolDisplayPart[]) { + var len = displayParts.length; + for (var i = len - 1; i >= 0; i--) { + if (isTypeName(displayParts[i].kind, "Name")) { + return displayParts[i].text; + } + } + return undefined; + } + + function findExactMatchType(items: ts.NavigateToItem[]) { + for (var i = 0, len = items.length; i < len; i++) { + var navItem = items[i]; + if (navItem.matchKind == "exact") { + if (isTypeName(navItem.kind)) { + return navItem; + } + } + } + } + + interface FileStart { + file: string; + start: ILineInfo; + } + + function compareNumber(a: number, b: number) { + if (a < b) { + return -1; + } + else if (a == b) { + return 0; + } + else return 1; + } + + function printObject(obj: any) { + for (var p in obj) { + if (obj.hasOwnProperty(p)) { + console.log(p + ": " + obj[p]); + } + } + } + + function compareFileStart(a: FileStart, b: FileStart) { + if (a.file < b.file) { + return -1; + } + else if (a.file == b.file) { + var n = compareNumber(a.start.line, b.start.line); + if (n == 0) { + return compareNumber(a.start.col, b.start.col); + } + else return n; + } + else { + return 1; + } + } + + function sortNavItems(items: ts.NavigateToItem[]) { + return items.sort((a, b) => { + if (a.matchKind < b.matchKind) { + return -1; + } + else if (a.matchKind == b.matchKind) { + var lowa = a.name.toLowerCase(); + var lowb = b.name.toLowerCase(); + if (lowa < lowb) { + return -1; + } + else if (lowa == lowb) { + return 0; + } + else { + return 1; + } + } + else { + return 1; + } + }) + } + + //function SourceInfo(body: NodeJS._debugger.BreakResponse) { + // var result = body.exception ? 'exception in ' : 'break in '; + + // if (body.script) { + // if (body.script.name) { + // var name = body.script.name, + // dir = path.resolve() + '/'; + + // // Change path to relative, if possible + // if (name.indexOf(dir) === 0) { + // name = name.slice(dir.length); + // } + + // result += name; + // } else { + // result += '[unnamed]'; + // } + // } + // result += ':'; + // result += body.sourceLine + 1; + + // if (body.exception) result += '\n' + body.exception.text; + + // return result; + //} + + class JsDebugSession { + host = 'localhost'; + port = 5858; + + constructor(public client: NodeJS._debugger.Client) { + this.init(); + } + + cont(cb: NodeJS._debugger.RequestHandler) { + this.client.reqContinue(cb); + } + + listSrc() { + this.client.reqScripts((err: any) => { + if (err) { + console.log("rscr error: " + err); + } + else { + console.log("req scripts"); + for (var id in this.client.scripts) { + var script = this.client.scripts[id]; + if ((typeof script === "object") && script.name) { + console.log(id + ": " + script.name); + } + } + } + }); + } + + findScript(file: string) { + if (file) { + var script: NodeJS._debugger.ScriptDesc; + var scripts = this.client.scripts; + var keys: any[] = Object.keys(scripts); + var ambiguous = false; + for (var v = 0; v < keys.length; v++) { + var id = keys[v]; + if (scripts[id] && + scripts[id].name && + scripts[id].name.indexOf(file) !== -1) { + if (script) { + ambiguous = true; + } + script = scripts[id]; + } + } + return { script: script, ambiguous: ambiguous }; + } + } + + // TODO: condition + setBreakpointOnLine(line: number, file?: string) { + if (!file) { + file = this.client.currentScript; + } + var script: NodeJS._debugger.ScriptDesc; + var scriptResult = this.findScript(file); + if (scriptResult) { + if (scriptResult.ambiguous) { + // TODO: send back error + script = undefined; + } + else { + script = scriptResult.script; + } + } + // TODO: set breakpoint when script not loaded + if (script) { + var brkmsg: NodeJS._debugger.BreakpointMessageBody = { + type: 'scriptId', + target: script.id, + line: line - 1, + } + this.client.setBreakpoint(brkmsg,(err, bod) => { + // TODO: remember breakpoint + if (err) { + console.log("Error: set breakpoint: " + err); + } + }); + } + + } + + init() { + var connectionAttempts = 0; + this.client.on('break',(res: NodeJS._debugger.Event) => { + this.handleBreak(res.body); + }); + this.client.on('exception',(res: NodeJS._debugger.Event) => { + this.handleBreak(res.body); + }); + this.client.on('error',() => { + setTimeout(() => { + ++connectionAttempts; + this.client.connect(this.port, this.host); + }, 500); + }); + this.client.once('ready',() => { + }); + this.client.on('unhandledResponse',() => { + }); + this.client.connect(this.port, this.host); + } + + evaluate(code: string) { + var frame = this.client.currentFrame; + this.client.reqFrameEval(code, frame,(err, bod) => { + if (err) { + console.log("Error: evaluate: " + err); + return; + } + + console.log("Value: " + bod.toString()); + if (typeof bod === "object") { + printObject(bod); + } + + // Request object by handles (and it's sub-properties) + this.client.mirrorObject(bod, 3,(err, mirror) => { + if (mirror) { + if (typeof mirror === "object") { + printObject(mirror); + } + console.log(mirror.toString()); + } + else { + console.log("undefined"); + } + }); + + }); + } + + handleBreak(breakInfo: NodeJS._debugger.BreakResponse) { + this.client.currentSourceLine = breakInfo.sourceLine; + this.client.currentSourceLineText = breakInfo.sourceLineText; + this.client.currentSourceColumn = breakInfo.sourceColumn; + this.client.currentFrame = 0; + this.client.currentScript = breakInfo.script && breakInfo.script.name; + + //console.log(SourceInfo(breakInfo)); + // TODO: watchers + } + } + + interface FileRange { + file?: string; + start: ILineInfo; + end: ILineInfo; + } + + interface FileRanges { + file: string; + locs: FileRange[]; + } + + function formatDiag(file: string, project: Project, diag: ts.Diagnostic) { + return { + start: project.compilerService.host.positionToLineCol(file, diag.start), + len: diag.length, + text: diag.messageText, + }; + } + + interface PendingErrorCheck { + filename: string; + project: Project; + } + + function allEditsBeforePos(edits: ts.TextChange[], pos: number) { + for (var i = 0, len = edits.length; i < len; i++) { + if (ts.textSpanEnd(edits[i].span) >= pos) { + return false; + } + } + return true; + } + + module CommandNames { + export var Abbrev = "abbrev"; + export var Change = "change"; + export var Close = "close"; + export var Completions = "completions"; + export var Definition = "definition"; + export var Format = "format"; + export var Formatonkey = "formatonkey"; + export var Geterr = "geterr"; + export var Navto = "navto"; + export var Open = "open"; + export var Quickinfo = "quickinfo"; + export var References = "references"; + export var Reload = "reload"; + export var Rename = "rename"; + export var Saveto = "saveto"; + export var Type = "type"; + export var Unknown = "unknown"; + } + + export interface ServerHost extends ts.System { + getDebuggerClient? (): NodeJS._debugger.Client; + } + + export class Session { + projectService: ProjectService; + debugSession: JsDebugSession; + pendingOperation = false; + fileHash: ts.Map = {}; + abbrevTable: ts.Map; + fetchedAbbrev = false; + nextFileId = 1; + errorTimer: NodeJS.Timer; + immediateId: any; + changeSeq = 0; + + constructor(private host: ServerHost, private logger: Logger, protected useProtocol: boolean, protected prettyJSON: boolean) { + this.projectService = new ProjectService(host, logger); + this.initAbbrevTable(); + } + + logError(err: Error, cmd: string) { + var typedErr = err; + var msg = "Exception on executing command " + cmd; + if (typedErr.message) { + msg += ":\n" + typedErr.message; + if (typedErr.stack) { + msg += "\n" + typedErr.stack; + } + } + this.projectService.log(msg); + } + + sendLineToClient(line: string) { + this.host.write(line + this.host.newLine); + } + + send(msg: NodeJS._debugger.Message) { + var json: string; + if (this.prettyJSON) { + json = JSON.stringify(msg, null, " "); + } + else { + json = JSON.stringify(msg); + } + this.sendLineToClient('Content-Length: ' + (1 + Buffer.byteLength(json, 'utf8')) + + '\r\n\r\n' + json); + } + + event(info: any, eventName: string) { + var ev: NodeJS._debugger.Event = { + seq: 0, + type: "event", + event: eventName, + body: info, + }; + this.send(ev); + } + + response(info: any, cmdName: string, reqSeq = 0, errorMsg?: string) { + var res: ServerProtocol.Response = { + seq: 0, + type: "response", + command: cmdName, + request_seq: reqSeq, + success: !errorMsg, + } + if (!errorMsg) { + res.body = info; + } + else { + res.message = errorMsg; + } + this.send(res); + } + + initAbbrevTable() { + this.abbrevTable = { + name: "n", + kind: "k", + fileName: "f", + containerName: "cn", + containerKind: "ck", + kindModifiers: "km", + start: "s", + end: "e", + line: "l", + col: "c", + "interface": "i", + "function": "fn", + }; + } + + encodeFilename(filename: string): ServerProtocol.EncodedFile { + if (!this.fetchedAbbrev) { + return filename; + } + else { + var id = ts.lookUp(this.fileHash, filename); + if (!id) { + id = this.nextFileId++; + this.fileHash[filename] = id; + return { id: id, file: filename }; + } + else { + return id; + } + } + } + + abbreviate(obj: any) { + if (this.fetchedAbbrev && (!this.prettyJSON)) { + for (var p in obj) { + if (obj.hasOwnProperty(p)) { + var sub = ts.lookUp(this.abbrevTable, p); + if (sub) { + obj[sub] = obj[p]; + obj[p] = undefined; + } + } + } + } + } + + output(info: any, cmdName: string, reqSeq = 0, errorMsg?: string) { + if (this.useProtocol) { + this.response(info, cmdName, reqSeq, errorMsg); + } + else if (this.prettyJSON) { + if (!errorMsg) { + this.sendLineToClient(JSON.stringify(info, null, " ").trim()); + } + else { + this.sendLineToClient(JSON.stringify(errorMsg)); + } + } else { + if (!errorMsg) { + var infoStr = JSON.stringify(info).trim(); + // [8 digits of length,infoStr] + '\n' + var len = infoStr.length + paddedLength + 4; + var lenStr = len.toString(); + var padLen = paddedLength - lenStr.length; + for (var i = 0; i < padLen; i++) { + lenStr = '0' + lenStr; + } + this.sendLineToClient("[" + lenStr + "," + infoStr + "]"); + } + else { + this.sendLineToClient(JSON.stringify("error: " + errorMsg)); + } + } + } + + semanticCheck(file: string, project: Project) { + var diags = project.compilerService.languageService.getSemanticDiagnostics(file); + if (diags) { + var bakedDiags = diags.map((diag) => formatDiag(file, project, diag)); + this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag"); + } + } + + syntacticCheck(file: string, project: Project) { + var diags = project.compilerService.languageService.getSyntacticDiagnostics(file); + if (diags) { + var bakedDiags = diags.map((diag) => formatDiag(file, project, diag)); + this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag"); + } + } + + errorCheck(file: string, project: Project) { + this.syntacticCheck(file, project); + this.semanticCheck(file, project); + } + + updateErrorCheck(checkList: PendingErrorCheck[], seq: number, + matchSeq: (seq: number) => boolean, ms = 1500, followMs = 200) { + if (followMs > ms) { + followMs = ms; + } + if (this.errorTimer) { + clearTimeout(this.errorTimer); + } + if (this.immediateId) { + clearImmediate(this.immediateId); + this.immediateId = undefined; + } + var index = 0; + var checkOne = () => { + if (matchSeq(seq)) { + var checkSpec = checkList[index++]; + if (checkSpec.project.getSourceFileFromName(checkSpec.filename)) { + this.syntacticCheck(checkSpec.filename, checkSpec.project); + this.immediateId = setImmediate(() => { + this.semanticCheck(checkSpec.filename, checkSpec.project); + this.immediateId = undefined; + if (checkList.length > index) { + this.errorTimer = setTimeout(checkOne, followMs); + } + else { + this.errorTimer = undefined; + } + }); + } + } + } + if ((checkList.length > index) && (matchSeq(seq))) { + this.errorTimer = setTimeout(checkOne, ms); + } + } + + goToDefinition(line: number, col: number, rawfile: string, reqSeq = 0) { + var file = ts.normalizePath(rawfile); + var project = this.projectService.getProjectForFile(file); + if (project) { + var compilerService = project.compilerService; + var pos = compilerService.host.lineColToPosition(file, line, col); + var locs = compilerService.languageService.getDefinitionAtPosition(file, pos); + if (locs) { + var info: ServerProtocol.CodeSpan[] = locs.map(def => ({ + file: def && def.fileName, + start: def && + compilerService.host.positionToLineCol(def.fileName, def.textSpan.start), + end: def && + compilerService.host.positionToLineCol(def.fileName, ts.textSpanEnd(def.textSpan)) + })); + this.output(info, CommandNames.Definition, reqSeq); + } + else { + this.output(undefined, CommandNames.Definition, reqSeq, "could not find def"); + } + } + else { + this.output(undefined, CommandNames.Definition, reqSeq, "no project for " + file); + } + } + + rename(line: number, col: number, rawfile: string, reqSeq = 0) { + var file = ts.normalizePath(rawfile); + var project = this.projectService.getProjectForFile(file); + if (project) { + var compilerService = project.compilerService; + var pos = compilerService.host.lineColToPosition(file, line, col); + var renameInfo = compilerService.languageService.getRenameInfo(file, pos); + if (renameInfo) { + if (renameInfo.canRename) { + var renameLocs = compilerService.languageService.findRenameLocations(file, pos, false, false); + if (renameLocs) { + var bakedRenameLocs = renameLocs.map(loc=> ({ + file: loc.fileName, + start: compilerService.host.positionToLineCol(loc.fileName, loc.textSpan.start), + end: compilerService.host.positionToLineCol(loc.fileName, ts.textSpanEnd(loc.textSpan)), + })).sort((a, b) => { + if (a.file < b.file) { + return -1; + } + else if (a.file > b.file) { + return 1; + } + else { + // reverse sort assuming no overlap + if (a.start.line < b.start.line) { + return 1; + } + else if (a.start.line > b.start.line) { + return -1; + } + else { + return b.start.col - a.start.col; + } + } + }).reduce((accum: FileRanges[], cur: FileRange) => { + var curFileAccum: FileRanges; + if (accum.length > 0) { + curFileAccum = accum[accum.length - 1]; + if (curFileAccum.file != cur.file) { + curFileAccum = undefined; + } + } + if (!curFileAccum) { + curFileAccum = { file: cur.file, locs: [] }; + accum.push(curFileAccum); + } + curFileAccum.locs.push({ start: cur.start, end: cur.end }); + return accum; + }, []); + this.output({ info: renameInfo, locs: bakedRenameLocs }, CommandNames.Rename, reqSeq); + } + else { + this.output({ info: renameInfo, locs: [] }, CommandNames.Rename, reqSeq); + } + } + else { + this.output(undefined, CommandNames.Rename, reqSeq, renameInfo.localizedErrorMessage); + } + } + else { + this.output(undefined, CommandNames.Rename, reqSeq, "no rename information at cursor"); + } + } + } + + findReferences(line: number, col: number, rawfile: string, reqSeq = 0) { + // TODO: get all projects for this file; report refs for all projects deleting duplicates + // can avoid duplicates by eliminating same ref file from subsequent projects + var file = ts.normalizePath(rawfile); + var project = this.projectService.getProjectForFile(file); + if (project) { + var compilerService = project.compilerService; + var pos = compilerService.host.lineColToPosition(file, line, col); + var refs = compilerService.languageService.getReferencesAtPosition(file, pos); + if (refs) { + var nameInfo = compilerService.languageService.getQuickInfoAtPosition(file, pos); + if (nameInfo) { + var displayString = ts.displayPartsToString(nameInfo.displayParts); + var nameSpan = nameInfo.textSpan; + var nameColStart = + compilerService.host.positionToLineCol(file, nameSpan.start).col; + var nameText = + compilerService.host.getScriptSnapshot(file).getText(nameSpan.start, ts.textSpanEnd(nameSpan)); + var bakedRefs: ServerProtocol.ReferencesResponseItem[] = refs.map((ref) => { + var start = compilerService.host.positionToLineCol(ref.fileName, ref.textSpan.start); + var refLineSpan = compilerService.host.lineToTextSpan(ref.fileName, start.line - 1); + var snap = compilerService.host.getScriptSnapshot(ref.fileName); + var lineText = snap.getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); + return { + file: ref.fileName, + start: start, + lineText: lineText, + end: compilerService.host.positionToLineCol(ref.fileName, ts.textSpanEnd(ref.textSpan)), + }; + }).sort(compareFileStart); + var response: ServerProtocol.ReferencesResponseBody = { + refs: bakedRefs, + symbolName: nameText, + symbolStartCol: nameColStart, + symbolDisplayString: displayString + }; + this.output(response, CommandNames.References, reqSeq); + } + else { + this.output(undefined, CommandNames.References, reqSeq, "no references at this position"); + } + } + else { + this.output(undefined, CommandNames.References, reqSeq, "no references at this position"); + } + } + } + + // TODO: implement this as ls api that can return multiple def sites + goToType(line: number, col: number, rawfile: string, reqSeq = 0) { + var file = ts.normalizePath(rawfile); + var project = this.projectService.getProjectForFile(file); + if (project) { + var compilerService = project.compilerService; + var pos = compilerService.host.lineColToPosition(file, line, col); + var quickInfo = compilerService.languageService.getQuickInfoAtPosition(file, pos); + var typeLoc: any; + + if (quickInfo && (quickInfo.kind == "var") || (quickInfo.kind == "local var")) { + var typeName = parseTypeName(quickInfo.displayParts); + if (typeName) { + var navItems = compilerService.languageService.getNavigateToItems(typeName); + var navItem = findExactMatchType(navItems); + if (navItem) { + typeLoc = { + file: navItem.fileName, + start: compilerService.host.positionToLineCol(navItem.fileName, + navItem.textSpan.start), + end: compilerService.host.positionToLineCol(navItem.fileName, + ts.textSpanEnd(navItem.textSpan)), + }; + } + } + } + if (typeLoc) { + this.output([typeLoc], CommandNames.Type, reqSeq); + } + else { + this.output(undefined, CommandNames.Type, reqSeq, "no info at this location"); + } + } + else { + this.output(undefined, CommandNames.Type, reqSeq, "no project for " + file); + } + } + + openClientFile(rawfile: string) { + var file = ts.normalizePath(rawfile); + this.projectService.openClientFile(file); + } + + quickInfo(line: number, col: number, rawfile: string, reqSeq = 0) { + var file = ts.normalizePath(rawfile); + var project = this.projectService.getProjectForFile(file); + if (project) { + var compilerService = project.compilerService; + var pos = compilerService.host.lineColToPosition(file, line, col); + var quickInfo = compilerService.languageService.getQuickInfoAtPosition(file, pos); + if (quickInfo) { + var displayString = ts.displayPartsToString(quickInfo.displayParts); + var docString = ts.displayPartsToString(quickInfo.documentation); + var qi: ServerProtocol.QuickInfoResponseBody = { + kind: quickInfo.kind, + kindModifiers: quickInfo.kindModifiers, + start: compilerService.host.positionToLineCol(file, quickInfo.textSpan.start), + end: compilerService.host.positionToLineCol(file, ts.textSpanEnd(quickInfo.textSpan)), + displayString: displayString, + documentation: docString, + }; + this.output(qi, CommandNames.Quickinfo, reqSeq); + } + else { + this.output(undefined, CommandNames.Quickinfo, reqSeq, "no info") + } + } + } + + format(line: number, col: number, endLine: number, endCol: number, rawfile: string, cmd: string, reqSeq = 0) { + var file = ts.normalizePath(rawfile); + var project = this.projectService.getProjectForFile(file); + if (project) { + var compilerService = project.compilerService; + var pos = compilerService.host.lineColToPosition(file, line, col); + var endPos = compilerService.host.lineColToPosition(file, endLine, endCol); + var edits: ts.TextChange[]; + // TODO: avoid duplicate code (with formatonkey) + try { + edits = compilerService.languageService.getFormattingEditsForRange(file, pos, endPos, + compilerService.formatCodeOptions); + } + catch (err) { + this.logError(err, cmd); + edits = undefined; + } + if (edits) { + var bakedEdits: ServerProtocol.CodeEdit[] = edits.map((edit) => { + return { + start: compilerService.host.positionToLineCol(file, + edit.span.start), + end: compilerService.host.positionToLineCol(file, + ts.textSpanEnd(edit.span)), + newText: edit.newText ? edit.newText : "" + }; + }); + this.output(bakedEdits, CommandNames.Format, reqSeq); + } + else { + this.output(undefined, CommandNames.Format, reqSeq, "no edits") + } + } + } + + formatOnKey(line: number, col: number, key: string, rawfile: string, cmd: string, reqSeq = 0) { + var file = ts.normalizePath(rawfile); + var project = this.projectService.getProjectForFile(file); + if (project) { + var compilerService = project.compilerService; + var pos = compilerService.host.lineColToPosition(file, line, col); + var edits: ts.TextChange[]; + try { + edits = compilerService.languageService.getFormattingEditsAfterKeystroke(file, pos, key, + compilerService.formatCodeOptions); + if ((key == "\n") && ((!edits) || (edits.length == 0) || allEditsBeforePos(edits, pos))) { + // TODO: get these options from host + var editorOptions: ts.EditorOptions = { + IndentSize: 4, + TabSize: 4, + NewLineCharacter: "\n", + ConvertTabsToSpaces: true, + }; + var indentPosition = compilerService.languageService.getIndentationAtPosition(file, pos, editorOptions); + var spaces = generateSpaces(indentPosition); + if (indentPosition > 0) { + edits.push({ span: ts.createTextSpanFromBounds(pos, pos), newText: spaces }); + } + } + } + catch (err) { + this.logError(err, cmd); + edits = undefined; + } + if (edits) { + var bakedEdits: ServerProtocol.CodeEdit[] = edits.map((edit) => { + return { + start: compilerService.host.positionToLineCol(file, + edit.span.start), + end: compilerService.host.positionToLineCol(file, + ts.textSpanEnd(edit.span)), + newText: edit.newText ? edit.newText : "" + }; + }); + this.output(bakedEdits, CommandNames.Formatonkey, reqSeq); + } + else { + this.output(undefined, CommandNames.Formatonkey, reqSeq, "no edits") + } + } + } + + completions(line: number, col: number, prefix: string, rawfile: string, cmd: string, reqSeq = 0) { + if (!prefix) { + prefix = ""; + } + var file = ts.normalizePath(rawfile); + var project = this.projectService.getProjectForFile(file); + var completions: ts.CompletionInfo = undefined; + if (project) { + var compilerService = project.compilerService; + var pos = compilerService.host.lineColToPosition(file, line, col); + if (pos >= 0) { + try { + completions = compilerService.languageService.getCompletionsAtPosition(file, pos); + } + catch (err) { + this.logError(err, cmd); + completions = undefined; + } + if (completions) { + var compressedEntries: ServerProtocol.CompletionItem[] = + completions.entries.reduce((accum: ts.CompletionEntryDetails[], entry: ts.CompletionEntry) => { + if (entry.name.indexOf(prefix) == 0) { + var protoEntry = {}; + protoEntry.name = entry.name; + protoEntry.kind = entry.kind; + if (entry.kindModifiers && (entry.kindModifiers.length > 0)) { + protoEntry.kindModifiers = entry.kindModifiers; + } + var details = compilerService.languageService.getCompletionEntryDetails(file, pos, entry.name); + if (details && (details.documentation) && (details.documentation.length > 0)) { + protoEntry.documentation = details.documentation; + } + if (details && (details.displayParts) && (details.displayParts.length > 0)) { + protoEntry.displayParts = details.documentation; + } + accum.push(protoEntry); + } + return accum; + }, []); + this.output(compressedEntries, CommandNames.Completions, reqSeq); + } + } + } + if (!completions) { + this.output(undefined, CommandNames.Completions, reqSeq, "no completions"); + } + } + + geterr(ms: number, files: string[]) { + var checkList = files.reduce((accum: PendingErrorCheck[], filename: string) => { + filename = ts.normalizePath(filename); + var project = this.projectService.getProjectForFile(filename); + if (project) { + accum.push({ filename: filename, project: project }); + } + return accum; + }, []); + if (checkList.length > 0) { + this.updateErrorCheck(checkList, this.changeSeq,(n) => n == this.changeSeq, ms) + } + } + + change(line: number, col: number, deleteLen: number, insertString: string, rawfile: string) { + var file = ts.normalizePath(rawfile); + var project = this.projectService.getProjectForFile(file); + if (project) { + var compilerService = project.compilerService; + var pos = compilerService.host.lineColToPosition(file, line, col); + if (pos >= 0) { + var end = pos; + if (deleteLen) { + end += deleteLen; + } + compilerService.host.editScript(file, pos, end, insertString); + this.changeSeq++; + } + } + } + + reload(rawfile: string, rawtmpfile: string, reqSeq = 0) { + var file = ts.normalizePath(rawfile); + var tmpfile = ts.normalizePath(rawtmpfile); + var project = this.projectService.getProjectForFile(file); + if (project) { + this.changeSeq++; + // make sure no changes happen before this one is finished + project.compilerService.host.reloadScript(file, tmpfile,() => { + this.output(undefined, CommandNames.Reload, reqSeq); + }); + } + } + + saveToTmp(rawfile: string, rawtmpfile: string) { + var file = ts.normalizePath(rawfile); + var tmpfile = ts.normalizePath(rawtmpfile); + + var project = this.projectService.getProjectForFile(file); + if (project) { + project.compilerService.host.saveTo(file, tmpfile); + } + } + + closeClientFile(rawfile: string) { + var file = ts.normalizePath(rawfile); + this.projectService.closeClientFile(file); + } + + decorateNavBarItem(navBarItem: ts.NavigationBarItem, compilerService: CompilerService, file: string) { + if (navBarItem.spans.length == 1) { + var span = navBarItem.spans[0]; + var offset = span.start; + var textForSpan = compilerService.host.getScriptSnapshot(file).getText(offset, offset + span.length); + var adj = textForSpan.indexOf(navBarItem.text); + if (adj > 0) { + offset += adj; + } + var quickInfo = compilerService.languageService.getQuickInfoAtPosition(file, + offset + (navBarItem.text.length / 2)); + if (quickInfo) { + var displayString = ts.displayPartsToString(quickInfo.displayParts); + var docString = ts.displayPartsToString(quickInfo.documentation); + navBarItem.displayString = displayString; + navBarItem.docString = docString; + } + } + if (navBarItem.childItems.length > 0) { + navBarItem.childItems = + navBarItem.childItems.map(navBarItem => this.decorateNavBarItem(navBarItem, compilerService, file)); + } + return navBarItem; + } + + navbar(rawfile: string, reqSeq = 0) { + var file = ts.normalizePath(rawfile); + var project = this.projectService.getProjectForFile(file); + if (project) { + var compilerService = project.compilerService; + var navBarItems = compilerService.languageService.getNavigationBarItems(file); + var bakedNavBarItems = navBarItems.map(navBarItem => this.decorateNavBarItem(navBarItem, compilerService, file)); + this.sendLineToClient(JSON.stringify(bakedNavBarItems, null, " ")); + } + } + + navto(searchTerm: string, rawfile: string, cmd: string, reqSeq = 0) { + var file = ts.normalizePath(rawfile); + var project = this.projectService.getProjectForFile(file); + if (project) { + var compilerService = project.compilerService; + var navItems: ts.NavigateToItem[]; + var cancellationToken = compilerService.host.getCancellationToken(); + if (this.pendingOperation) { + cancellationToken.cancel(); + cancellationToken.reset(); + } + try { + this.pendingOperation = true; + navItems = sortNavItems(compilerService.languageService.getNavigateToItems(searchTerm)); + } + catch (err) { + this.logError(err, cmd); + navItems = undefined; + } + this.pendingOperation = false; + if (navItems) { + var bakedNavItems: ServerProtocol.NavtoItem[] = navItems.map((navItem) => { + var start = compilerService.host.positionToLineCol(navItem.fileName, + navItem.textSpan.start); + var end = compilerService.host.positionToLineCol(navItem.fileName, ts.textSpanEnd(navItem.textSpan)); + this.abbreviate(start); + var bakedItem: ServerProtocol.NavtoItem = { + name: navItem.name, + kind: navItem.kind, + file: this.encodeFilename(navItem.fileName), + start: start, + end: end, + }; + if (navItem.kindModifiers && (navItem.kindModifiers != "")) { + bakedItem.kindModifiers = navItem.kindModifiers; + } + if (navItem.matchKind != 'none') { + bakedItem.matchKind = navItem.matchKind; + } + if (navItem.containerName && (navItem.containerName.length > 0)) { + bakedItem.containerName = navItem.containerName; + } + if (navItem.containerKind && (navItem.containerKind.length > 0)) { + bakedItem.containerKind = navItem.containerKind; + } + this.abbreviate(bakedItem); + return bakedItem; + }); + + this.output(bakedNavItems, CommandNames.Navto, reqSeq); + } + else { + this.output(undefined, CommandNames.Navto, reqSeq, "no nav items"); + } + } + } + + executeJSONcmd(cmd: string) { + try { + var req = JSON.parse(cmd); + switch (req.command) { + case CommandNames.Definition: { + var defArgs = req.arguments; + this.goToDefinition(defArgs.line, defArgs.col, defArgs.file, req.seq); + break; + } + case CommandNames.References: { + var refArgs = req.arguments; + this.findReferences(refArgs.line, refArgs.col, refArgs.file, req.seq); + break; + } + case CommandNames.Rename: { + var renameArgs = req.arguments; + this.rename(renameArgs.line, renameArgs.col, renameArgs.file, req.seq); + break; + } + case CommandNames.Type: { + var typeArgs = req.arguments; + this.goToType(typeArgs.line, typeArgs.col, typeArgs.file, req.seq); + break; + } + case CommandNames.Open: { + var openArgs = req.arguments; + this.openClientFile(openArgs.file); + break; + } + case CommandNames.Quickinfo: { + var quickinfoArgs = req.arguments; + this.quickInfo(quickinfoArgs.line, quickinfoArgs.col, quickinfoArgs.file, req.seq); + break; + } + case CommandNames.Format: { + var formatArgs = req.arguments; + this.format(formatArgs.line, formatArgs.col, formatArgs.endLine, formatArgs.endCol, formatArgs.file, + cmd, req.seq); + break; + } + case CommandNames.Formatonkey: { + var formatOnKeyArgs = req.arguments; + this.formatOnKey(formatOnKeyArgs.line, formatOnKeyArgs.col, formatOnKeyArgs.key, formatOnKeyArgs.file, + cmd, req.seq); + break; + } + case CommandNames.Completions: { + var completionsArgs = req.arguments; + this.completions(req.arguments.line, req.arguments.col, completionsArgs.prefix, req.arguments.file, + cmd, req.seq); + break; + } + case CommandNames.Geterr: { + var geterrArgs = req.arguments; + this.geterr(geterrArgs.delay, geterrArgs.files); + break; + } + case CommandNames.Change: { + var changeArgs = req.arguments; + this.change(changeArgs.line, changeArgs.col, changeArgs.deleteLen, changeArgs.insertString, + changeArgs.file); + break; + } + case CommandNames.Reload: { + var reloadArgs = req.arguments; + this.reload(reloadArgs.file, reloadArgs.tmpfile, req.seq); + break; + } + case CommandNames.Saveto: { + var savetoArgs = req.arguments; + this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile); + break; + } + case CommandNames.Close: { + var closeArgs = req.arguments; + this.closeClientFile(closeArgs.file); + break; + } + case CommandNames.Navto: { + var navtoArgs = req.arguments; + this.navto(navtoArgs.searchTerm, navtoArgs.file, cmd, req.seq); + break; + } + default: { + this.projectService.log("Unrecognized JSON command: " + cmd); + break; + } + } + } catch (err) { + this.logError(err, cmd); + } + } + + sendAbbrev(reqSeq = 0) { + if (!this.fetchedAbbrev) { + this.output(this.abbrevTable, CommandNames.Abbrev, reqSeq); + } + this.fetchedAbbrev = true; + } + + executeCmd(cmd: string) { + var line: number, col: number, file: string; + var m: string[]; + + try { + if (m = cmd.match(/^dbg start$/)) { + this.debugSession = new JsDebugSession(this.host.getDebuggerClient()); + } + else if (m = cmd.match(/^dbg cont$/)) { + if (this.debugSession) { + this.debugSession.cont((err, body, res) => { + }); + } + } + else if (m = cmd.match(/^dbg src$/)) { + if (this.debugSession) { + this.debugSession.listSrc(); + } + } + else if (m = cmd.match(/^dbg brk (\d+) (.*)$/)) { + line = parseInt(m[1]); + file = ts.normalizePath(m[2]); + if (this.debugSession) { + this.debugSession.setBreakpointOnLine(line, file); + } + } + else if (m = cmd.match(/^dbg eval (.*)$/)) { + var code = m[1]; + if (this.debugSession) { + this.debugSession.evaluate(code); + } + } + else if (m = cmd.match(/^definition (\d+) (\d+) (.*)$/)) { + line = parseInt(m[1]); + col = parseInt(m[2]); + file = m[3]; + this.goToDefinition(line, col, file); + } + else if (m = cmd.match(/^rename (\d+) (\d+) (.*)$/)) { + line = parseInt(m[1]); + col = parseInt(m[2]); + file = m[3]; + this.rename(line, col, file); + } + else if (m = cmd.match(/^type (\d+) (\d+) (.*)$/)) { + line = parseInt(m[1]); + col = parseInt(m[2]); + file = m[3]; + this.goToType(line, col, file); + } + else if (m = cmd.match(/^open (.*)$/)) { + file = m[1]; + this.openClientFile(file); + } + else if (m = cmd.match(/^references (\d+) (\d+) (.*)$/)) { + line = parseInt(m[1]); + col = parseInt(m[2]); + file = m[3]; + this.findReferences(line, col, file); + } + else if (m = cmd.match(/^quickinfo (\d+) (\d+) (.*)$/)) { + line = parseInt(m[1]); + col = parseInt(m[2]); + file = m[3]; + this.quickInfo(line, col, file); + } + else if (m = cmd.match(/^format (\d+) (\d+) (\d+) (\d+) (.*)$/)) { + // format line col endLine endCol file + line = parseInt(m[1]); + col = parseInt(m[2]); + var endLine = parseInt(m[3]); + var endCol = parseInt(m[4]); + file = m[5]; + this.format(line, col, endLine, endCol, file, cmd); + } + else if (m = cmd.match(/^formatonkey (\d+) (\d+) (\{\".*\"\})\s* (.*)$/)) { + line = parseInt(m[1]); + col = parseInt(m[2]); + var key = JSON.parse(m[3].substring(1, m[3].length - 1)); + file = m[4]; + this.formatOnKey(line, col, key, file, cmd); + } + else if (m = cmd.match(/^completions (\d+) (\d+) (\{.*\})?\s*(.*)$/)) { + line = parseInt(m[1]); + col = parseInt(m[2]); + var prefix = ""; + file = m[4]; + if (m[3]) { + prefix = m[3].substring(1, m[3].length - 1); + } + this.completions(line, col, prefix, file, cmd); + } + else if (m = cmd.match(/^geterr (\d+) (.*)$/)) { + var ms = parseInt(m[1]); + var rawFiles = m[2]; + this.geterr(ms, rawFiles.split(';')); + } + else if (m = cmd.match(/^change (\d+) (\d+) (\d+) (\d+) (\{\".*\"\})?\s*(.*)$/)) { + line = parseInt(m[1]); + col = parseInt(m[2]); + var deleteLen = parseInt(m[3]); + var insertLen = parseInt(m[4]); + var insertString: string; + if (insertLen) { + insertString = JSON.parse(m[5].substring(1, m[5].length - 1)); + } + file = m[6]; + this.change(line, col, deleteLen, insertString, file); + } + else if (m = cmd.match(/^reload (.*) from (.*)$/)) { + this.reload(m[1], m[2]); + } + // TODO: change this to saveto + else if (m = cmd.match(/^save (.*) to (.*)$/)) { + this.saveToTmp(m[1], m[2]); + } + else if (m = cmd.match(/^close (.*)$/)) { + this.closeClientFile(m[1]); + } + else if (m = cmd.match(/^navto (\{.*\}) (.*)$/)) { + var searchTerm = m[1]; + searchTerm = searchTerm.substring(1, searchTerm.length - 1); + this.navto(searchTerm, m[2], cmd); + } + else if (m = cmd.match(/^navbar (.*)$/)) { + this.navbar(m[1]); + } + else if (m = cmd.match(/^abbrev/)) { + this.sendAbbrev(); + } + else if (m = cmd.match(/^pretty/)) { + this.prettyJSON = true; + } + else if (m = cmd.match(/^printproj/)) { + this.projectService.printProjects(); + } + else if (m = cmd.match(/^fileproj (.*)$/)) { + file = ts.normalizePath(m[1]); + this.projectService.printProjectsForFile(file); + } + else { + this.output(undefined, CommandNames.Unknown, 0, "Unrecognized command " + cmd); + } + } catch (err) { + this.logError(err, cmd); + } + } + } +} diff --git a/src/server/protodef.d.ts b/src/server/protodef.d.ts new file mode 100644 index 00000000000..75a41cb81ce --- /dev/null +++ b/src/server/protodef.d.ts @@ -0,0 +1,591 @@ +/** Declaration module describing the TypeScript Server protocol */ +declare module ServerProtocol { + /** A TypeScript Server message */ + export interface Message { + /** Sequence number of the message */ + seq: number; + /** One of "request", "response", or "event" */ + type: string; + } + + /** Client-initiated request message */ + export interface Request extends Message { + /** The command to execute */ + command: string; + /** Object containing arguments for the command */ + arguments?: any; + } + + /** Server-initiated event message */ + export interface Event extends Message { + /** Name of event */ + event: string; + /** Event-specific information */ + body?: any; + } + + /** Response by server to client request message */ + export interface Response extends Message { + /** Sequence number of the request message */ + request_seq: number; + /** Outcome of the request */ + success: boolean; + /** The command requested */ + command: string; + /** Contains error message if success == false. */ + message?: string; + /** Contains message body if success == true. */ + body?: any; + } + + /** Arguments for FileRequest messages */ + export interface FileRequestArgs { + /** The file for the request (absolute pathname required) */ + file: string; + } + + /** + Request whose sole parameter is a file name + */ + export interface FileRequest extends Request { + arguments: FileRequestArgs; + } + + /** + Instances of this interface specify a code location: + (file, line, col), where line and column are 1-based. + */ + export interface CodeLocationRequestArgs extends FileRequestArgs { + /** The line number for the request (1-based) */ + line: number; + /** The column for the request (1-based) */ + col: number; + } + + /** + A request whose arguments specify a code location (file, line, col) + */ + export interface CodeLocationRequest extends FileRequest { + arguments: CodeLocationRequestArgs; + } + + /** + Go to definition request; value of command field is + "definition". Return response giving the code locations that + define the symbol found in file at location line, col. + */ + export interface DefinitionRequest extends CodeLocationRequest { + } + + /** + Object containing line and column (one-based) of code location + */ + export interface LineCol { + line: number; + col: number; + } + + /** + Object found in response messages defining a span of text in + source code. + */ + export interface CodeSpan { + /** File containing the definition */ + file: string; + /** First character of the definition */ + start: LineCol; + /** One character past last character of the definition */ + end: LineCol; + } + + /** + Definition response message. Gives text range for definition. + */ + export interface DefinitionResponse extends Response { + body?: CodeSpan[]; + } + + /** + Find references request; value of command field is + "references". Return response giving the code locations that + reference the symbol found in file at location line, col. + */ + export interface ReferencesRequest extends CodeLocationRequest { + } + + export interface ReferencesResponseItem extends CodeSpan { + /** Text of line containing the reference. Including this + with the response avoids latency of editor loading files + to show text of reference line (the server already has + loaded the referencing files). + */ + lineText: string; + } + + /** The body of a "references" response message. */ + export interface ReferencesResponseBody { + /** The code locations referencing the symbol */ + refs: ReferencesResponseItem[]; + /** The name of the symbol */ + symbolName: string; + /** + The start column of the symbol (on the line provided by the references request) + */ + symbolStartCol: number; + /** The full display name of the symbol */ + symbolDisplayString: string; + } + + /** Response to "references" request. */ + export interface ReferencesResponse extends Response { + body?: ReferencesResponseBody; + } + + /** + Rename request; value of command field is "rename". Return + response giving the code locations that reference the symbol + found in file at location line, col. Also return full display + name of the symbol so that client can print it unambiguously. + */ + export interface RenameRequest extends CodeLocationRequest { + } + + /** Information about the item to be renamed. */ + export interface RenameInfo { + /** True if item can be renamed */ + canRename: boolean; + /** Error message if item can not be renamed */ + localizedErrorMessage: string; + /** Display name of the item to be renamed */ + displayName: string; + /** Full display name of item to be renamed */ + fullDisplayName: string; + /** The items's kind (such as 'className' or 'parameterName' or plain 'text') */ + kind: string; + /** Optional modifiers for the kind (such as 'public') */ + kindModifiers: string; + } + + /** + Rename response message. + */ + export interface RenameResponse extends Response { + body?: { + /** Information about the item to be renamed */ + info: RenameInfo; + /** + An array of code locations that refer to the + item to be renamed. + */ + locs: CodeSpan[]; + } + } + + /** + Type request; value of command field is "type". Return response + giving the code locations that define the type of the symbol + found in file at location line, col. + */ + export interface TypeRequest extends CodeLocationRequest { + } + + export interface TypeResponse extends Response { + body?: CodeSpan[]; + } + + /** + Open request; value of command field is "open". Notify the + server that the client has file open. The server will not + monitor the filesystem for changes in this file and will assume + that the client is updating the server (using the change and/or + reload messages) when the file changes. Server does not currently + send a response to an open request. + */ + export interface OpenRequest extends FileRequest { + } + + /** + Close request; value of command field is "close". Notify the + server that the client has closed a previously open file. If + file is still referenced by open files, the server will resume + monitoring the filesystem for changes to file. Server does not + currently send a response to a close request. + */ + export interface CloseRequest extends FileRequest { + } + + /** + Quickinfo request; value of command field is + "quickinfo". Return response giving a quick type and + documentation string for the symbol found in file at location + line, col. + */ + export interface QuickInfoRequest extends CodeLocationRequest { + } + + /** Body of QuickInfoResponse */ + export interface QuickInfoResponseBody { + /** The symbol's kind (such as 'className' or 'parameterName' or plain 'text') */ + kind: string; + /** Optional modifiers for the kind (such as 'public') */ + kindModifiers: string; + /** Starting code location of symbol */ + start: LineCol; + /** One past last character of symbol */ + end: LineCol; + /** Type and kind of symbol */ + displayString: string; + /** Documentation associated with symbol */ + documentation: string; + } + + /** Quickinfo response message */ + export interface QuickInfoResponse extends Response { + body?: QuickInfoResponseBody; + } + + /** Arguments for format messages */ + export interface FormatRequestArgs extends CodeLocationRequestArgs { + /** Last line of range for which to format text in file */ + endLine: number; + /** Last column of range for which to format text in file */ + endCol: number; + } + + /** + Format request; value of command field is "format". Return + response giving zero or more edit instructions. The edit + instructions will be sorted in file order. Applying the edit + instructions in reverse to file will result in correctly + reformatted text. + */ + export interface FormatRequest extends CodeLocationRequest { + arguments: FormatRequestArgs; + } + + /** + Object found in response messages defining an editing + instruction for a span of text in source code. The effect of + this instruction is to replace the text starting at start and + ending one character before end with newText. For an insertion, + the text span is empty. For a deletion, newText is empty. + */ + export interface CodeEdit { + /** First character of the text span to edit. */ + start: LineCol; + /** One character past last character of the text span to edit */ + end: LineCol; + /** + Replace the span defined above with this string (may be + the empty string) + */ + newText: string; + } + + /** Format and format on key response message */ + export interface FormatResponse extends Response { + body?: CodeEdit[]; + } + + /** Arguments for format on key messages */ + export interface FormatOnKeyRequestArgs extends CodeLocationRequestArgs { + /** Key pressed (';', '\n', or '}') */ + key: string; + } + + /** + Format on key request; value of command field is + "formatonkey". Given file location and key typed (as string), + return response giving zero or more edit instructions. The + edit instructions will be sorted in file order. Applying the + edit instructions in reverse to file will result in correctly + reformatted text. + */ + export interface FormatOnKeyRequest extends CodeLocationRequest { + arguments: FormatOnKeyRequestArgs; + } + + /** Arguments for completions messages */ + export interface CompletionsRequestArgs extends CodeLocationRequestArgs { + /** Optional prefix to apply to possible completions. */ + prefix?: string; + } + + /** + Completions request; value of command field is "completions". + Given a file location (file, line, col) and a prefix (which may + be the empty string), return the possible completions that + begin with prefix. + */ + export interface CompletionsRequest extends CodeLocationRequest { + arguments: CompletionsRequestArgs; + } + + /** + Part of a symbol description. + */ + export interface SymbolDisplayPart { + /** Text of an item describing the symbol */ + text: string; + /** The symbol's kind (such as 'className' or 'parameterName' or plain 'text') */ + kind: string; + } + + /** An item found in a completion response */ + export interface CompletionItem { + /** The symbol's name */ + name: string; + /** The symbol's kind (such as 'className' or 'parameterName') */ + kind: string; + /** Optional modifiers for the kind (such as 'public') */ + kindModifiers?: string; + /** Display parts of the symbol (similar to quick info) */ + displayParts?: SymbolDisplayPart[]; + /** Documentation strings for the symbol */ + documentation?: SymbolDisplayPart[]; + } + + export interface CompletionsResponse extends Response { + body?: CompletionItem[]; + } + + /** Arguments for geterr messages. */ + export interface GeterrRequestArgs { + /** + List of file names for which to compute compiler errors. + The files will be checked in list order. + */ + files: string[]; + /** + Delay in milliseconds to wait before starting to compute + errors for the files in the file list + */ + delay: number; + } + + /** + Geterr request; value of command field is "geterr". Wait for + delay milliseconds and then, if during the wait no change or + reload messages have arrived for the first file in the files + list, get the syntactic errors for the file, field requests, + and then get the semantic errors for the file. Repeat with a + smaller delay for each subsequent file on the files list. Best + practice for an editor is to send a file list containing each + file that is currently visible, in most-recently-used order. + */ + export interface GeterrRequest extends Request { + arguments: GeterrRequestArgs; + } + + /** Item of diagnostic information found in a DiagEvent message */ + export interface Diagnostic { + /** Starting code location at which text appies */ + start: LineCol; + /** Length of code location at which text applies */ + len: number; + /** Text of diagnostic message */ + text: string; + } + + /** Event message for "syntaxDiag" and "semanticDiag" event types. + These events provide syntactic and semantic errors for a file. + */ + export interface DiagEvent extends Event { + body?: { + /** The file for which diagnostic information is reported */ + file: string; + /** An array of diagnostic information items */ + diagnostics: Diagnostic[]; + }; + } + + /** Arguments for reload request. */ + export interface ReloadRequestArgs extends FileRequestArgs { + /** + Name of temporary file from which to reload file + contents. May be same as file. + */ + tmpfile: string; + } + + /** + Reload request message; value of command field is "reload". + Reload contents of file with name given by the 'file' argument + from temporary file with name given by the 'tmpfile' argument. + The two names can be identical. + */ + export interface ReloadRequest extends FileRequest { + arguments: ReloadRequestArgs; + } + + /** + Response to "reload" request. This is just an acknowledgement, so + no body field is required. + */ + export interface ReloadResponse extends Response { + } + + /** Arguments for saveto request. */ + export interface SavetoRequestArgs extends FileRequestArgs { + /** + Name of temporary file into which to save server's view of + file contents. + */ + tmpfile: string; + } + + /** + Saveto request message; value of command field is "saveto". + For debugging purposes, save to a temporaryfile (named by + argument 'tmpfile') the contents of file named by argument + 'file'. The server does not currently send a response to a + "saveto" request. + */ + export interface SavetoRequest extends FileRequest { + arguments: SavetoRequestArgs; + } + + /** Arguments for navto request message */ + export interface NavtoRequestArgs extends FileRequestArgs { + /** + Search term to navigate to from current location; term can + be '.*' or an identifier prefix. + */ + searchTerm: string; + } + + /** + Navto request message; value of command field is "navto". + Return list of objects giving code locations and symbols that + match the search term given in argument 'searchTerm'. The + context for the search is given by the named file. + */ + export interface NavtoRequest extends FileRequest { + arguments: NavtoRequestArgs; + } + + /** An item found in a navto response. */ + export interface NavtoItem { + /** The symbol's name */ + name: string; + /** The symbol's kind (such as 'className' or 'parameterName') */ + kind: string; + /** exact, substring, or prefix */ + matchKind?: string; + /** Optional modifiers for the kind (such as 'public') */ + kindModifiers?: string; + /** + The file in which the symbol is found; the value of this + field will always be a string unless the client opts-in to + file encoding by sending the "abbrev" request. + */ + file: EncodedFile; + /** The location within file at which the symbol is found*/ + start: LineCol; + /** One past the last character of the symbol */ + end: LineCol; + /** + Name of symbol's container symbol (if any); for example, + the class name if symbol is a class member + */ + containerName?: string; + /** Kind of symbol's container symbol (if any) */ + containerKind?: string; + } + + /** + Navto response message. Body is an array of navto items. Each + item gives a symbol that matched the search term. + */ + export interface NavtoResponse extends Response { + body?: NavtoItem[]; + } + + /** Arguments for change request message. */ + export interface ChangeRequestArgs extends CodeLocationRequestArgs { + /** + Length of span deleted at location (file, line, col); nothing deleted + if this field is zero or undefined. + */ + deleteLen?: number; + /** Optional string to insert at location (file, line col). */ + insertString?: string; + } + + /** + Change request message; value of command field is "change". + Update the server's view of the file named by argument 'file'. + Server does not currently send a response to a change request. + */ + export interface ChangeRequest extends CodeLocationRequest { + arguments: ChangeRequestArgs; + } + + /* + The following messages describe an OPTIONAL compression scheme + that clients can choose to use. If a client does not opt-in to + this scheme by sending an "abbrev" request, the server will not + compress messages. + */ + + /** + Abbrev request message; value of command field is "abbrev". + Server returns an array of mappings from common message field + names and common message field string values to shortened + versions of these strings. Once a client opts-in by requesting + the abbreviations, the server may send responses whose field + names are shortened. The server may also send file names as + instances of AssignFileId, or as file ids, if the corresponding + id assignment had been previously returned. Currently, only + responses to the "navto" request can be encoded. + */ + export interface AbbrevRequest extends Request { + } + + /** + If an object of this type is returned in place of a string as + the value of a file field in a response message, add the + mapping id => file to the client's cache of file id mappings, + and interpret the value as if it was the string in the 'file' + field. + */ + export interface IdFile { + /** Id to assign to file */ + id: number; + /** File name that will correspond to id */ + file: string; + } + + /** + The type of an encoded file name. If of type number, the value + is a file id. If of type IdFile, the value is interpreted as + 'file' and in addition the mapping 'id' to 'file' is + established. If of type string, the value is simply the file + name. + */ + export type EncodedFile = number | IdFile | string; + + /** + Response to abbrev opt-in request message. This is a map of + string field names and common string field values to shortened + strings. Once the server sends this response, it will assume + that it can use the shortened field names and field values. In + addition, the server will assume it can assign ids to file + names by returning an AssignFileId instance in place of a file + name. Once an AssignFileId instance is returned, the server + may send the file id (a number) in place of the file name. + */ + export interface AbbrevResponse extends Response { + body?: { + /** Map from full string (either field name or string + field value) to shortened string */ + [fullString: string]: string; + } + } +} + + + + + + diff --git a/src/server/server.ts b/src/server/server.ts new file mode 100644 index 00000000000..ec0ee293ce3 --- /dev/null +++ b/src/server/server.ts @@ -0,0 +1,134 @@ +/// +/// + +module ts.server { + var nodeproto: typeof NodeJS._debugger = require('_debugger'); + var readline: NodeJS.ReadLine = require('readline'); + var path: NodeJS.Path = require('path'); + var fs: typeof NodeJS.fs = require('fs'); + + var rl = readline.createInterface({ + input: process.stdin, + output: process.stdout, + terminal: false, + }); + + class Logger implements ts.server.Logger { + fd = -1; + seq = 0; + inGroup = false; + firstInGroup = true; + + constructor(public logFilename: string) { + } + + static padStringRight(str: string, padding: string) { + return (str + padding).slice(0, padding.length); + } + + close() { + if (this.fd >= 0) { + fs.close(this.fd); + } + } + + perftrc(s: string) { + this.msg(s, "Perf"); + } + + info(s: string) { + this.msg(s, "Info"); + } + + startGroup() { + this.inGroup = true; + this.firstInGroup = true; + } + + endGroup() { + this.inGroup = false; + this.seq++; + this.firstInGroup = true; + } + + msg(s: string, type = "Err") { + if (this.fd < 0) { + this.fd = fs.openSync(this.logFilename, "w"); + } + if (this.fd >= 0) { + s = s + "\n"; + var prefix = Logger.padStringRight(type + " " + this.seq.toString(), " "); + if (this.firstInGroup) { + s = prefix + s; + this.firstInGroup = false; + } + if (!this.inGroup) { + this.seq++; + this.firstInGroup = true; + } + var buf = new Buffer(s); + fs.writeSync(this.fd, buf, 0, buf.length, null); + } + } + } + + class IOSession extends Session { + protocol: NodeJS._debugger.Protocol; + + constructor(host: ServerHost, logger: ts.server.Logger, useProtocol: boolean, prettyJSON: boolean) { + super(host, logger, useProtocol, prettyJSON); + if (useProtocol) { + this.initProtocol(); + } + } + + initProtocol() { + this.protocol = new nodeproto.Protocol(); + // note: onResponse was named by nodejs authors; we are re-purposing the Protocol + // class in this case so that it supports a server instead of a client + this.protocol.onResponse = (pkt) => { + this.handleRequest(pkt); + }; + } + + handleRequest(req: NodeJS._debugger.Packet) { + this.projectService.log("Got JSON msg:\n" + req.raw); + } + + listen() { + rl.on('line',(input: string) => { + var cmd = input.trim(); + if (cmd.indexOf("{") == 0) { + // assumption is JSON on single line + // plan is to also carry this protocol + // over tcp, in which case JSON would + // have a Content-Length header + this.executeJSONcmd(cmd); + } + else { + this.executeCmd(cmd); + } + }); + + rl.on('close',() => { + this.projectService.closeLog(); + this.projectService.log("Exiting..."); + process.exit(0); + }); + } + } + + // This places log file in the directory containing editorServices.js + // TODO: check that this location is writable + var logger = new Logger(__dirname + "/.log" + process.pid.toString()); + + var host: ServerHost = ts.sys; + + // Wire the debugging interface + if (!host.getDebuggerClient) { + host.getDebuggerClient = () => new nodeproto.Client(); + } + + // Start listening + new IOSession(host, logger, /* useProtocol */ true, /* prettyJSON */ false).listen(); +} \ No newline at end of file From 7b28f20affdc7e59e5990299c857e7a7aa33b471 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 11 Feb 2015 19:43:10 -0800 Subject: [PATCH 047/162] Wire the build for the server code --- Jakefile | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Jakefile b/Jakefile index b9406f1a433..acd81b0ccd5 100644 --- a/Jakefile +++ b/Jakefile @@ -8,6 +8,7 @@ var child_process = require("child_process"); // Variables var compilerDirectory = "src/compiler/"; var servicesDirectory = "src/services/"; +var serverDirectory = "src/server/"; var harnessDirectory = "src/harness/"; var libraryDirectory = "src/lib/"; var scriptsDirectory = "scripts/"; @@ -90,6 +91,15 @@ var servicesSources = [ return path.join(servicesDirectory, f); })); +var serverSources = [ + "node.d.ts", + "editorServices.ts", + "protocol.ts", + "server.ts" +].map(function (f) { + return path.join(serverDirectory, f); +}); + var definitionsRoots = [ "compiler/types.d.ts", "compiler/scanner.d.ts", @@ -130,6 +140,12 @@ var harnessSources = [ "services/preProcessFile.ts" ].map(function (f) { return path.join(unittestsDirectory, f); +})).concat([ + "protocol.ts", + "client.ts", + "editorServices.ts", +].map(function (f) { + return path.join(serverDirectory, f); })); var librarySourceMap = [ @@ -382,9 +398,12 @@ compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright jake.rmRf(tempDirPath, {silent: true}); }); +var serverFile = path.join(builtLocalDirectory, "typescriptServer.js"); +compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true); + // Local target to build the compiler and services desc("Builds the full compiler and services"); -task("local", ["generate-diagnostics", "lib", tscFile, servicesFile, nodeDefinitionsFile]); +task("local", ["generate-diagnostics", "lib", tscFile, servicesFile, nodeDefinitionsFile, serverFile]); // Local target to build only tsc.js desc("Builds only the compiler"); From abec4f97988f4bf02bda0c422566bedd3a2f4dea Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 11 Feb 2015 19:43:30 -0800 Subject: [PATCH 048/162] Wire tests to use the new server --- src/harness/fourslash.ts | 2 + src/harness/fourslashRunner.ts | 7 ++- src/harness/harness.ts | 7 +-- src/harness/harnessLanguageService.ts | 68 ++++++++++++++++++--------- src/harness/runner.ts | 4 ++ 5 files changed, 63 insertions(+), 25 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 603a78b5f75..9c61c3b1e27 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -282,6 +282,8 @@ module FourSlash { return new Harness.LanguageService.NativeLanugageServiceAdapter(cancellationToken, compilationOptions); case FourSlashTestType.Shims: return new Harness.LanguageService.ShimLanugageServiceAdapter(cancellationToken, compilationOptions); + case FourSlashTestType.Server: + return new Harness.LanguageService.ServerLanugageServiceAdapter(cancellationToken, compilationOptions); default: throw new Error("Unknown FourSlash test type: "); } diff --git a/src/harness/fourslashRunner.ts b/src/harness/fourslashRunner.ts index fe3b6c7a91f..1ab6e31cdbb 100644 --- a/src/harness/fourslashRunner.ts +++ b/src/harness/fourslashRunner.ts @@ -4,7 +4,8 @@ const enum FourSlashTestType { Native, - Shims + Shims, + Server } class FourSlashRunner extends RunnerBase { @@ -22,6 +23,10 @@ class FourSlashRunner extends RunnerBase { this.basePath = 'tests/cases/fourslash/shims'; this.testSuiteName = 'fourslash-shims'; break; + case FourSlashTestType.Server: + this.basePath = 'tests/cases/fourslash/server'; + this.testSuiteName = 'fourslash-server'; + break; } } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 534bf85d119..cbc4064119a 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -16,14 +16,15 @@ /// /// +/// +/// +/// /// /// /// /// -declare var require: any; -declare var process: any; -var Buffer = require('buffer').Buffer; +var Buffer: BufferConstructor = require('buffer').Buffer; // this will work in the browser via browserify var _chai: typeof chai = require('chai'); diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 2f95f5072d0..eb0daf74dcf 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -1,5 +1,6 @@ /// /// +/// /// module Harness.LanguageService { @@ -23,18 +24,18 @@ module Harness.LanguageService { this.version++; } - public editContent(minChar: number, limChar: number, newText: string): void { + public editContent(start: number, end: number, newText: string): void { // Apply edits - var prefix = this.content.substring(0, minChar); + var prefix = this.content.substring(0, start); var middle = newText; - var suffix = this.content.substring(limChar); + var suffix = this.content.substring(end); this.setContent(prefix + middle + suffix); // Store edit range + new length of script this.editRanges.push({ length: this.content.length, textChangeRange: ts.createTextChangeRange( - ts.createTextSpanFromBounds(minChar, limChar), newText.length) + ts.createTextSpanFromBounds(start, end), newText.length) }); // Update version # @@ -127,9 +128,7 @@ module Harness.LanguageService { protected settings = ts.getDefaultCompilerOptions()) { } - public getNewLine(): string { - return "\r\n"; - } + public getNewLine(): string { return "\r\n"; } public getFilenames(): string[] { var fileNames: string[] = []; @@ -145,20 +144,10 @@ module Harness.LanguageService { this.fileNameToScript[fileName] = new ScriptInfo(fileName, content); } - public updateScript(fileName: string, content: string) { + public editScript(fileName: string, start: number, end: number, newText: string) { var script = this.getScriptInfo(fileName); if (script !== null) { - script.updateContent(content); - return; - } - - this.addScript(fileName, content); - } - - public editScript(fileName: string, minChar: number, limChar: number, newText: string) { - var script = this.getScriptInfo(fileName); - if (script !== null) { - script.editContent(minChar, limChar, newText); + script.editContent(start, end, newText); return; } @@ -236,8 +225,7 @@ module Harness.LanguageService { getFilenames(): string[] { return this.nativeHost.getFilenames(); } getScriptInfo(fileName: string): ScriptInfo { return this.nativeHost.getScriptInfo(fileName); } addScript(fileName: string, content: string): void { this.nativeHost.addScript(fileName, content); } - updateScript(fileName: string, content: string): void { return this.nativeHost.updateScript(fileName, content); } - editScript(fileName: string, minChar: number, limChar: number, newText: string): void { this.nativeHost.editScript(fileName, minChar, limChar, newText); } + editScript(fileName: string, start: number, end: number, newText: string): void { this.nativeHost.editScript(fileName, start, end, newText); } lineColToPosition(fileName: string, line: number, col: number): number { return this.nativeHost.lineColToPosition(fileName, line, col); } positionToZeroBasedLineCol(fileName: string, position: number): ts.LineAndCharacter { return this.nativeHost.positionToZeroBasedLineCol(fileName, position); } @@ -442,5 +430,43 @@ module Harness.LanguageService { return convertResult; } } + + // Server adapter + class ServerLanguageServiceHost extends NativeLanguageServiceHost { + private client: ts.server.SessionClient; + constructor(cancellationToken: ts.CancellationToken, settings: ts.CompilerOptions) { + super(cancellationToken, settings); + } + + setClient(client: ts.server.SessionClient) { + this.client = client; + } + + addScript(fileName: string, content: string): void { + super.addScript(fileName, content); + this.client.openFile(fileName); + } + + editScript(fileName: string, start: number, end: number, newText: string) { + super.editScript(fileName, start, end, newText); + this.client.changeFile(fileName, start, end, newText); + } + } + + export class ServerLanugageServiceAdapter implements LanguageServiceAdapter { + private host: ServerLanguageServiceHost; + private client: ts.server.SessionClient; + constructor(cancellationToken?: ts.CancellationToken, options?: ts.CompilerOptions) { + debugger; + + this.host = new ServerLanguageServiceHost(cancellationToken, options); + this.client = new ts.server.SessionClient(this.host); + this.host.setClient(this.client); + } + getHost() { return this.host; } + getLanguageService(): ts.LanguageService { return this.client; } + getClassifier(): ts.Classifier { throw new Error("getClassifier is not available using the server interface."); } + getPreProcessedFileInfo(fileName: string, fileContents: string): ts.PreProcessedFileInfo { throw new Error("getPreProcessedFileInfo is not available using the server interface."); } + } } \ No newline at end of file diff --git a/src/harness/runner.ts b/src/harness/runner.ts index 942ae56bf6f..e1e5429b007 100644 --- a/src/harness/runner.ts +++ b/src/harness/runner.ts @@ -66,6 +66,9 @@ if (testConfigFile !== '') { case 'fourslash-shims': runners.push(new FourSlashRunner(FourSlashTestType.Shims)); break; + case 'fourslash-server': + runners.push(new FourSlashRunner(FourSlashTestType.Server)); + break; case 'fourslash-generated': runners.push(new GeneratedFourslashRunner(FourSlashTestType.Native)); break; @@ -95,6 +98,7 @@ if (runners.length === 0) { // language services runners.push(new FourSlashRunner(FourSlashTestType.Native)); runners.push(new FourSlashRunner(FourSlashTestType.Shims)); + runners.push(new FourSlashRunner(FourSlashTestType.Server)); //runners.push(new GeneratedFourslashRunner()); } From 54f3250cdd6eeed608dcdcec4ed9e9cd792f7140 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 11 Feb 2015 19:48:32 -0800 Subject: [PATCH 049/162] Add fomratting tests --- tests/cases/fourslash/server/format.ts | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 tests/cases/fourslash/server/format.ts diff --git a/tests/cases/fourslash/server/format.ts b/tests/cases/fourslash/server/format.ts new file mode 100644 index 00000000000..75d06eef0c2 --- /dev/null +++ b/tests/cases/fourslash/server/format.ts @@ -0,0 +1,8 @@ +/// + +/////**/module Default{var x= ( { } ) ;} + + +format.document(); +goTo.marker(); +verify.currentLineContentIs('module Default { var x = ({}); }'); \ No newline at end of file From 096364408959e57cb553de5bcaca56b6fa520f0e Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Wed, 11 Feb 2015 19:49:36 -0800 Subject: [PATCH 050/162] Add type annotations --- src/server/client.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/server/client.ts b/src/server/client.ts index 1fb93329e03..cf169c6e4cf 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -35,8 +35,8 @@ module ts.server { getCurrentDirectory: () => host.getCurrentDirectory(), readDirectory: (path: string, extension?: string) => [], - getModififedTime: (fileName) => new Date(), - stat: (path, callback) => { throw new Error("Not implemented Yet."); }, + getModififedTime: (fileName: string) => new Date(), + stat: (path: string, callback?: (err: any, stats: any) => any) => { throw new Error("Not implemented Yet."); }, }, { close: () => { }, info: (m) => this.host.log(m), From ee3ee05cc430e64b4834266423025bccb82eb084 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 12 Feb 2015 08:20:41 -0800 Subject: [PATCH 051/162] wire package.json command for the server --- bin/tsserver | 2 ++ package.json | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 bin/tsserver diff --git a/bin/tsserver b/bin/tsserver new file mode 100644 index 00000000000..2327c344c44 --- /dev/null +++ b/bin/tsserver @@ -0,0 +1,2 @@ +#!/usr/bin/env node +require('./typescriptServer.js') diff --git a/package.json b/package.json index 94b5435be19..9261174b68f 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,8 @@ "preferGlobal": true, "main": "./bin/typescript.js", "bin": { - "tsc": "./bin/tsc" + "tsc": "./bin/tsc", + "tsserver": "./bin/tsserver" }, "engines": { "node": ">=0.8.0" From 07d37fa7fb8d773160e78e1b5fe4268919217b61 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 12 Feb 2015 10:31:41 -0800 Subject: [PATCH 052/162] Simplify host logic in client --- src/server/client.ts | 149 ++++++++++++++++++++++++++++++------------- 1 file changed, 105 insertions(+), 44 deletions(-) diff --git a/src/server/client.ts b/src/server/client.ts index cf169c6e4cf..6456ab9aa08 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -2,59 +2,121 @@ module ts.server { - export interface SessionClientHost extends LanguageServiceHost { + export interface SessionClientHost extends LanguageServiceHost { lineColToPosition(fileName: string, line: number, col: number): number; positionToZeroBasedLineCol(fileName: string, position: number): ts.LineAndCharacter; } - export class SessionClient implements LanguageService { - private session: Session; - private sequence: number; - private lastReply: string; + class SessionClientHostProxy implements ServerHost, Logger { + args: string[] = []; + newLine: string; + useCaseSensitiveFileNames: boolean = false; + lastReply: string; constructor(private host: SessionClientHost) { - this.sequence = 0; - - this.session = new Session({ - args: [], - newLine: host.getNewLine(), - useCaseSensitiveFileNames: true, - write: (s) => this.lastReply = s, - readFile: (fileName): string => { - var snapshot = host.getScriptSnapshot(fileName); - return snapshot && snapshot.getText(0, snapshot.getLength()); - }, - writeFile: (name, text, writeByteOrderMark) => { - }, - resolvePath: (path) => path, - fileExists: (path) => !!host.getScriptSnapshot(path), - directoryExists: (path) => false, - getExecutingFilePath: () => "", - exit: (exitCode) => { }, - createDirectory: (directoryName: string) => { }, + this.newLine = this.host.getNewLine(); + } - getCurrentDirectory: () => host.getCurrentDirectory(), - readDirectory: (path: string, extension?: string) => [], - getModififedTime: (fileName: string) => new Date(), - stat: (path: string, callback?: (err: any, stats: any) => any) => { throw new Error("Not implemented Yet."); }, - }, { - close: () => { }, - info: (m) => this.host.log(m), - msg: (m) => this.host.log(m), - endGroup: () => { }, - perftrc: (m) => this.host.log(m), - startGroup: () => { } - }, /* useProtocol */ true, /*prettyJSON*/ true); + write(message: string): void { + this.lastReply = message; + } + + readFile(fileName: string): string { + var snapshot = this.host.getScriptSnapshot(fileName); + return snapshot && snapshot.getText(0, snapshot.getLength()); + } + + writeFile(name: string, text:string, writeByteOrderMark: boolean): void { + } + + resolvePath(path: string): string { + return path; + } + + fileExists(path: string): boolean { + return !!this.host.getScriptSnapshot(path); + } + + directoryExists(path: string): boolean { + return false; + } + + getExecutingFilePath(): string { + return ""; + } + + exit(exitCode: number): void { + } + + createDirectory(directoryName: string): void { + throw new Error("Not Implemented Yet."); + } + + getCurrentDirectory(): string { + return this.host.getCurrentDirectory(); + } + + readDirectory(path: string, extension?: string): string[] { + throw new Error("Not implemented Yet."); + } + + getModififedTime(fileName: string): Date { + return new Date(); + } + + stat(path: string, callback?: (err: any, stats: any) => any) { + throw new Error("Not implemented Yet."); + } + + lineColToPosition(fileName: string, line: number, col: number): number { + return this.host.lineColToPosition(fileName, line, col); + } + + positionToZeroBasedLineCol(fileName: string, position: number): ts.LineAndCharacter { + return this.host.positionToZeroBasedLineCol(fileName, position); + } + + getFileLength(fileName: string): number { + return this.host.getScriptSnapshot(fileName).getLength(); + } + + close(): void { + } + + info(message: string): void { + return this.host.log(message); + } + + msg(message: string) { + return this.host.log(message); + } + + endGroup(): void { + } + + perftrc(message: string): void { + return this.host.log(message); + } + + startGroup(): void { + } + } + + export class SessionClient implements LanguageService { + private session: Session; + private sequence: number = 0; + private host: SessionClientHostProxy; + + constructor(host: SessionClientHost) { + this.sequence = 0; + this.host = new SessionClientHostProxy(host); + this.session = new Session(this.host, this.host, /* useProtocol */ true, /*prettyJSON*/ true); } private lineColToPosition(fileName: string, lineCol: ServerProtocol.LineCol): number { return this.host.lineColToPosition(fileName, lineCol.line, lineCol.col); } - private getFileLength(fileName: string): number { - return this.host.getScriptSnapshot(fileName).getLength(); - } - private positionToOneBasedLineCol(fileName: string, position: number): ServerProtocol.LineCol { var lineCol = this.host.positionToZeroBasedLineCol(fileName, position); return { @@ -103,7 +165,7 @@ module ts.server { // Read the content length var contentLengthPrefix = "Content-Length: "; - var lines = this.lastReply.split("\r\n"); + var lines = this.host.lastReply.split("\r\n"); Debug.assert(lines.length >= 2, "Malformed response: Expected 3 lines in the response."); var contentLengthText = lines[0]; @@ -120,7 +182,7 @@ module ts.server { var response: T = JSON.parse(responseBody); } catch (e) { - throw new Error("Malformed response: Failed to parse server response: " + this.lastReply + ". \r\n Error detailes: " + e.message); + throw new Error("Malformed response: Failed to parse server response: " + this.host.lastReply + ". \r\n Error detailes: " + e.message); } // verify the sequence numbers @@ -239,7 +301,7 @@ module ts.server { } getFormattingEditsForDocument(fileName: string, options: ts.FormatCodeOptions): ts.TextChange[] { - return this.getFormattingEditsForRange(fileName, 0, this.getFileLength(fileName), options); + return this.getFormattingEditsForRange(fileName, 0, this.host.getFileLength(fileName), options); } getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): ts.TextChange[] { @@ -372,7 +434,6 @@ module ts.server { throw new Error("Not Implemented Yet."); } - getProgram(): Program { throw new Error("SourceFile objects are not serializable through the server protocol."); } From 6e94f39397350bb8215b07ad1afba1fa397b5b85 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 12 Feb 2015 10:34:57 -0800 Subject: [PATCH 053/162] Remove redundant type definitions --- src/server/protocol.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/server/protocol.ts b/src/server/protocol.ts index abbce0b3588..bd05cfbd533 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -9,11 +9,6 @@ module ts { displayString?: string; docString?: string; } - - export interface System { - getModififedTime? (fileName: string): Date; - stat? (path: string, callback?: (err: any, stats: any) => any): void; - } } module ts.server { From 4a44b7437a4c4c9f328b9396efb0703753dcc0af Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 12 Feb 2015 11:53:13 -0800 Subject: [PATCH 054/162] Supportt abbreviation --- src/harness/harnessLanguageService.ts | 2 +- src/server/client.ts | 87 ++++++++++++++++++++++++--- src/server/protocol.ts | 4 ++ 3 files changed, 84 insertions(+), 9 deletions(-) diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index eb0daf74dcf..2c0d2549c8e 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -460,7 +460,7 @@ module Harness.LanguageService { debugger; this.host = new ServerLanguageServiceHost(cancellationToken, options); - this.client = new ts.server.SessionClient(this.host); + this.client = new ts.server.SessionClient(this.host, /*abbreviate*/ true); this.host.setClient(this.client); } getHost() { return this.host; } diff --git a/src/server/client.ts b/src/server/client.ts index 6456ab9aa08..908562e589b 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -106,11 +106,53 @@ module ts.server { private session: Session; private sequence: number = 0; private host: SessionClientHostProxy; + private expantionTable: ts.Map; - constructor(host: SessionClientHost) { + constructor(host: SessionClientHost, abbreviate: boolean) { this.sequence = 0; this.host = new SessionClientHostProxy(host); - this.session = new Session(this.host, this.host, /* useProtocol */ true, /*prettyJSON*/ true); + this.session = new Session(this.host, this.host, /* useProtocol */ true, /*prettyJSON*/ false); + + // Setup the abbreviation table + if (abbreviate) { + this.setupExpantionTable() + } + } + + private setupExpantionTable(): void { + var request = this.processRequest("abbrev"); + var response = this.processResponse(request); + var abbriviationTable = response.body; + + Debug.assert(!!abbriviationTable, "Could not setup abbreviation. Abbreviation table was empty."); + + var expantionTable: ts.Map = {}; + for (var p in abbriviationTable) { + if (abbriviationTable.hasOwnProperty(p)) { + expantionTable[abbriviationTable[p]] = p; + } + } + this.expantionTable = expantionTable; + } + + private expand(obj: T): T { + for (var p in obj) { + if (obj.hasOwnProperty(p)) { + if (typeof (obj)[p] === "object") { + // Expand the property value + (obj)[p] = this.expand((obj)[p]); + } + + // Substitute the name if applicaple + var substitution = ts.lookUp(this.expantionTable, p); + if (substitution) { + (obj)[substitution] = (obj)[p]; + (obj)[p] = undefined; + } + } + } + + return obj; } private lineColToPosition(fileName: string, lineCol: ServerProtocol.LineCol): number { @@ -135,6 +177,23 @@ module ts.server { }; } + private getFileNameFromEncodedFile(fileId: ServerProtocol.EncodedFile, fileMapping: ts.Map): string { + var fileName: string; + if (typeof fileId === "object") { + fileName = (fileId).file; + fileMapping[(fileId).id] = fileName; + } + else if (typeof fileId === "number") { + fileName = ts.lookUp(fileMapping, fileId.toString()); + Debug.assert(!!fileName, "Did not find filename in previous fileID mappings."); + } + else { + Debug.fail("Got unexpedted fileId type."); + } + return fileName; + } + + private processRequest(command: "abbrev"): ServerProtocol.AbbrevRequest; private processRequest(command: "open", arguments: ServerProtocol.FileRequestArgs): ServerProtocol.OpenRequest; private processRequest(command: "close", arguments: ServerProtocol.FileRequestArgs): ServerProtocol.CloseRequest; private processRequest(command: "change", arguments: ServerProtocol.ChangeRequestArgs): ServerProtocol.ChangeRequest; @@ -146,7 +205,7 @@ module ts.server { private processRequest(command: "completions", arguments: ServerProtocol.CompletionsRequestArgs): ServerProtocol.CompletionsRequest; private processRequest(command: "navto", arguments: ServerProtocol.NavtoRequestArgs): ServerProtocol.NavtoRequest; private processRequest(command: "saveto", arguments: ServerProtocol.SavetoRequestArgs): ServerProtocol.SavetoRequest; - private processRequest(command: string, arguments: any): ServerProtocol.Request; + private processRequest(command: string, arguments?: any): ServerProtocol.Request; private processRequest(command: string, arguments: any): ServerProtocol.Request { var request: ServerProtocol.Request = { seq: this.sequence++, @@ -163,9 +222,13 @@ module ts.server { private processResponse(request: ServerProtocol.Request): T { debugger; + var lastMessage = this.host.lastReply; + this.host.lastReply = undefined; + Debug.assert(!!lastMessage, "Did not recieve any responses."); + // Read the content length var contentLengthPrefix = "Content-Length: "; - var lines = this.host.lastReply.split("\r\n"); + var lines = lastMessage.split("\r\n"); Debug.assert(lines.length >= 2, "Malformed response: Expected 3 lines in the response."); var contentLengthText = lines[0]; @@ -182,7 +245,7 @@ module ts.server { var response: T = JSON.parse(responseBody); } catch (e) { - throw new Error("Malformed response: Failed to parse server response: " + this.host.lastReply + ". \r\n Error detailes: " + e.message); + throw new Error("Malformed response: Failed to parse server response: " + lastMessage + ". \r\n Error detailes: " + e.message); } // verify the sequence numbers @@ -195,9 +258,13 @@ module ts.server { Debug.assert(!!response.body, "Malformed response: Unexpected empty response body."); + if (this.expantionTable) { + // Expand the response if abbreviated + return this.expand(response); + } return response; } - + openFile(fileName: string): void { this.processRequest("open", { file: fileName @@ -265,11 +332,15 @@ module ts.server { getNavigateToItems(seatchTerm: string): NavigateToItem[] { var request = this.processRequest("navto", { seatchTerm }); - + var response = this.processResponse(request); + var fileMapping: ts.Map = {}; + return response.body.map(entry => { + var fileName = this.getFileNameFromEncodedFile(entry.file, fileMapping); var start = this.lineColToPosition(entry.file.toString(), entry.start); var end = this.lineColToPosition(entry.file.toString(), entry.end); + return { name: entry.name, containerName: entry.containerName, @@ -277,7 +348,7 @@ module ts.server { kind: entry.kind, kindModifiers: entry.kindModifiers, matchKind: entry.matchKind, - fileName: entry.file.toString(), + fileName: fileName, textSpan: ts.createTextSpanFromBounds(start, end) }; }); diff --git a/src/server/protocol.ts b/src/server/protocol.ts index bd05cfbd533..7c27eec02dd 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -1136,6 +1136,10 @@ module ts.server { this.navto(navtoArgs.searchTerm, navtoArgs.file, cmd, req.seq); break; } + case CommandNames.Abbrev: { + this.sendAbbrev(); + break; + } default: { this.projectService.log("Unrecognized JSON command: " + cmd); break; From c987ab93f0fb0c46daa183bc2eadb841683aedbb Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 12 Feb 2015 12:52:26 -0800 Subject: [PATCH 055/162] Wire navto tests --- src/server/client.ts | 29 +++++++++++++++++---------- src/server/protocol.ts | 3 +++ tests/cases/fourslash/server/navto.ts | 28 ++++++++++++++++++++++++++ 3 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 tests/cases/fourslash/server/navto.ts diff --git a/src/server/client.ts b/src/server/client.ts index 908562e589b..f637a9f1269 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -80,6 +80,10 @@ module ts.server { return this.host.getScriptSnapshot(fileName).getLength(); } + getFileNames(): string[] { + return this.host.getScriptFileNames(); + } + close(): void { } @@ -107,6 +111,7 @@ module ts.server { private sequence: number = 0; private host: SessionClientHostProxy; private expantionTable: ts.Map; + private fileMapping: ts.Map = {}; constructor(host: SessionClientHost, abbreviate: boolean) { this.sequence = 0; @@ -177,14 +182,14 @@ module ts.server { }; } - private getFileNameFromEncodedFile(fileId: ServerProtocol.EncodedFile, fileMapping: ts.Map): string { + private getFileNameFromEncodedFile(fileId: ServerProtocol.EncodedFile): string { var fileName: string; if (typeof fileId === "object") { fileName = (fileId).file; - fileMapping[(fileId).id] = fileName; + this.fileMapping[(fileId).id] = fileName; } else if (typeof fileId === "number") { - fileName = ts.lookUp(fileMapping, fileId.toString()); + fileName = ts.lookUp(this.fileMapping, fileId.toString()); Debug.assert(!!fileName, "Did not find filename in previous fileID mappings."); } else { @@ -330,21 +335,23 @@ module ts.server { }; } - getNavigateToItems(seatchTerm: string): NavigateToItem[] { - var request = this.processRequest("navto", { seatchTerm }); + getNavigateToItems(searchTerm: string): NavigateToItem[] { + var request = this.processRequest("navto", { + searchTerm, + file: this.host.getFileNames()[0] + }); var response = this.processResponse(request); - var fileMapping: ts.Map = {}; return response.body.map(entry => { - var fileName = this.getFileNameFromEncodedFile(entry.file, fileMapping); - var start = this.lineColToPosition(entry.file.toString(), entry.start); - var end = this.lineColToPosition(entry.file.toString(), entry.end); + var fileName = this.getFileNameFromEncodedFile(entry.file); + var start = this.lineColToPosition(fileName, entry.start); + var end = this.lineColToPosition(fileName, entry.end); return { name: entry.name, - containerName: entry.containerName, - containerKind: entry.containerKind, + containerName: entry.containerName || "", + containerKind: entry.containerKind || "", kind: entry.kind, kindModifiers: entry.kindModifiers, matchKind: entry.matchKind, diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 7c27eec02dd..b4ffddd25ed 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -1051,6 +1051,9 @@ module ts.server { this.output(undefined, CommandNames.Navto, reqSeq, "no nav items"); } } + else { + this.output(undefined, CommandNames.Navto, reqSeq, "no nav items"); + } } executeJSONcmd(cmd: string) { diff --git a/tests/cases/fourslash/server/navto.ts b/tests/cases/fourslash/server/navto.ts new file mode 100644 index 00000000000..8dc42a2365e --- /dev/null +++ b/tests/cases/fourslash/server/navto.ts @@ -0,0 +1,28 @@ +/// + +/////// Module +////{| "itemName": "Shapes", "kind": "module", "parentName": "", "matchKind": "substring" |}module Shapes { +//// +//// // Class +//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes", "matchKind": "substring" |}export class Point { +//// // Instance member +//// {| "itemName": "originPointAttheHorizon", "kind": "property", "parentName": "Point", "matchKind": "substring"|}private originPointAttheHorizon = 0.0; +//// +//// // Getter +//// {| "itemName": "distanceFromOrigin", "kind": "getter", "parentName": "Point", "matchKind": "substring" |}get distanceFromOrigin(): number { return 0; } +//// +//// } +////} +//// +////// Local variables +////{| "itemName": "myPointThatIJustInitiated", "kind": "var", "parentName": "", "matchKind": "substring"|}var myPointThatIJustInitiated = new Shapes.Point(); + +//// Testing for substring matching of navigationItems +//var searchValue = "FromOrigin horizon INITIATED Shape Point"; + +test.markers().forEach((marker) => { + if (marker.data) { + var name = marker.data.itemName; + verify.navigationItemsListContains(name, marker.data.kind, name.substr(1), marker.data.matchKind, marker.fileName, marker.data.parentName); + } +}); \ No newline at end of file From 3e86e557d5d5f7db630bdae52de6adfa6dd2dcbd Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 12 Feb 2015 13:10:55 -0800 Subject: [PATCH 056/162] Use commmandNames module --- src/server/client.ts | 81 +++++++++++++++++++++----------------------- 1 file changed, 38 insertions(+), 43 deletions(-) diff --git a/src/server/client.ts b/src/server/client.ts index f637a9f1269..60fbd31243e 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -125,7 +125,7 @@ module ts.server { } private setupExpantionTable(): void { - var request = this.processRequest("abbrev"); + var request = this.processRequest(CommandNames.Abbrev); var response = this.processResponse(request); var abbriviationTable = response.body; @@ -198,20 +198,7 @@ module ts.server { return fileName; } - private processRequest(command: "abbrev"): ServerProtocol.AbbrevRequest; - private processRequest(command: "open", arguments: ServerProtocol.FileRequestArgs): ServerProtocol.OpenRequest; - private processRequest(command: "close", arguments: ServerProtocol.FileRequestArgs): ServerProtocol.CloseRequest; - private processRequest(command: "change", arguments: ServerProtocol.ChangeRequestArgs): ServerProtocol.ChangeRequest; - private processRequest(command: "quickinfo", arguments: ServerProtocol.FileRequestArgs): ServerProtocol.QuickInfoRequest; - private processRequest(command: "format", arguments: ServerProtocol.FormatRequestArgs): ServerProtocol.FormatRequest; - private processRequest(command: "formatonkey", arguments: ServerProtocol.FormatOnKeyRequestArgs): ServerProtocol.FormatRequest; - private processRequest(command: "definition", arguments: ServerProtocol.FileRequestArgs): ServerProtocol.DefinitionRequest; - private processRequest(command: "references", arguments: ServerProtocol.FileRequestArgs): ServerProtocol.ReferencesRequest; - private processRequest(command: "completions", arguments: ServerProtocol.CompletionsRequestArgs): ServerProtocol.CompletionsRequest; - private processRequest(command: "navto", arguments: ServerProtocol.NavtoRequestArgs): ServerProtocol.NavtoRequest; - private processRequest(command: "saveto", arguments: ServerProtocol.SavetoRequestArgs): ServerProtocol.SavetoRequest; - private processRequest(command: string, arguments?: any): ServerProtocol.Request; - private processRequest(command: string, arguments: any): ServerProtocol.Request { + private processRequest(command: string, arguments?: any): T { var request: ServerProtocol.Request = { seq: this.sequence++, type: "request", @@ -221,7 +208,7 @@ module ts.server { this.session.executeJSONcmd(JSON.stringify(request)); - return request; + return request; } private processResponse(request: ServerProtocol.Request): T { @@ -271,37 +258,37 @@ module ts.server { } openFile(fileName: string): void { - this.processRequest("open", { - file: fileName - }); + var args: ServerProtocol.FileRequestArgs = { file: fileName }; + this.processRequest(CommandNames.Open, args); } closeFile(fileName: string): void { - this.processRequest("close", { - file: fileName - }); + var args: ServerProtocol.FileRequestArgs = { file: fileName }; + this.processRequest(CommandNames.Close, args); } changeFile(fileName: string, start: number, end: number, newText: string): void { var lineCol = this.positionToOneBasedLineCol(fileName, start); - - this.processRequest("change", { + var args: ServerProtocol.ChangeRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, insertLen: end - start, deleteLen: end - start, insertString: newText - }); + }; + + this.processRequest(CommandNames.Change, args); } getQuickInfoAtPosition(fileName: string, position: number): QuickInfo { - var request = this.processRequest("quickinfo", { + var args: ServerProtocol.CodeLocationRequestArgs = { file: fileName, line: 0, col: 1 - }); + }; + var request = this.processRequest(CommandNames.Quickinfo, args); var response = this.processResponse(request); var start = this.lineColToPosition(fileName, response.body.start); @@ -320,12 +307,13 @@ module ts.server { getCompletionsAtPosition(fileName: string, position: number): CompletionInfo { var lineCol = this.positionToOneBasedLineCol(fileName, position); - var request = this.processRequest("completions", { + var args: ServerProtocol.CodeLocationRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, - }); + }; + var request = this.processRequest(CommandNames.Completions, args); var response = this.processResponse(request); return { @@ -336,11 +324,12 @@ module ts.server { } getNavigateToItems(searchTerm: string): NavigateToItem[] { - var request = this.processRequest("navto", { - searchTerm, + var args: ServerProtocol.NavtoRequestArgs = { + searchTerm, file: this.host.getFileNames()[0] - }); - + }; + + var request = this.processRequest(CommandNames.Navto, args); var response = this.processResponse(request); return response.body.map(entry => { @@ -364,15 +353,16 @@ module ts.server { getFormattingEditsForRange(fileName: string, start: number, end: number, options: ts.FormatCodeOptions): ts.TextChange[] { var startLineCol = this.positionToOneBasedLineCol(fileName, start); var endLineCol = this.positionToOneBasedLineCol(fileName, end); - // TODO: handle FormatCodeOptions - var request = this.processRequest("format", { + var args: ServerProtocol.FormatRequestArgs = { file: fileName, line: startLineCol.line, col: startLineCol.col, endLine: endLineCol.line, endCol: endLineCol.col, - }); + }; + // TODO: handle FormatCodeOptions + var request = this.processRequest(CommandNames.Format, args); var response = this.processResponse(request); return response.body.map(entry=> this.convertCodeEditsToTextChange(fileName, entry)); @@ -384,27 +374,31 @@ module ts.server { getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): ts.TextChange[] { var lineCol = this.positionToOneBasedLineCol(fileName, position); - // TODO: handle FormatCodeOptions - var request = this.processRequest("formatonkey", { + var args: ServerProtocol.FormatOnKeyRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, key: key - }); + }; + // TODO: handle FormatCodeOptions + var request = this.processRequest(CommandNames.Formatonkey, args); var response = this.processResponse(request); + return response.body.map(entry=> this.convertCodeEditsToTextChange(fileName, entry)); } getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] { var lineCol = this.positionToOneBasedLineCol(fileName, position); - var request = this.processRequest("definition", { + var args: ServerProtocol.CodeLocationRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, - }); + }; + var request = this.processRequest(CommandNames.Definition, args); var response = this.processResponse(request); + return response.body.map(entry => { var start = this.lineColToPosition(fileName, entry.start); var end = this.lineColToPosition(fileName, entry.end); @@ -421,12 +415,13 @@ module ts.server { getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[] { var lineCol = this.positionToOneBasedLineCol(fileName, position); - var request = this.processRequest("references", { + var args: ServerProtocol.CodeLocationRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, - }); + }; + var request = this.processRequest(CommandNames.References, args); var response = this.processResponse(request); return response.body.refs.map(entry => { From c0b12540726bb5955c80a989fb3d47d82f65723f Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 12 Feb 2015 13:35:11 -0800 Subject: [PATCH 057/162] Support brace matching --- src/server/client.ts | 19 +++++++++++- src/server/protocol.ts | 40 ++++++++++++++++++++++++- src/server/protodef.d.ts | 28 +++++++++++++++-- tests/cases/fourslash/server/brace.ts | 43 +++++++++++++++++++++++++++ 4 files changed, 125 insertions(+), 5 deletions(-) create mode 100644 tests/cases/fourslash/server/brace.ts diff --git a/src/server/client.ts b/src/server/client.ts index 60fbd31243e..07b5d81d8c0 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -488,7 +488,24 @@ module ts.server { } getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[] { - throw new Error("Not Implemented Yet."); + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: ServerProtocol.CodeLocationRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + }; + + var request = this.processRequest(CommandNames.Brace, args); + var response = this.processResponse(request); + + return response.body.map(entry => { + var start = this.lineColToPosition(fileName, entry.start); + var end = this.lineColToPosition(fileName, entry.end); + return { + start: start, + length: end - start, + }; + }); } getIndentationAtPosition(fileName: string, position: number, options: EditorOptions): number { diff --git a/src/server/protocol.ts b/src/server/protocol.ts index b4ffddd25ed..6187d8e6140 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -333,7 +333,7 @@ module ts.server { return true; } - module CommandNames { + export module CommandNames { export var Abbrev = "abbrev"; export var Change = "change"; export var Close = "close"; @@ -350,6 +350,7 @@ module ts.server { export var Rename = "rename"; export var Saveto = "saveto"; export var Type = "type"; + export var Brace = "brace"; export var Unknown = "unknown"; } @@ -1056,6 +1057,38 @@ module ts.server { } } + getMatchingBrace(line: number, col: number, rawfile: string, reqSeq = 0) { + var file = ts.normalizePath(rawfile); + var project = this.projectService.getProjectForFile(file); + if (project) { + var compilerService = project.compilerService; + var pos = compilerService.host.lineColToPosition(file, line, col); + var spans: ts.TextSpan[]; + try { + spans = compilerService.languageService.getBraceMatchingAtPosition(file, pos); + } + catch (err) { + this.logError(err, CommandNames.Brace); + spans = undefined; + } + if (spans) { + var bakedSpans: ServerProtocol.TextSpan[] = spans.map(span => ({ + start: span && + compilerService.host.positionToLineCol(file, span.start), + end: span && + compilerService.host.positionToLineCol(file, span.start + span.length) + })); + this.output(bakedSpans, CommandNames.Brace, reqSeq); + } + else { + this.output(undefined, CommandNames.Brace, reqSeq, "no matching braces"); + } + } + else { + this.output(undefined, CommandNames.Brace, reqSeq, "no matching braces"); + } + } + executeJSONcmd(cmd: string) { try { var req = JSON.parse(cmd); @@ -1143,6 +1176,11 @@ module ts.server { this.sendAbbrev(); break; } + case CommandNames.Brace: { + var defArgs = req.arguments; + this.getMatchingBrace(defArgs.line, defArgs.col, defArgs.file, req.seq); + break; + } default: { this.projectService.log("Unrecognized JSON command: " + cmd); break; diff --git a/src/server/protodef.d.ts b/src/server/protodef.d.ts index 75a41cb81ce..73c39404154 100644 --- a/src/server/protodef.d.ts +++ b/src/server/protodef.d.ts @@ -89,15 +89,22 @@ declare module ServerProtocol { Object found in response messages defining a span of text in source code. */ - export interface CodeSpan { - /** File containing the definition */ - file: string; + export interface TextSpan { /** First character of the definition */ start: LineCol; /** One character past last character of the definition */ end: LineCol; } + /** + Object found in response messages defining a span of text in + a specific source file. + */ + export interface CodeSpan extends TextSpan { + /** File containing the definition */ + file: string; + } + /** Definition response message. Gives text range for definition. */ @@ -582,6 +589,21 @@ declare module ServerProtocol { [fullString: string]: string; } } + + + /** Response to "brace" request. */ + export interface BraceResponse extends Response { + body?: TextSpan[]; + } + + /** + Brace matching request; value of command field is "brace". + Return response giving the code locations of matching braces + found in file at location line, col. + */ + export interface BraceRequest extends CodeLocationRequest { + } + } diff --git a/tests/cases/fourslash/server/brace.ts b/tests/cases/fourslash/server/brace.ts new file mode 100644 index 00000000000..fc8a71197db --- /dev/null +++ b/tests/cases/fourslash/server/brace.ts @@ -0,0 +1,43 @@ +/// + +//////curly braces +////module Foo [|{ +//// class Bar [|{ +//// private f() [|{ +//// }|] +//// +//// private f2() [|{ +//// if (true) [|{ }|] [|{ }|]; +//// }|] +//// }|] +////}|] +//// +//////parenthesis +////class FooBar { +//// private f[|()|] { +//// return [|([|(1 + 1)|])|]; +//// } +//// +//// private f2[|()|] { +//// if [|(true)|] { } +//// } +////} +//// +//////square brackets +////class Baz { +//// private f() { +//// var a: any[|[]|] = [|[[|[1, 2]|], [|[3, 4]|], 5]|]; +//// } +////} +//// +////// angular brackets +////class TemplateTest [||] { +//// public foo(a, b) { +//// return [||] a; +//// } +////} + +test.ranges().forEach((range) => { + verify.matchingBracePositionInCurrentFile(range.start, range.end - 1); + verify.matchingBracePositionInCurrentFile(range.end - 1, range.start); +}); \ No newline at end of file From 93aa3f161dd7ff23240124d2b8d2f917cf5d6783 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 12 Feb 2015 13:35:24 -0800 Subject: [PATCH 058/162] Add test for format on key --- tests/cases/fourslash/server/formatonkey.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/cases/fourslash/server/formatonkey.ts diff --git a/tests/cases/fourslash/server/formatonkey.ts b/tests/cases/fourslash/server/formatonkey.ts new file mode 100644 index 00000000000..64cd74ca858 --- /dev/null +++ b/tests/cases/fourslash/server/formatonkey.ts @@ -0,0 +1,12 @@ +/// + +////switch (1) { +//// case 1: +//// { +//// /*1*/ +//// break; +////} + +goTo.marker("1"); +edit.insert("}"); +verify.currentLineContentIs(" }"); From 99373dbd89acf57f3c3a74f31421e82f092673c4 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Thu, 12 Feb 2015 16:31:08 -0800 Subject: [PATCH 059/162] Add test for goto def --- src/harness/fourslash.ts | 3 +++ src/harness/harnessLanguageService.ts | 7 +++++-- src/server/client.ts | 2 +- tests/cases/fourslash/definition.ts | 12 ++++++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 tests/cases/fourslash/definition.ts diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 9c61c3b1e27..bc7a8718a76 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -420,6 +420,9 @@ module FourSlash { this.activeFile = fileToOpen; var fileName = fileToOpen.fileName.replace(Harness.IO.directoryName(fileToOpen.fileName), '').substr(1); this.scenarioActions.push(''); + + // Let the host know that this file is now open + this.languageServiceAdapterHost.openFile(fileToOpen.fileName); } public verifyErrorExistsBetweenMarkers(startMarkerName: string, endMarkerName: string, negative: boolean) { diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 2c0d2549c8e..39f59948cbc 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -154,6 +154,9 @@ module Harness.LanguageService { throw new Error("No script with name '" + fileName + "'"); } + public openFile(fileName: string): void { + } + /** * @param line 1 based index * @param col 1 based index @@ -442,8 +445,8 @@ module Harness.LanguageService { this.client = client; } - addScript(fileName: string, content: string): void { - super.addScript(fileName, content); + openFile(fileName: string): void { + super.openFile(fileName); this.client.openFile(fileName); } diff --git a/src/server/client.ts b/src/server/client.ts index 07b5d81d8c0..a93177adb3e 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -65,7 +65,7 @@ module ts.server { } stat(path: string, callback?: (err: any, stats: any) => any) { - throw new Error("Not implemented Yet."); + return 0; } lineColToPosition(fileName: string, line: number, col: number): number { diff --git a/tests/cases/fourslash/definition.ts b/tests/cases/fourslash/definition.ts new file mode 100644 index 00000000000..531e4562843 --- /dev/null +++ b/tests/cases/fourslash/definition.ts @@ -0,0 +1,12 @@ +/// + +// @Filename: b.ts +////import n = require('a/*1*/'); +////var x = new n.Foo(); + +// @Filename: a.ts +//// /*2*/export class Foo {} + +goTo.marker('1'); +goTo.definition(); +verify.caretAtMarker('2'); \ No newline at end of file From 4942c5f615cb675b3ced89c2c29c4f5eeff4b819 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 12 Feb 2015 16:18:01 -0800 Subject: [PATCH 060/162] Address feedback --- src/compiler/checker.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 51cf38e5f41..6ba98ba2146 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -2503,7 +2503,7 @@ module ts { } // For a type parameter, return the base constraint of the type parameter. For the string, number, - // boolean, and symbol primitive types, return the corresponding object types.Otherwise return the + // boolean, and symbol primitive types, return the corresponding object types. Otherwise return the // type itself. Note that the apparent type of a union type is the union type itself. function getApparentType(type: Type): Type { if (type.flags & TypeFlags.TypeParameter) { @@ -5538,7 +5538,7 @@ module ts { if (!links.resolvedType) { links.resolvedType = checkExpression(node.expression); - // This will allow types number, string, Symbol or any. It will also allow enums, the unknown + // This will allow types number, string, symbol or any. It will also allow enums, the unknown // type, and any union of these types (like string | number). if (!isTypeOfKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.ESSymbol)) { error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); From a51ce92500acc2949f1ea9e69e79965a7f209612 Mon Sep 17 00:00:00 2001 From: Jason Ramsay Date: Fri, 13 Feb 2015 11:56:39 -0800 Subject: [PATCH 061/162] switch to using host.getDefaultLibFileName(options) --- src/services/services.ts | 22 +++++++--------------- src/services/shims.ts | 5 +---- 2 files changed, 8 insertions(+), 19 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index ad6643faf3c..6f6d4b869a1 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -5517,11 +5517,13 @@ module ts { var declarations = symbol.getDeclarations(); if (declarations && declarations.length > 0) { // Disallow rename for elements that are defined in the standard TypeScript library. - var defaultLibFile = getDefaultLibFileName(host.getCompilationSettings()); - for (var i = 0; i < declarations.length; i++) { - var sourceFile = declarations[i].getSourceFile(); - if (sourceFile && isDefaultLibFile(sourceFile.fileName, defaultLibFile)) { - return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); + var defaultLibFileName = host.getDefaultLibFileName(host.getCompilationSettings()); + if (defaultLibFileName) { + for (var i = 0; i < declarations.length; i++) { + var sourceFile = declarations[i].getSourceFile(); + if (sourceFile && ts.normalizePath(sourceFile.fileName) === ts.normalizePath(defaultLibFileName)) { + return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); + } } } @@ -5543,16 +5545,6 @@ module ts { return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_this_element.key)); - function isDefaultLibFile(fileName: string, defaultLibFile: string): boolean { - var hasValidPrefix = true; - var index = fileName.lastIndexOf(defaultLibFile); - if (index - 1 >= 0) { - var prefix = fileName[index - 1]; - hasValidPrefix = (prefix === "\\" || prefix === "/"); - } - return index >= 0 && hasValidPrefix && (index + defaultLibFile.length === fileName.length); - } - function getRenameInfoError(localizedErrorMessage: string): RenameInfo { return { canRename: false, diff --git a/src/services/shims.ts b/src/services/shims.ts index 0f9f1a12cd1..776fecf374e 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -274,10 +274,7 @@ module ts { } public getDefaultLibFileName(options: CompilerOptions): string { - // Shim the API changes for 1.5 release. This should be removed once - // TypeScript 1.5 has shipped. - return ""; - //return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); + return this.shimHost.getDefaultLibFileName(JSON.stringify(options)); } } From a0b557e1e2d3c56f8c2ece643b7d77b2410a699e Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sat, 14 Feb 2015 15:12:06 -0800 Subject: [PATCH 062/162] Recover from git corruption --- src/harness/harnessLanguageService.ts | 149 +++- src/server/client.ts | 294 ++---- src/server/editorServices.ts | 3 +- src/server/protocol.ts | 1190 +++++++------------------ src/server/protodef.d.ts | 56 +- src/server/server.ts | 76 +- 6 files changed, 601 insertions(+), 1167 deletions(-) diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 39f59948cbc..2e50ca59b97 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -128,7 +128,9 @@ module Harness.LanguageService { protected settings = ts.getDefaultCompilerOptions()) { } - public getNewLine(): string { return "\r\n"; } + public getNewLine(): string { + return "\r\n"; + } public getFilenames(): string[] { var fileNames: string[] = []; @@ -435,17 +437,26 @@ module Harness.LanguageService { } // Server adapter - class ServerLanguageServiceHost extends NativeLanguageServiceHost { + class SessionClientHost extends NativeLanguageServiceHost implements ts.server.SessionClientHost { private client: ts.server.SessionClient; + constructor(cancellationToken: ts.CancellationToken, settings: ts.CompilerOptions) { super(cancellationToken, settings); } - setClient(client: ts.server.SessionClient) { + onMessage(message: string): void { + + } + + writeMessage(message: string): void { + + } + + setClient(client: ts.server.SessionClient) { this.client = client; } - openFile(fileName: string): void { + openFile(fileName: string): void { super.openFile(fileName); this.client.openFile(fileName); } @@ -456,15 +467,135 @@ module Harness.LanguageService { } } + class SessionServerHost implements ts.server.ServerHost, ts.server.Logger { + args: string[] = []; + newLine: string; + useCaseSensitiveFileNames: boolean = false; + + constructor(private host: NativeLanguageServiceHost) { + this.newLine = this.host.getNewLine(); + } + + onMessage(message: string): void { + + } + + writeMessage(message: string): void { + } + + write(message: string): void { + this.writeMessage(message); + } + + readFile(fileName: string): string { + var snapshot = this.host.getScriptSnapshot(fileName); + return snapshot && snapshot.getText(0, snapshot.getLength()); + } + + writeFile(name: string, text: string, writeByteOrderMark: boolean): void { + } + + resolvePath(path: string): string { + return path; + } + + fileExists(path: string): boolean { + return !!this.host.getScriptSnapshot(path); + } + + directoryExists(path: string): boolean { + return false; + } + + getExecutingFilePath(): string { + return ""; + } + + exit(exitCode: number): void { + } + + createDirectory(directoryName: string): void { + throw new Error("Not Implemented Yet."); + } + + getCurrentDirectory(): string { + return this.host.getCurrentDirectory(); + } + + readDirectory(path: string, extension?: string): string[] { + throw new Error("Not implemented Yet."); + } + + getModififedTime(fileName: string): Date { + return new Date(); + } + + stat(path: string, callback?: (err: any, stats: any) => any) { + return 0; + } + + lineColToPosition(fileName: string, line: number, col: number): number { + return this.host.lineColToPosition(fileName, line, col); + } + + positionToZeroBasedLineCol(fileName: string, position: number): ts.LineAndCharacter { + return this.host.positionToZeroBasedLineCol(fileName, position); + } + + getFileLength(fileName: string): number { + return this.host.getScriptSnapshot(fileName).getLength(); + } + + getFileNames(): string[] { + return this.host.getScriptFileNames(); + } + + close(): void { + } + + info(message: string): void { + return this.host.log(message); + } + + msg(message: string) { + return this.host.log(message); + } + + endGroup(): void { + } + + perftrc(message: string): void { + return this.host.log(message); + } + + startGroup(): void { + } + } + export class ServerLanugageServiceAdapter implements LanguageServiceAdapter { - private host: ServerLanguageServiceHost; + private host: SessionClientHost; private client: ts.server.SessionClient; constructor(cancellationToken?: ts.CancellationToken, options?: ts.CompilerOptions) { - debugger; + // This is the main host that tests use to direct tests + var clientHost = new SessionClientHost(cancellationToken, options); + var client = new ts.server.SessionClient(clientHost); - this.host = new ServerLanguageServiceHost(cancellationToken, options); - this.client = new ts.server.SessionClient(this.host, /*abbreviate*/ true); - this.host.setClient(this.client); + // This host is just a proxy for the clientHost, it uses the client + // host to answer server queries about files on disk + var serverHost = new SessionServerHost(clientHost); + var server = new ts.server.Session(serverHost, serverHost, /*useProtocol*/ true, /*prettyJSON*/ false); + + // Fake the connection between the client and the server + serverHost.writeMessage = client.onMessage.bind(client); + clientHost.writeMessage = server.onMessage.bind(server); + + // Wire the client to the host to get notifications when a file is open + // or edited. + clientHost.setClient(client); + + // Set the properties + this.client = client; + this.host = clientHost; } getHost() { return this.host; } getLanguageService(): ts.LanguageService { return this.client; } diff --git a/src/server/client.ts b/src/server/client.ts index a93177adb3e..1aa7547f541 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -1,177 +1,49 @@ -/// - -module ts.server { - - export interface SessionClientHost extends LanguageServiceHost { - lineColToPosition(fileName: string, line: number, col: number): number; - positionToZeroBasedLineCol(fileName: string, position: number): ts.LineAndCharacter; - } - - class SessionClientHostProxy implements ServerHost, Logger { - args: string[] = []; - newLine: string; - useCaseSensitiveFileNames: boolean = false; - lastReply: string; - - constructor(private host: SessionClientHost) { - this.newLine = this.host.getNewLine(); - } +/// - write(message: string): void { - this.lastReply = message; - } +module ts.server { - readFile(fileName: string): string { - var snapshot = this.host.getScriptSnapshot(fileName); - return snapshot && snapshot.getText(0, snapshot.getLength()); - } - - writeFile(name: string, text:string, writeByteOrderMark: boolean): void { - } - - resolvePath(path: string): string { - return path; - } - - fileExists(path: string): boolean { - return !!this.host.getScriptSnapshot(path); - } - - directoryExists(path: string): boolean { - return false; - } - - getExecutingFilePath(): string { - return ""; - } - - exit(exitCode: number): void { - } - - createDirectory(directoryName: string): void { - throw new Error("Not Implemented Yet."); - } - - getCurrentDirectory(): string { - return this.host.getCurrentDirectory(); - } - - readDirectory(path: string, extension?: string): string[] { - throw new Error("Not implemented Yet."); - } - - getModififedTime(fileName: string): Date { - return new Date(); - } - - stat(path: string, callback?: (err: any, stats: any) => any) { - return 0; - } - - lineColToPosition(fileName: string, line: number, col: number): number { - return this.host.lineColToPosition(fileName, line, col); - } - - positionToZeroBasedLineCol(fileName: string, position: number): ts.LineAndCharacter { - return this.host.positionToZeroBasedLineCol(fileName, position); - } - - getFileLength(fileName: string): number { - return this.host.getScriptSnapshot(fileName).getLength(); - } - - getFileNames(): string[] { - return this.host.getScriptFileNames(); - } - - close(): void { - } - - info(message: string): void { - return this.host.log(message); - } - - msg(message: string) { - return this.host.log(message); - } - - endGroup(): void { - } - - perftrc(message: string): void { - return this.host.log(message); - } - - startGroup(): void { - } + export interface SessionClientHost extends LanguageServiceHost { + writeMessage(message: string): void; } - - export class SessionClient implements LanguageService { - private session: Session; - private sequence: number = 0; - private host: SessionClientHostProxy; - private expantionTable: ts.Map; - private fileMapping: ts.Map = {}; - - constructor(host: SessionClientHost, abbreviate: boolean) { - this.sequence = 0; - this.host = new SessionClientHostProxy(host); - this.session = new Session(this.host, this.host, /* useProtocol */ true, /*prettyJSON*/ false); - - // Setup the abbreviation table - if (abbreviate) { - this.setupExpantionTable() - } - } - - private setupExpantionTable(): void { - var request = this.processRequest(CommandNames.Abbrev); - var response = this.processResponse(request); - var abbriviationTable = response.body; - Debug.assert(!!abbriviationTable, "Could not setup abbreviation. Abbreviation table was empty."); - - var expantionTable: ts.Map = {}; - for (var p in abbriviationTable) { - if (abbriviationTable.hasOwnProperty(p)) { - expantionTable[abbriviationTable[p]] = p; - } - } - this.expantionTable = expantionTable; - } - - private expand(obj: T): T { - for (var p in obj) { - if (obj.hasOwnProperty(p)) { - if (typeof (obj)[p] === "object") { - // Expand the property value - (obj)[p] = this.expand((obj)[p]); - } - - // Substitute the name if applicaple - var substitution = ts.lookUp(this.expantionTable, p); - if (substitution) { - (obj)[substitution] = (obj)[p]; - (obj)[p] = undefined; - } - } - } - - return obj; - } - - private lineColToPosition(fileName: string, lineCol: ServerProtocol.LineCol): number { - return this.host.lineColToPosition(fileName, lineCol.line, lineCol.col); + export class SessionClient implements LanguageService { + private sequence: number = 0; + private fileMapping: ts.Map = {}; + private lineMaps: ts.Map = {}; + private messages: string[] = []; + + constructor(private host: SessionClientHost) { } - private positionToOneBasedLineCol(fileName: string, position: number): ServerProtocol.LineCol { - var lineCol = this.host.positionToZeroBasedLineCol(fileName, position); + public onMessage(message: string): void { + this.messages.push(message); + } + + private writeMessage(message: string): void { + this.host.writeMessage(message); + } + + private getLineMap(fileName: string): number[] { + var lineMap = ts.lookUp(this.lineMaps, fileName); + if (!lineMap) { + var scriptSnapshot = this.host.getScriptSnapshot(fileName); + lineMap = this.lineMaps[fileName] = ts.computeLineStarts(scriptSnapshot.getText(0, scriptSnapshot.getLength())); + } + return lineMap; + } + + private lineColToPosition(fileName: string, lineCol: ServerProtocol.LineCol): number { + return ts.computePositionFromLineAndCharacter(this.getLineMap(fileName), lineCol.line, lineCol.col); + } + + private positionToOneBasedLineCol(fileName: string, position: number): ServerProtocol.LineCol { + var lineCol = ts.computeLineAndCharacterOfPosition(this.getLineMap(fileName), position); return { - line: lineCol.line + 1, - col: lineCol.character + 1 + line: lineCol.line, + col: lineCol.character }; - } - + } + private convertCodeEditsToTextChange(fileName: string, codeEdit: ServerProtocol.CodeEdit): ts.TextChange { var start = this.lineColToPosition(fileName, codeEdit.start); var end = this.lineColToPosition(fileName, codeEdit.end); @@ -180,8 +52,8 @@ module ts.server { span: ts.createTextSpanFromBounds(start, end), newText: codeEdit.newText }; - } - + } + private getFileNameFromEncodedFile(fileId: ServerProtocol.EncodedFile): string { var fileName: string; if (typeof fileId === "object") { @@ -196,9 +68,9 @@ module ts.server { Debug.fail("Got unexpedted fileId type."); } return fileName; - } - - private processRequest(command: string, arguments?: any): T { + } + + private processRequest(command: string, arguments?: any): T { var request: ServerProtocol.Request = { seq: this.sequence++, type: "request", @@ -206,34 +78,33 @@ module ts.server { arguments: arguments }; - this.session.executeJSONcmd(JSON.stringify(request)); - - return request; - } - - private processResponse(request: ServerProtocol.Request): T { - debugger; - - var lastMessage = this.host.lastReply; - this.host.lastReply = undefined; - Debug.assert(!!lastMessage, "Did not recieve any responses."); - - // Read the content length - var contentLengthPrefix = "Content-Length: "; - var lines = lastMessage.split("\r\n"); - Debug.assert(lines.length >= 2, "Malformed response: Expected 3 lines in the response."); - - var contentLengthText = lines[0]; - Debug.assert(contentLengthText.indexOf(contentLengthPrefix) === 0, "Malformed response: Response text did not contain content-length header."); - var contentLength = parseInt(contentLengthText.substring(contentLengthPrefix.length)); - - // Read the body - var responseBody = lines[2]; - - // Verify content length - Debug.assert(responseBody.length + 1 === contentLength, "Malformed response: Content length did not match the response's body length."); - - try { + this.writeMessage(JSON.stringify(request)); + + return request; + } + + private processResponse(request: ServerProtocol.Request): T { + debugger; + + var lastMessage = this.messages.shift(); + Debug.assert(!!lastMessage, "Did not recieve any responses."); + + // Read the content length + var contentLengthPrefix = "Content-Length: "; + var lines = lastMessage.split("\r\n"); + Debug.assert(lines.length >= 2, "Malformed response: Expected 3 lines in the response."); + + var contentLengthText = lines[0]; + Debug.assert(contentLengthText.indexOf(contentLengthPrefix) === 0, "Malformed response: Response text did not contain content-length header."); + var contentLength = parseInt(contentLengthText.substring(contentLengthPrefix.length)); + + // Read the body + var responseBody = lines[2]; + + // Verify content length + Debug.assert(responseBody.length + 1 === contentLength, "Malformed response: Content length did not match the response's body length."); + + try { var response: T = JSON.parse(responseBody); } catch (e) { @@ -250,13 +121,9 @@ module ts.server { Debug.assert(!!response.body, "Malformed response: Unexpected empty response body."); - if (this.expantionTable) { - // Expand the response if abbreviated - return this.expand(response); - } return response; - } - + } + openFile(fileName: string): void { var args: ServerProtocol.FileRequestArgs = { file: fileName }; this.processRequest(CommandNames.Open, args); @@ -268,6 +135,9 @@ module ts.server { } changeFile(fileName: string, start: number, end: number, newText: string): void { + // clear the line map after an edit + this.lineMaps[fileName] = undefined; + var lineCol = this.positionToOneBasedLineCol(fileName, start); var args: ServerProtocol.ChangeRequestArgs = { file: fileName, @@ -326,7 +196,7 @@ module ts.server { getNavigateToItems(searchTerm: string): NavigateToItem[] { var args: ServerProtocol.NavtoRequestArgs = { searchTerm, - file: this.host.getFileNames()[0] + file: this.host.getScriptFileNames()[0] }; var request = this.processRequest(CommandNames.Navto, args); @@ -357,7 +227,7 @@ module ts.server { file: fileName, line: startLineCol.line, col: startLineCol.col, - endLine: endLineCol.line, + endLine: endLineCol.line, endCol: endLineCol.col, }; @@ -369,7 +239,7 @@ module ts.server { } getFormattingEditsForDocument(fileName: string, options: ts.FormatCodeOptions): ts.TextChange[] { - return this.getFormattingEditsForRange(fileName, 0, this.host.getFileLength(fileName), options); + return this.getFormattingEditsForRange(fileName, 0, this.host.getScriptSnapshot(fileName).getLength(), options); } getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): ts.TextChange[] { @@ -537,7 +407,7 @@ module ts.server { } dispose(): void { - throw new Error("dispose is not available through the server layer."); - } - } -} + throw new Error("dispose is not available through the server layer."); + } + } +} diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 933435f93a1..7007704a168 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -425,7 +425,8 @@ module ts.server { if (projectOptions.compilerOptions) { this.compilerService.setCompilerOptions(projectOptions.compilerOptions); } - // TODO: format code options } + // TODO: format code options + } } export interface ProjectOpenResult { diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 6187d8e6140..16abbf029d7 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -33,39 +33,6 @@ module ts.server { return spaceCache[n]; } - function isTypeName(name: string, suffix?: string) { - for (var i = 0, len = typeNames.length; i < len; i++) { - if (typeNames[i] == name) { - return true; - } - else if (suffix && ((typeNames[i] + suffix) == name)) { - return true; - } - } - return false; - } - - function parseTypeName(displayParts: ts.SymbolDisplayPart[]) { - var len = displayParts.length; - for (var i = len - 1; i >= 0; i--) { - if (isTypeName(displayParts[i].kind, "Name")) { - return displayParts[i].text; - } - } - return undefined; - } - - function findExactMatchType(items: ts.NavigateToItem[]) { - for (var i = 0, len = items.length; i < len; i++) { - var navItem = items[i]; - if (navItem.matchKind == "exact") { - if (isTypeName(navItem.kind)) { - return navItem; - } - } - } - } - interface FileStart { file: string; start: ILineInfo; @@ -81,14 +48,6 @@ module ts.server { else return 1; } - function printObject(obj: any) { - for (var p in obj) { - if (obj.hasOwnProperty(p)) { - console.log(p + ": " + obj[p]); - } - } - } - function compareFileStart(a: FileStart, b: FileStart) { if (a.file < b.file) { return -1; @@ -128,178 +87,7 @@ module ts.server { } }) } - - //function SourceInfo(body: NodeJS._debugger.BreakResponse) { - // var result = body.exception ? 'exception in ' : 'break in '; - - // if (body.script) { - // if (body.script.name) { - // var name = body.script.name, - // dir = path.resolve() + '/'; - - // // Change path to relative, if possible - // if (name.indexOf(dir) === 0) { - // name = name.slice(dir.length); - // } - - // result += name; - // } else { - // result += '[unnamed]'; - // } - // } - // result += ':'; - // result += body.sourceLine + 1; - - // if (body.exception) result += '\n' + body.exception.text; - - // return result; - //} - - class JsDebugSession { - host = 'localhost'; - port = 5858; - - constructor(public client: NodeJS._debugger.Client) { - this.init(); - } - - cont(cb: NodeJS._debugger.RequestHandler) { - this.client.reqContinue(cb); - } - - listSrc() { - this.client.reqScripts((err: any) => { - if (err) { - console.log("rscr error: " + err); - } - else { - console.log("req scripts"); - for (var id in this.client.scripts) { - var script = this.client.scripts[id]; - if ((typeof script === "object") && script.name) { - console.log(id + ": " + script.name); - } - } - } - }); - } - - findScript(file: string) { - if (file) { - var script: NodeJS._debugger.ScriptDesc; - var scripts = this.client.scripts; - var keys: any[] = Object.keys(scripts); - var ambiguous = false; - for (var v = 0; v < keys.length; v++) { - var id = keys[v]; - if (scripts[id] && - scripts[id].name && - scripts[id].name.indexOf(file) !== -1) { - if (script) { - ambiguous = true; - } - script = scripts[id]; - } - } - return { script: script, ambiguous: ambiguous }; - } - } - - // TODO: condition - setBreakpointOnLine(line: number, file?: string) { - if (!file) { - file = this.client.currentScript; - } - var script: NodeJS._debugger.ScriptDesc; - var scriptResult = this.findScript(file); - if (scriptResult) { - if (scriptResult.ambiguous) { - // TODO: send back error - script = undefined; - } - else { - script = scriptResult.script; - } - } - // TODO: set breakpoint when script not loaded - if (script) { - var brkmsg: NodeJS._debugger.BreakpointMessageBody = { - type: 'scriptId', - target: script.id, - line: line - 1, - } - this.client.setBreakpoint(brkmsg,(err, bod) => { - // TODO: remember breakpoint - if (err) { - console.log("Error: set breakpoint: " + err); - } - }); - } - - } - - init() { - var connectionAttempts = 0; - this.client.on('break',(res: NodeJS._debugger.Event) => { - this.handleBreak(res.body); - }); - this.client.on('exception',(res: NodeJS._debugger.Event) => { - this.handleBreak(res.body); - }); - this.client.on('error',() => { - setTimeout(() => { - ++connectionAttempts; - this.client.connect(this.port, this.host); - }, 500); - }); - this.client.once('ready',() => { - }); - this.client.on('unhandledResponse',() => { - }); - this.client.connect(this.port, this.host); - } - - evaluate(code: string) { - var frame = this.client.currentFrame; - this.client.reqFrameEval(code, frame,(err, bod) => { - if (err) { - console.log("Error: evaluate: " + err); - return; - } - - console.log("Value: " + bod.toString()); - if (typeof bod === "object") { - printObject(bod); - } - - // Request object by handles (and it's sub-properties) - this.client.mirrorObject(bod, 3,(err, mirror) => { - if (mirror) { - if (typeof mirror === "object") { - printObject(mirror); - } - console.log(mirror.toString()); - } - else { - console.log("undefined"); - } - }); - - }); - } - - handleBreak(breakInfo: NodeJS._debugger.BreakResponse) { - this.client.currentSourceLine = breakInfo.sourceLine; - this.client.currentSourceLineText = breakInfo.sourceLineText; - this.client.currentSourceColumn = breakInfo.sourceColumn; - this.client.currentFrame = 0; - this.client.currentScript = breakInfo.script && breakInfo.script.name; - - //console.log(SourceInfo(breakInfo)); - // TODO: watchers - } - } - + interface FileRange { file?: string; start: ILineInfo; @@ -320,7 +108,7 @@ module ts.server { } interface PendingErrorCheck { - filename: string; + fileName: string; project: Project; } @@ -334,7 +122,6 @@ module ts.server { } export module CommandNames { - export var Abbrev = "abbrev"; export var Change = "change"; export var Close = "close"; export var Completions = "completions"; @@ -349,22 +136,22 @@ module ts.server { export var Reload = "reload"; export var Rename = "rename"; export var Saveto = "saveto"; - export var Type = "type"; export var Brace = "brace"; export var Unknown = "unknown"; } + module Errors { + export var NoProject = new Error("No Project."); + export var NoContent = new Error("No Content."); + } + export interface ServerHost extends ts.System { - getDebuggerClient? (): NodeJS._debugger.Client; } export class Session { projectService: ProjectService; - debugSession: JsDebugSession; pendingOperation = false; fileHash: ts.Map = {}; - abbrevTable: ts.Map; - fetchedAbbrev = false; nextFileId = 1; errorTimer: NodeJS.Timer; immediateId: any; @@ -372,7 +159,6 @@ module ts.server { constructor(private host: ServerHost, private logger: Logger, protected useProtocol: boolean, protected prettyJSON: boolean) { this.projectService = new ProjectService(host, logger); - this.initAbbrevTable(); } logError(err: Error, cmd: string) { @@ -387,8 +173,8 @@ module ts.server { this.projectService.log(msg); } - sendLineToClient(line: string) { - this.host.write(line + this.host.newLine); + sendLineToClient(line: string) { + this.host.write(line + this.host.newLine); } send(msg: NodeJS._debugger.Message) { @@ -430,51 +216,15 @@ module ts.server { this.send(res); } - initAbbrevTable() { - this.abbrevTable = { - name: "n", - kind: "k", - fileName: "f", - containerName: "cn", - containerKind: "ck", - kindModifiers: "km", - start: "s", - end: "e", - line: "l", - col: "c", - "interface": "i", - "function": "fn", - }; - } - - encodeFilename(filename: string): ServerProtocol.EncodedFile { - if (!this.fetchedAbbrev) { - return filename; + encodeFilename(fileName: string): ServerProtocol.EncodedFile { + var id = ts.lookUp(this.fileHash, fileName); + if (!id) { + id = this.nextFileId++; + this.fileHash[fileName] = id; + return { id: id, file: fileName }; } else { - var id = ts.lookUp(this.fileHash, filename); - if (!id) { - id = this.nextFileId++; - this.fileHash[filename] = id; - return { id: id, file: filename }; - } - else { - return id; - } - } - } - - abbreviate(obj: any) { - if (this.fetchedAbbrev && (!this.prettyJSON)) { - for (var p in obj) { - if (obj.hasOwnProperty(p)) { - var sub = ts.lookUp(this.abbrevTable, p); - if (sub) { - obj[sub] = obj[p]; - obj[p] = undefined; - } - } - } + return id; } } @@ -544,10 +294,10 @@ module ts.server { var checkOne = () => { if (matchSeq(seq)) { var checkSpec = checkList[index++]; - if (checkSpec.project.getSourceFileFromName(checkSpec.filename)) { - this.syntacticCheck(checkSpec.filename, checkSpec.project); + if (checkSpec.project.getSourceFileFromName(checkSpec.fileName)) { + this.syntacticCheck(checkSpec.fileName, checkSpec.project); this.immediateId = setImmediate(() => { - this.semanticCheck(checkSpec.filename, checkSpec.project); + this.semanticCheck(checkSpec.fileName, checkSpec.project); this.immediateId = undefined; if (checkList.length > index) { this.errorTimer = setTimeout(checkOne, followMs); @@ -564,181 +314,140 @@ module ts.server { } } - goToDefinition(line: number, col: number, rawfile: string, reqSeq = 0) { - var file = ts.normalizePath(rawfile); + goToDefinition(line: number, col: number, fileName: string): ServerProtocol.CodeSpan[] { + var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); - if (project) { - var compilerService = project.compilerService; - var pos = compilerService.host.lineColToPosition(file, line, col); - var locs = compilerService.languageService.getDefinitionAtPosition(file, pos); - if (locs) { - var info: ServerProtocol.CodeSpan[] = locs.map(def => ({ - file: def && def.fileName, - start: def && - compilerService.host.positionToLineCol(def.fileName, def.textSpan.start), - end: def && - compilerService.host.positionToLineCol(def.fileName, ts.textSpanEnd(def.textSpan)) - })); - this.output(info, CommandNames.Definition, reqSeq); - } - else { - this.output(undefined, CommandNames.Definition, reqSeq, "could not find def"); - } + if (!project) { + throw Errors.NoProject; } - else { - this.output(undefined, CommandNames.Definition, reqSeq, "no project for " + file); + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + + var definitions = compilerService.languageService.getDefinitionAtPosition(file, position); + if (!definitions) { + throw Errors.NoContent; } + + return definitions.map(def => ({ + file: def && def.fileName, + start: def && + compilerService.host.positionToLineCol(def.fileName, def.textSpan.start), + end: def && + compilerService.host.positionToLineCol(def.fileName, ts.textSpanEnd(def.textSpan)) + })); } - rename(line: number, col: number, rawfile: string, reqSeq = 0) { - var file = ts.normalizePath(rawfile); + rename(line: number, col: number, fileName: string): { info: RenameInfo; locs: ServerProtocol.CodeSpan[] } { + var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); - if (project) { - var compilerService = project.compilerService; - var pos = compilerService.host.lineColToPosition(file, line, col); - var renameInfo = compilerService.languageService.getRenameInfo(file, pos); - if (renameInfo) { - if (renameInfo.canRename) { - var renameLocs = compilerService.languageService.findRenameLocations(file, pos, false, false); - if (renameLocs) { - var bakedRenameLocs = renameLocs.map(loc=> ({ - file: loc.fileName, - start: compilerService.host.positionToLineCol(loc.fileName, loc.textSpan.start), - end: compilerService.host.positionToLineCol(loc.fileName, ts.textSpanEnd(loc.textSpan)), - })).sort((a, b) => { - if (a.file < b.file) { - return -1; - } - else if (a.file > b.file) { - return 1; - } - else { - // reverse sort assuming no overlap - if (a.start.line < b.start.line) { - return 1; - } - else if (a.start.line > b.start.line) { - return -1; - } - else { - return b.start.col - a.start.col; - } - } - }).reduce((accum: FileRanges[], cur: FileRange) => { - var curFileAccum: FileRanges; - if (accum.length > 0) { - curFileAccum = accum[accum.length - 1]; - if (curFileAccum.file != cur.file) { - curFileAccum = undefined; - } - } - if (!curFileAccum) { - curFileAccum = { file: cur.file, locs: [] }; - accum.push(curFileAccum); - } - curFileAccum.locs.push({ start: cur.start, end: cur.end }); - return accum; - }, []); - this.output({ info: renameInfo, locs: bakedRenameLocs }, CommandNames.Rename, reqSeq); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + var renameInfo = compilerService.languageService.getRenameInfo(file, position); + if (!renameInfo) { + throw Errors.NoContent; + } + + if (!renameInfo.canRename) { + return { + info: renameInfo, + locs: [] + }; + } + + var renameLocs = compilerService.languageService.findRenameLocations(file, position, false, false); + if (renameLocs) { + var bakedRenameLocs = renameLocs.map(loc=> ({ + file: loc.fileName, + start: compilerService.host.positionToLineCol(loc.fileName, loc.textSpan.start), + end: compilerService.host.positionToLineCol(loc.fileName, ts.textSpanEnd(loc.textSpan)), + })).sort((a, b) => { + if (a.file < b.file) { + return -1; + } + else if (a.file > b.file) { + return 1; + } + else { + // reverse sort assuming no overlap + if (a.start.line < b.start.line) { + return 1; + } + else if (a.start.line > b.start.line) { + return -1; } else { - this.output({ info: renameInfo, locs: [] }, CommandNames.Rename, reqSeq); + return b.start.col - a.start.col; } } - else { - this.output(undefined, CommandNames.Rename, reqSeq, renameInfo.localizedErrorMessage); + }).reduce((accum, cur) => { + var curFileAccum: FileRanges; + if (accum.length > 0) { + curFileAccum = accum[accum.length - 1]; + if (curFileAccum.file != cur.file) { + curFileAccum = undefined; + } } - } - else { - this.output(undefined, CommandNames.Rename, reqSeq, "no rename information at cursor"); - } + if (!curFileAccum) { + curFileAccum = { file: cur.file, locs: [] }; + accum.push(curFileAccum); + } + curFileAccum.locs.push({ start: cur.start, end: cur.end }); + return accum; + }, []); } + + return { info: renameInfo, locs: bakedRenameLocs }; } - findReferences(line: number, col: number, rawfile: string, reqSeq = 0) { + findReferences(line: number, col: number, fileName: string): ServerProtocol.ReferencesResponseBody { // TODO: get all projects for this file; report refs for all projects deleting duplicates // can avoid duplicates by eliminating same ref file from subsequent projects - var file = ts.normalizePath(rawfile); + var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); - if (project) { - var compilerService = project.compilerService; - var pos = compilerService.host.lineColToPosition(file, line, col); - var refs = compilerService.languageService.getReferencesAtPosition(file, pos); - if (refs) { - var nameInfo = compilerService.languageService.getQuickInfoAtPosition(file, pos); - if (nameInfo) { - var displayString = ts.displayPartsToString(nameInfo.displayParts); - var nameSpan = nameInfo.textSpan; - var nameColStart = - compilerService.host.positionToLineCol(file, nameSpan.start).col; - var nameText = - compilerService.host.getScriptSnapshot(file).getText(nameSpan.start, ts.textSpanEnd(nameSpan)); - var bakedRefs: ServerProtocol.ReferencesResponseItem[] = refs.map((ref) => { - var start = compilerService.host.positionToLineCol(ref.fileName, ref.textSpan.start); - var refLineSpan = compilerService.host.lineToTextSpan(ref.fileName, start.line - 1); - var snap = compilerService.host.getScriptSnapshot(ref.fileName); - var lineText = snap.getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); - return { - file: ref.fileName, - start: start, - lineText: lineText, - end: compilerService.host.positionToLineCol(ref.fileName, ts.textSpanEnd(ref.textSpan)), - }; - }).sort(compareFileStart); - var response: ServerProtocol.ReferencesResponseBody = { - refs: bakedRefs, - symbolName: nameText, - symbolStartCol: nameColStart, - symbolDisplayString: displayString - }; - this.output(response, CommandNames.References, reqSeq); - } - else { - this.output(undefined, CommandNames.References, reqSeq, "no references at this position"); - } - } - else { - this.output(undefined, CommandNames.References, reqSeq, "no references at this position"); - } + if (!project) { + throw Errors.NoProject; } - } - // TODO: implement this as ls api that can return multiple def sites - goToType(line: number, col: number, rawfile: string, reqSeq = 0) { - var file = ts.normalizePath(rawfile); - var project = this.projectService.getProjectForFile(file); - if (project) { - var compilerService = project.compilerService; - var pos = compilerService.host.lineColToPosition(file, line, col); - var quickInfo = compilerService.languageService.getQuickInfoAtPosition(file, pos); - var typeLoc: any; + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); - if (quickInfo && (quickInfo.kind == "var") || (quickInfo.kind == "local var")) { - var typeName = parseTypeName(quickInfo.displayParts); - if (typeName) { - var navItems = compilerService.languageService.getNavigateToItems(typeName); - var navItem = findExactMatchType(navItems); - if (navItem) { - typeLoc = { - file: navItem.fileName, - start: compilerService.host.positionToLineCol(navItem.fileName, - navItem.textSpan.start), - end: compilerService.host.positionToLineCol(navItem.fileName, - ts.textSpanEnd(navItem.textSpan)), - }; - } - } - } - if (typeLoc) { - this.output([typeLoc], CommandNames.Type, reqSeq); - } - else { - this.output(undefined, CommandNames.Type, reqSeq, "no info at this location"); - } + var references = compilerService.languageService.getReferencesAtPosition(file, position); + if (!references) { + throw Errors.NoContent; } - else { - this.output(undefined, CommandNames.Type, reqSeq, "no project for " + file); + + var nameInfo = compilerService.languageService.getQuickInfoAtPosition(file, position); + if (!nameInfo) { + throw Errors.NoContent; } + + var displayString = ts.displayPartsToString(nameInfo.displayParts); + var nameSpan = nameInfo.textSpan; + var nameColStart = compilerService.host.positionToLineCol(file, nameSpan.start).col; + var nameText = compilerService.host.getScriptSnapshot(file).getText(nameSpan.start, ts.textSpanEnd(nameSpan)); + var bakedRefs: ServerProtocol.ReferencesResponseItem[] = references.map((ref) => { + var start = compilerService.host.positionToLineCol(ref.fileName, ref.textSpan.start); + var refLineSpan = compilerService.host.lineToTextSpan(ref.fileName, start.line - 1); + var snap = compilerService.host.getScriptSnapshot(ref.fileName); + var lineText = snap.getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); + return { + file: ref.fileName, + start: start, + lineText: lineText, + end: compilerService.host.positionToLineCol(ref.fileName, ts.textSpanEnd(ref.textSpan)), + }; + }).sort(compareFileStart); + return { + refs: bakedRefs, + symbolName: nameText, + symbolStartCol: nameColStart, + symbolDisplayString: displayString + }; } openClientFile(rawfile: string) { @@ -746,173 +455,151 @@ module ts.server { this.projectService.openClientFile(file); } - quickInfo(line: number, col: number, rawfile: string, reqSeq = 0) { - var file = ts.normalizePath(rawfile); + quickInfo(line: number, col: number, fileName: string): ServerProtocol.QuickInfoResponseBody { + var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); - if (project) { - var compilerService = project.compilerService; - var pos = compilerService.host.lineColToPosition(file, line, col); - var quickInfo = compilerService.languageService.getQuickInfoAtPosition(file, pos); - if (quickInfo) { - var displayString = ts.displayPartsToString(quickInfo.displayParts); - var docString = ts.displayPartsToString(quickInfo.documentation); - var qi: ServerProtocol.QuickInfoResponseBody = { - kind: quickInfo.kind, - kindModifiers: quickInfo.kindModifiers, - start: compilerService.host.positionToLineCol(file, quickInfo.textSpan.start), - end: compilerService.host.positionToLineCol(file, ts.textSpanEnd(quickInfo.textSpan)), - displayString: displayString, - documentation: docString, - }; - this.output(qi, CommandNames.Quickinfo, reqSeq); - } - else { - this.output(undefined, CommandNames.Quickinfo, reqSeq, "no info") - } + if (!project) { + throw Errors.NoProject; } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + var quickInfo = compilerService.languageService.getQuickInfoAtPosition(file, position); + if (!quickInfo) { + throw Errors.NoContent; + } + + var displayString = ts.displayPartsToString(quickInfo.displayParts); + var docString = ts.displayPartsToString(quickInfo.documentation); + return { + kind: quickInfo.kind, + kindModifiers: quickInfo.kindModifiers, + start: compilerService.host.positionToLineCol(file, quickInfo.textSpan.start), + end: compilerService.host.positionToLineCol(file, ts.textSpanEnd(quickInfo.textSpan)), + displayString: displayString, + documentation: docString, + }; } - format(line: number, col: number, endLine: number, endCol: number, rawfile: string, cmd: string, reqSeq = 0) { - var file = ts.normalizePath(rawfile); + format(line: number, col: number, endLine: number, endCol: number, fileName: string): ServerProtocol.CodeEdit[] { + var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); - if (project) { - var compilerService = project.compilerService; - var pos = compilerService.host.lineColToPosition(file, line, col); - var endPos = compilerService.host.lineColToPosition(file, endLine, endCol); - var edits: ts.TextChange[]; - // TODO: avoid duplicate code (with formatonkey) - try { - edits = compilerService.languageService.getFormattingEditsForRange(file, pos, endPos, - compilerService.formatCodeOptions); - } - catch (err) { - this.logError(err, cmd); - edits = undefined; - } - if (edits) { - var bakedEdits: ServerProtocol.CodeEdit[] = edits.map((edit) => { - return { - start: compilerService.host.positionToLineCol(file, - edit.span.start), - end: compilerService.host.positionToLineCol(file, - ts.textSpanEnd(edit.span)), - newText: edit.newText ? edit.newText : "" - }; - }); - this.output(bakedEdits, CommandNames.Format, reqSeq); - } - else { - this.output(undefined, CommandNames.Format, reqSeq, "no edits") - } + if (!project) { + throw Errors.NoProject; } + + var compilerService = project.compilerService; + var startPosition = compilerService.host.lineColToPosition(file, line, col); + var endPosition = compilerService.host.lineColToPosition(file, endLine, endCol); + + // TODO: avoid duplicate code (with formatonkey) + var edits = compilerService.languageService.getFormattingEditsForRange(file, startPosition, endPosition, compilerService.formatCodeOptions); + if (!edits) { + throw Errors.NoContent; + } + + return edits.map((edit) => { + return { + start: compilerService.host.positionToLineCol(file, edit.span.start), + end: compilerService.host.positionToLineCol(file, ts.textSpanEnd(edit.span)), + newText: edit.newText ? edit.newText : "" + }; + }); } - formatOnKey(line: number, col: number, key: string, rawfile: string, cmd: string, reqSeq = 0) { - var file = ts.normalizePath(rawfile); + formatOnKey(line: number, col: number, key: string, fileName: string): ServerProtocol.CodeEdit[] { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); - if (project) { - var compilerService = project.compilerService; - var pos = compilerService.host.lineColToPosition(file, line, col); - var edits: ts.TextChange[]; - try { - edits = compilerService.languageService.getFormattingEditsAfterKeystroke(file, pos, key, - compilerService.formatCodeOptions); - if ((key == "\n") && ((!edits) || (edits.length == 0) || allEditsBeforePos(edits, pos))) { - // TODO: get these options from host - var editorOptions: ts.EditorOptions = { - IndentSize: 4, - TabSize: 4, - NewLineCharacter: "\n", - ConvertTabsToSpaces: true, - }; - var indentPosition = compilerService.languageService.getIndentationAtPosition(file, pos, editorOptions); - var spaces = generateSpaces(indentPosition); - if (indentPosition > 0) { - edits.push({ span: ts.createTextSpanFromBounds(pos, pos), newText: spaces }); - } - } - } - catch (err) { - this.logError(err, cmd); - edits = undefined; - } - if (edits) { - var bakedEdits: ServerProtocol.CodeEdit[] = edits.map((edit) => { - return { - start: compilerService.host.positionToLineCol(file, - edit.span.start), - end: compilerService.host.positionToLineCol(file, - ts.textSpanEnd(edit.span)), - newText: edit.newText ? edit.newText : "" - }; - }); - this.output(bakedEdits, CommandNames.Formatonkey, reqSeq); - } - else { - this.output(undefined, CommandNames.Formatonkey, reqSeq, "no edits") + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + var edits = compilerService.languageService.getFormattingEditsAfterKeystroke(file, position, key, + compilerService.formatCodeOptions); + if ((key == "\n") && ((!edits) || (edits.length == 0) || allEditsBeforePos(edits, position))) { + // TODO: get these options from host + var editorOptions: ts.EditorOptions = { + IndentSize: 4, + TabSize: 4, + NewLineCharacter: "\n", + ConvertTabsToSpaces: true, + }; + var indentPosition = compilerService.languageService.getIndentationAtPosition(file, position, editorOptions); + var spaces = generateSpaces(indentPosition); + if (indentPosition > 0) { + edits.push({ span: ts.createTextSpanFromBounds(position, position), newText: spaces }); } } + + if (!edits) { + throw Errors.NoContent; + } + + return edits.map((edit) => { + return { + start: compilerService.host.positionToLineCol(file, + edit.span.start), + end: compilerService.host.positionToLineCol(file, + ts.textSpanEnd(edit.span)), + newText: edit.newText ? edit.newText : "" + }; + }); } - completions(line: number, col: number, prefix: string, rawfile: string, cmd: string, reqSeq = 0) { + completions(line: number, col: number, prefix: string, fileName: string): ServerProtocol.CompletionItem[] { if (!prefix) { prefix = ""; } - var file = ts.normalizePath(rawfile); + var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); - var completions: ts.CompletionInfo = undefined; - if (project) { - var compilerService = project.compilerService; - var pos = compilerService.host.lineColToPosition(file, line, col); - if (pos >= 0) { - try { - completions = compilerService.languageService.getCompletionsAtPosition(file, pos); - } - catch (err) { - this.logError(err, cmd); - completions = undefined; - } - if (completions) { - var compressedEntries: ServerProtocol.CompletionItem[] = - completions.entries.reduce((accum: ts.CompletionEntryDetails[], entry: ts.CompletionEntry) => { - if (entry.name.indexOf(prefix) == 0) { - var protoEntry = {}; - protoEntry.name = entry.name; - protoEntry.kind = entry.kind; - if (entry.kindModifiers && (entry.kindModifiers.length > 0)) { - protoEntry.kindModifiers = entry.kindModifiers; - } - var details = compilerService.languageService.getCompletionEntryDetails(file, pos, entry.name); - if (details && (details.documentation) && (details.documentation.length > 0)) { - protoEntry.documentation = details.documentation; - } - if (details && (details.displayParts) && (details.displayParts.length > 0)) { - protoEntry.displayParts = details.documentation; - } - accum.push(protoEntry); - } - return accum; - }, []); - this.output(compressedEntries, CommandNames.Completions, reqSeq); - } - } + if (!project) { + throw Errors.NoProject; } - if (!completions) { - this.output(undefined, CommandNames.Completions, reqSeq, "no completions"); - } - } - geterr(ms: number, files: string[]) { - var checkList = files.reduce((accum: PendingErrorCheck[], filename: string) => { - filename = ts.normalizePath(filename); - var project = this.projectService.getProjectForFile(filename); - if (project) { - accum.push({ filename: filename, project: project }); + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + + var completions = compilerService.languageService.getCompletionsAtPosition(file, position); + if (!completions) { + throw Errors.NoContent; + } + + return completions.entries.reduce((accum: ts.CompletionEntryDetails[], entry: ts.CompletionEntry) => { + if (entry.name.indexOf(prefix) == 0) { + var protoEntry = {}; + protoEntry.name = entry.name; + protoEntry.kind = entry.kind; + if (entry.kindModifiers && (entry.kindModifiers.length > 0)) { + protoEntry.kindModifiers = entry.kindModifiers; + } + var details = compilerService.languageService.getCompletionEntryDetails(file, position, entry.name); + if (details && (details.documentation) && (details.documentation.length > 0)) { + protoEntry.documentation = details.documentation; + } + if (details && (details.displayParts) && (details.displayParts.length > 0)) { + protoEntry.displayParts = details.documentation; + } + accum.push(protoEntry); } return accum; }, []); + } + + geterr(delay: number, fileNames: string[]) { + var checkList = fileNames.reduce((accum: PendingErrorCheck[], fileName: string) => { + fileName = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(fileName); + if (project) { + accum.push({ fileName, project }); + } + return accum; + }, []); + if (checkList.length > 0) { - this.updateErrorCheck(checkList, this.changeSeq,(n) => n == this.changeSeq, ms) + this.updateErrorCheck(checkList, this.changeSeq,(n) => n == this.changeSeq, delay) } } @@ -997,352 +684,165 @@ module ts.server { } } - navto(searchTerm: string, rawfile: string, cmd: string, reqSeq = 0) { - var file = ts.normalizePath(rawfile); + navto(searchTerm: string, fileName: string): ServerProtocol.NavtoItem[] { + var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); - if (project) { - var compilerService = project.compilerService; - var navItems: ts.NavigateToItem[]; - var cancellationToken = compilerService.host.getCancellationToken(); - if (this.pendingOperation) { - cancellationToken.cancel(); - cancellationToken.reset(); - } - try { - this.pendingOperation = true; - navItems = sortNavItems(compilerService.languageService.getNavigateToItems(searchTerm)); - } - catch (err) { - this.logError(err, cmd); - navItems = undefined; - } - this.pendingOperation = false; - if (navItems) { - var bakedNavItems: ServerProtocol.NavtoItem[] = navItems.map((navItem) => { - var start = compilerService.host.positionToLineCol(navItem.fileName, - navItem.textSpan.start); - var end = compilerService.host.positionToLineCol(navItem.fileName, ts.textSpanEnd(navItem.textSpan)); - this.abbreviate(start); - var bakedItem: ServerProtocol.NavtoItem = { - name: navItem.name, - kind: navItem.kind, - file: this.encodeFilename(navItem.fileName), - start: start, - end: end, - }; - if (navItem.kindModifiers && (navItem.kindModifiers != "")) { - bakedItem.kindModifiers = navItem.kindModifiers; - } - if (navItem.matchKind != 'none') { - bakedItem.matchKind = navItem.matchKind; - } - if (navItem.containerName && (navItem.containerName.length > 0)) { - bakedItem.containerName = navItem.containerName; - } - if (navItem.containerKind && (navItem.containerKind.length > 0)) { - bakedItem.containerKind = navItem.containerKind; - } - this.abbreviate(bakedItem); - return bakedItem; - }); + if (!project) { + throw Errors.NoProject; + } - this.output(bakedNavItems, CommandNames.Navto, reqSeq); - } - else { - this.output(undefined, CommandNames.Navto, reqSeq, "no nav items"); - } - } - else { - this.output(undefined, CommandNames.Navto, reqSeq, "no nav items"); + var compilerService = project.compilerService; + var navItems = sortNavItems(compilerService.languageService.getNavigateToItems(searchTerm)); + if (!navItems) { + throw Errors.NoContent; } + + return navItems.map((navItem) => { + var start = compilerService.host.positionToLineCol(navItem.fileName, navItem.textSpan.start); + var end = compilerService.host.positionToLineCol(navItem.fileName, ts.textSpanEnd(navItem.textSpan)); + var bakedItem: ServerProtocol.NavtoItem = { + name: navItem.name, + kind: navItem.kind, + file: this.encodeFilename(navItem.fileName), + start: start, + end: end, + }; + if (navItem.kindModifiers && (navItem.kindModifiers != "")) { + bakedItem.kindModifiers = navItem.kindModifiers; + } + if (navItem.matchKind != 'none') { + bakedItem.matchKind = navItem.matchKind; + } + if (navItem.containerName && (navItem.containerName.length > 0)) { + bakedItem.containerName = navItem.containerName; + } + if (navItem.containerKind && (navItem.containerKind.length > 0)) { + bakedItem.containerKind = navItem.containerKind; + } + return bakedItem; + }); } - getMatchingBrace(line: number, col: number, rawfile: string, reqSeq = 0) { - var file = ts.normalizePath(rawfile); + getBraceMatching(line: number, col: number, fileName: string): ServerProtocol.TextSpan[] { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); - if (project) { - var compilerService = project.compilerService; - var pos = compilerService.host.lineColToPosition(file, line, col); - var spans: ts.TextSpan[]; - try { - spans = compilerService.languageService.getBraceMatchingAtPosition(file, pos); - } - catch (err) { - this.logError(err, CommandNames.Brace); - spans = undefined; - } - if (spans) { - var bakedSpans: ServerProtocol.TextSpan[] = spans.map(span => ({ - start: span && - compilerService.host.positionToLineCol(file, span.start), - end: span && - compilerService.host.positionToLineCol(file, span.start + span.length) - })); - this.output(bakedSpans, CommandNames.Brace, reqSeq); - } - else { - this.output(undefined, CommandNames.Brace, reqSeq, "no matching braces"); - } + if (!project) { + throw Errors.NoProject; } - else { - this.output(undefined, CommandNames.Brace, reqSeq, "no matching braces"); + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + + var spans = compilerService.languageService.getBraceMatchingAtPosition(file, position); + if (!spans) { + throw Errors.NoContent; } + + return spans.map(span => ({ + start: compilerService.host.positionToLineCol(file, span.start), + end: compilerService.host.positionToLineCol(file, span.start + span.length) + })); } - executeJSONcmd(cmd: string) { + onMessage(message: string) { try { - var req = JSON.parse(cmd); - switch (req.command) { + var request = JSON.parse(message); + var response: any; + switch (request.command) { case CommandNames.Definition: { - var defArgs = req.arguments; - this.goToDefinition(defArgs.line, defArgs.col, defArgs.file, req.seq); + var defArgs = request.arguments; + response = this.goToDefinition(defArgs.line, defArgs.col, defArgs.file); break; } case CommandNames.References: { - var refArgs = req.arguments; - this.findReferences(refArgs.line, refArgs.col, refArgs.file, req.seq); + var refArgs = request.arguments; + response = this.findReferences(refArgs.line, refArgs.col, refArgs.file); break; } case CommandNames.Rename: { - var renameArgs = req.arguments; - this.rename(renameArgs.line, renameArgs.col, renameArgs.file, req.seq); - break; - } - case CommandNames.Type: { - var typeArgs = req.arguments; - this.goToType(typeArgs.line, typeArgs.col, typeArgs.file, req.seq); + var renameArgs = request.arguments; + response = this.rename(renameArgs.line, renameArgs.col, renameArgs.file); break; } case CommandNames.Open: { - var openArgs = req.arguments; + var openArgs = request.arguments; this.openClientFile(openArgs.file); break; } case CommandNames.Quickinfo: { - var quickinfoArgs = req.arguments; - this.quickInfo(quickinfoArgs.line, quickinfoArgs.col, quickinfoArgs.file, req.seq); + var quickinfoArgs = request.arguments; + response = this.quickInfo(quickinfoArgs.line, quickinfoArgs.col, quickinfoArgs.file); break; } case CommandNames.Format: { - var formatArgs = req.arguments; - this.format(formatArgs.line, formatArgs.col, formatArgs.endLine, formatArgs.endCol, formatArgs.file, - cmd, req.seq); + var formatArgs = request.arguments; + response = this.format(formatArgs.line, formatArgs.col, formatArgs.endLine, formatArgs.endCol, formatArgs.file); break; } case CommandNames.Formatonkey: { - var formatOnKeyArgs = req.arguments; - this.formatOnKey(formatOnKeyArgs.line, formatOnKeyArgs.col, formatOnKeyArgs.key, formatOnKeyArgs.file, - cmd, req.seq); + var formatOnKeyArgs = request.arguments; + response = this.formatOnKey(formatOnKeyArgs.line, formatOnKeyArgs.col, formatOnKeyArgs.key, formatOnKeyArgs.file); break; } case CommandNames.Completions: { - var completionsArgs = req.arguments; - this.completions(req.arguments.line, req.arguments.col, completionsArgs.prefix, req.arguments.file, - cmd, req.seq); + var completionsArgs = request.arguments; + response = this.completions(request.arguments.line, request.arguments.col, completionsArgs.prefix, request.arguments.file); break; } case CommandNames.Geterr: { - var geterrArgs = req.arguments; - this.geterr(geterrArgs.delay, geterrArgs.files); + var geterrArgs = request.arguments; + response = this.geterr(geterrArgs.delay, geterrArgs.files); break; } case CommandNames.Change: { - var changeArgs = req.arguments; + var changeArgs = request.arguments; this.change(changeArgs.line, changeArgs.col, changeArgs.deleteLen, changeArgs.insertString, changeArgs.file); break; } case CommandNames.Reload: { - var reloadArgs = req.arguments; - this.reload(reloadArgs.file, reloadArgs.tmpfile, req.seq); + var reloadArgs = request.arguments; + this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq); break; } case CommandNames.Saveto: { - var savetoArgs = req.arguments; + var savetoArgs = request.arguments; this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile); break; } case CommandNames.Close: { - var closeArgs = req.arguments; + var closeArgs = request.arguments; this.closeClientFile(closeArgs.file); break; } case CommandNames.Navto: { - var navtoArgs = req.arguments; - this.navto(navtoArgs.searchTerm, navtoArgs.file, cmd, req.seq); - break; - } - case CommandNames.Abbrev: { - this.sendAbbrev(); + var navtoArgs = request.arguments; + response = this.navto(navtoArgs.searchTerm, navtoArgs.file); break; } case CommandNames.Brace: { - var defArgs = req.arguments; - this.getMatchingBrace(defArgs.line, defArgs.col, defArgs.file, req.seq); + var braceArguments = request.arguments; + response = this.getBraceMatching(braceArguments.line, braceArguments.col, braceArguments.file); break; } default: { - this.projectService.log("Unrecognized JSON command: " + cmd); + this.projectService.log("Unrecognized JSON command: " + message); + this.output(undefined, CommandNames.Unknown, request.seq, "Unrecognized JSON command: " + request.command); break; } } + + if (response) { + this.output(response, request.command, request.seq); + } + } catch (err) { - this.logError(err, cmd); - } - } - - sendAbbrev(reqSeq = 0) { - if (!this.fetchedAbbrev) { - this.output(this.abbrevTable, CommandNames.Abbrev, reqSeq); - } - this.fetchedAbbrev = true; - } - - executeCmd(cmd: string) { - var line: number, col: number, file: string; - var m: string[]; - - try { - if (m = cmd.match(/^dbg start$/)) { - this.debugSession = new JsDebugSession(this.host.getDebuggerClient()); + if (err instanceof OperationCanceledException) { + // Handle cancellation exceptions } - else if (m = cmd.match(/^dbg cont$/)) { - if (this.debugSession) { - this.debugSession.cont((err, body, res) => { - }); - } - } - else if (m = cmd.match(/^dbg src$/)) { - if (this.debugSession) { - this.debugSession.listSrc(); - } - } - else if (m = cmd.match(/^dbg brk (\d+) (.*)$/)) { - line = parseInt(m[1]); - file = ts.normalizePath(m[2]); - if (this.debugSession) { - this.debugSession.setBreakpointOnLine(line, file); - } - } - else if (m = cmd.match(/^dbg eval (.*)$/)) { - var code = m[1]; - if (this.debugSession) { - this.debugSession.evaluate(code); - } - } - else if (m = cmd.match(/^definition (\d+) (\d+) (.*)$/)) { - line = parseInt(m[1]); - col = parseInt(m[2]); - file = m[3]; - this.goToDefinition(line, col, file); - } - else if (m = cmd.match(/^rename (\d+) (\d+) (.*)$/)) { - line = parseInt(m[1]); - col = parseInt(m[2]); - file = m[3]; - this.rename(line, col, file); - } - else if (m = cmd.match(/^type (\d+) (\d+) (.*)$/)) { - line = parseInt(m[1]); - col = parseInt(m[2]); - file = m[3]; - this.goToType(line, col, file); - } - else if (m = cmd.match(/^open (.*)$/)) { - file = m[1]; - this.openClientFile(file); - } - else if (m = cmd.match(/^references (\d+) (\d+) (.*)$/)) { - line = parseInt(m[1]); - col = parseInt(m[2]); - file = m[3]; - this.findReferences(line, col, file); - } - else if (m = cmd.match(/^quickinfo (\d+) (\d+) (.*)$/)) { - line = parseInt(m[1]); - col = parseInt(m[2]); - file = m[3]; - this.quickInfo(line, col, file); - } - else if (m = cmd.match(/^format (\d+) (\d+) (\d+) (\d+) (.*)$/)) { - // format line col endLine endCol file - line = parseInt(m[1]); - col = parseInt(m[2]); - var endLine = parseInt(m[3]); - var endCol = parseInt(m[4]); - file = m[5]; - this.format(line, col, endLine, endCol, file, cmd); - } - else if (m = cmd.match(/^formatonkey (\d+) (\d+) (\{\".*\"\})\s* (.*)$/)) { - line = parseInt(m[1]); - col = parseInt(m[2]); - var key = JSON.parse(m[3].substring(1, m[3].length - 1)); - file = m[4]; - this.formatOnKey(line, col, key, file, cmd); - } - else if (m = cmd.match(/^completions (\d+) (\d+) (\{.*\})?\s*(.*)$/)) { - line = parseInt(m[1]); - col = parseInt(m[2]); - var prefix = ""; - file = m[4]; - if (m[3]) { - prefix = m[3].substring(1, m[3].length - 1); - } - this.completions(line, col, prefix, file, cmd); - } - else if (m = cmd.match(/^geterr (\d+) (.*)$/)) { - var ms = parseInt(m[1]); - var rawFiles = m[2]; - this.geterr(ms, rawFiles.split(';')); - } - else if (m = cmd.match(/^change (\d+) (\d+) (\d+) (\d+) (\{\".*\"\})?\s*(.*)$/)) { - line = parseInt(m[1]); - col = parseInt(m[2]); - var deleteLen = parseInt(m[3]); - var insertLen = parseInt(m[4]); - var insertString: string; - if (insertLen) { - insertString = JSON.parse(m[5].substring(1, m[5].length - 1)); - } - file = m[6]; - this.change(line, col, deleteLen, insertString, file); - } - else if (m = cmd.match(/^reload (.*) from (.*)$/)) { - this.reload(m[1], m[2]); - } - // TODO: change this to saveto - else if (m = cmd.match(/^save (.*) to (.*)$/)) { - this.saveToTmp(m[1], m[2]); - } - else if (m = cmd.match(/^close (.*)$/)) { - this.closeClientFile(m[1]); - } - else if (m = cmd.match(/^navto (\{.*\}) (.*)$/)) { - var searchTerm = m[1]; - searchTerm = searchTerm.substring(1, searchTerm.length - 1); - this.navto(searchTerm, m[2], cmd); - } - else if (m = cmd.match(/^navbar (.*)$/)) { - this.navbar(m[1]); - } - else if (m = cmd.match(/^abbrev/)) { - this.sendAbbrev(); - } - else if (m = cmd.match(/^pretty/)) { - this.prettyJSON = true; - } - else if (m = cmd.match(/^printproj/)) { - this.projectService.printProjects(); - } - else if (m = cmd.match(/^fileproj (.*)$/)) { - file = ts.normalizePath(m[1]); - this.projectService.printProjectsForFile(file); - } - else { - this.output(undefined, CommandNames.Unknown, 0, "Unrecognized command " + cmd); - } - } catch (err) { - this.logError(err, cmd); + this.logError(err, message); + this.output(undefined, request ? request.command : CommandNames.Unknown, request ? request.seq : 0, "Error processing request. " + err.message); } } } diff --git a/src/server/protodef.d.ts b/src/server/protodef.d.ts index 73c39404154..95e671f561e 100644 --- a/src/server/protodef.d.ts +++ b/src/server/protodef.d.ts @@ -188,18 +188,6 @@ declare module ServerProtocol { } } - /** - Type request; value of command field is "type". Return response - giving the code locations that define the type of the symbol - found in file at location line, col. - */ - export interface TypeRequest extends CodeLocationRequest { - } - - export interface TypeResponse extends Response { - body?: CodeSpan[]; - } - /** Open request; value of command field is "open". Notify the server that the client has file open. The server will not @@ -483,8 +471,8 @@ declare module ServerProtocol { kindModifiers?: string; /** The file in which the symbol is found; the value of this - field will always be a string unless the client opts-in to - file encoding by sending the "abbrev" request. + field will always be a string, number of a mapping between + a string and a number. */ file: EncodedFile; /** The location within file at which the symbol is found*/ @@ -528,27 +516,6 @@ declare module ServerProtocol { arguments: ChangeRequestArgs; } - /* - The following messages describe an OPTIONAL compression scheme - that clients can choose to use. If a client does not opt-in to - this scheme by sending an "abbrev" request, the server will not - compress messages. - */ - - /** - Abbrev request message; value of command field is "abbrev". - Server returns an array of mappings from common message field - names and common message field string values to shortened - versions of these strings. Once a client opts-in by requesting - the abbreviations, the server may send responses whose field - names are shortened. The server may also send file names as - instances of AssignFileId, or as file ids, if the corresponding - id assignment had been previously returned. Currently, only - responses to the "navto" request can be encoded. - */ - export interface AbbrevRequest extends Request { - } - /** If an object of this type is returned in place of a string as the value of a file field in a response message, add the @@ -572,25 +539,6 @@ declare module ServerProtocol { */ export type EncodedFile = number | IdFile | string; - /** - Response to abbrev opt-in request message. This is a map of - string field names and common string field values to shortened - strings. Once the server sends this response, it will assume - that it can use the shortened field names and field values. In - addition, the server will assume it can assign ids to file - names by returning an AssignFileId instance in place of a file - name. Once an AssignFileId instance is returned, the server - may send the file id (a number) in place of the file name. - */ - export interface AbbrevResponse extends Response { - body?: { - /** Map from full string (either field name or string - field value) to shortened string */ - [fullString: string]: string; - } - } - - /** Response to "brace" request. */ export interface BraceResponse extends Response { body?: TextSpan[]; diff --git a/src/server/server.ts b/src/server/server.ts index ec0ee293ce3..9f06e9b0277 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -1,18 +1,18 @@ -/// -/// - -module ts.server { +/// +/// + +module ts.server { var nodeproto: typeof NodeJS._debugger = require('_debugger'); var readline: NodeJS.ReadLine = require('readline'); - var path: NodeJS.Path = require('path'); + var path: NodeJS.Path = require('path'); var fs: typeof NodeJS.fs = require('fs'); - + var rl = readline.createInterface({ input: process.stdin, output: process.stdout, terminal: false, - }); - + }); + class Logger implements ts.server.Logger { fd = -1; seq = 0; @@ -71,17 +71,17 @@ module ts.server { } } } - - class IOSession extends Session { - protocol: NodeJS._debugger.Protocol; - - constructor(host: ServerHost, logger: ts.server.Logger, useProtocol: boolean, prettyJSON: boolean) { - super(host, logger, useProtocol, prettyJSON); + + class IOSession extends Session { + protocol: NodeJS._debugger.Protocol; + + constructor(host: ServerHost, logger: ts.server.Logger, useProtocol: boolean, prettyJSON: boolean) { + super(host, logger, useProtocol, prettyJSON); if (useProtocol) { this.initProtocol(); - } - } - + } + } + initProtocol() { this.protocol = new nodeproto.Protocol(); // note: onResponse was named by nodejs authors; we are re-purposing the Protocol @@ -89,25 +89,16 @@ module ts.server { this.protocol.onResponse = (pkt) => { this.handleRequest(pkt); }; - } - + } + handleRequest(req: NodeJS._debugger.Packet) { this.projectService.log("Got JSON msg:\n" + req.raw); - } - + } + listen() { rl.on('line',(input: string) => { - var cmd = input.trim(); - if (cmd.indexOf("{") == 0) { - // assumption is JSON on single line - // plan is to also carry this protocol - // over tcp, in which case JSON would - // have a Content-Length header - this.executeJSONcmd(cmd); - } - else { - this.executeCmd(cmd); - } + var message = input.trim(); + this.onMessage(message); }); rl.on('close',() => { @@ -115,20 +106,13 @@ module ts.server { this.projectService.log("Exiting..."); process.exit(0); }); - } - } - + } + } + // This places log file in the directory containing editorServices.js // TODO: check that this location is writable - var logger = new Logger(__dirname + "/.log" + process.pid.toString()); - - var host: ServerHost = ts.sys; - - // Wire the debugging interface - if (!host.getDebuggerClient) { - host.getDebuggerClient = () => new nodeproto.Client(); - } - - // Start listening - new IOSession(host, logger, /* useProtocol */ true, /* prettyJSON */ false).listen(); + var logger = new Logger(__dirname + "/.log" + process.pid.toString()); + + // Start listening + new IOSession(ts.sys, logger, /* useProtocol */ true, /* prettyJSON */ false).listen(); } \ No newline at end of file From dfd8a0620dcb3130aec0c82b007edd7feb735236 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sat, 14 Feb 2015 15:50:06 -0800 Subject: [PATCH 063/162] Always default to using JSON and do not format it --- src/harness/harnessLanguageService.ts | 2 +- src/server/protocol.ts | 37 +++------------------------ src/server/server.ts | 24 +++-------------- 3 files changed, 7 insertions(+), 56 deletions(-) diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 2e50ca59b97..9f0062cfd71 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -583,7 +583,7 @@ module Harness.LanguageService { // This host is just a proxy for the clientHost, it uses the client // host to answer server queries about files on disk var serverHost = new SessionServerHost(clientHost); - var server = new ts.server.Session(serverHost, serverHost, /*useProtocol*/ true, /*prettyJSON*/ false); + var server = new ts.server.Session(serverHost, serverHost); // Fake the connection between the client and the server serverHost.writeMessage = client.onMessage.bind(client); diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 16abbf029d7..b9eb72a78ed 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -157,7 +157,7 @@ module ts.server { immediateId: any; changeSeq = 0; - constructor(private host: ServerHost, private logger: Logger, protected useProtocol: boolean, protected prettyJSON: boolean) { + constructor(private host: ServerHost, private logger: Logger) { this.projectService = new ProjectService(host, logger); } @@ -178,13 +178,7 @@ module ts.server { } send(msg: NodeJS._debugger.Message) { - var json: string; - if (this.prettyJSON) { - json = JSON.stringify(msg, null, " "); - } - else { - json = JSON.stringify(msg); - } + var json = JSON.stringify(msg); this.sendLineToClient('Content-Length: ' + (1 + Buffer.byteLength(json, 'utf8')) + '\r\n\r\n' + json); } @@ -229,32 +223,7 @@ module ts.server { } output(info: any, cmdName: string, reqSeq = 0, errorMsg?: string) { - if (this.useProtocol) { - this.response(info, cmdName, reqSeq, errorMsg); - } - else if (this.prettyJSON) { - if (!errorMsg) { - this.sendLineToClient(JSON.stringify(info, null, " ").trim()); - } - else { - this.sendLineToClient(JSON.stringify(errorMsg)); - } - } else { - if (!errorMsg) { - var infoStr = JSON.stringify(info).trim(); - // [8 digits of length,infoStr] + '\n' - var len = infoStr.length + paddedLength + 4; - var lenStr = len.toString(); - var padLen = paddedLength - lenStr.length; - for (var i = 0; i < padLen; i++) { - lenStr = '0' + lenStr; - } - this.sendLineToClient("[" + lenStr + "," + infoStr + "]"); - } - else { - this.sendLineToClient(JSON.stringify("error: " + errorMsg)); - } - } + this.response(info, cmdName, reqSeq, errorMsg); } semanticCheck(file: string, project: Project) { diff --git a/src/server/server.ts b/src/server/server.ts index 9f06e9b0277..974fb491674 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -73,26 +73,8 @@ module ts.server { } class IOSession extends Session { - protocol: NodeJS._debugger.Protocol; - - constructor(host: ServerHost, logger: ts.server.Logger, useProtocol: boolean, prettyJSON: boolean) { - super(host, logger, useProtocol, prettyJSON); - if (useProtocol) { - this.initProtocol(); - } - } - - initProtocol() { - this.protocol = new nodeproto.Protocol(); - // note: onResponse was named by nodejs authors; we are re-purposing the Protocol - // class in this case so that it supports a server instead of a client - this.protocol.onResponse = (pkt) => { - this.handleRequest(pkt); - }; - } - - handleRequest(req: NodeJS._debugger.Packet) { - this.projectService.log("Got JSON msg:\n" + req.raw); + constructor(host: ServerHost, logger: ts.server.Logger) { + super(host, logger); } listen() { @@ -114,5 +96,5 @@ module ts.server { var logger = new Logger(__dirname + "/.log" + process.pid.toString()); // Start listening - new IOSession(ts.sys, logger, /* useProtocol */ true, /* prettyJSON */ false).listen(); + new IOSession(ts.sys, logger).listen(); } \ No newline at end of file From b1750453ada87a7037960aef74a0ae2d5643c894 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sat, 14 Feb 2015 17:21:17 -0800 Subject: [PATCH 064/162] use ts.getDefaultLibFileName to get the default library file name --- src/server/editorServices.ts | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 7007704a168..85ee71adce5 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -139,13 +139,7 @@ module ts.server { getDefaultLibFileName() { var nodeModuleBinDir = ts.getDirectoryPath(ts.normalizePath(this.host.getExecutingFilePath())); - - if (this.compilationSettings && this.compilationSettings.target == ts.ScriptTarget.ES6) { - return nodeModuleBinDir + "/lib.es6.d.ts"; - } - else { - return nodeModuleBinDir + "/lib.d.ts"; - } + return ts.combinePaths(nodeModuleBinDir, ts.getDefaultLibFileName(this.compilationSettings)); } cancel() { From ce828d0caec6fd92924fa640035ed76a6c5474d7 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sat, 14 Feb 2015 17:21:49 -0800 Subject: [PATCH 065/162] Get details for member completions as well as completions matching prefix --- src/server/protocol.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/server/protocol.ts b/src/server/protocol.ts index b9eb72a78ed..1efc79c5c40 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -536,8 +536,8 @@ module ts.server { throw Errors.NoContent; } - return completions.entries.reduce((accum: ts.CompletionEntryDetails[], entry: ts.CompletionEntry) => { - if (entry.name.indexOf(prefix) == 0) { + return completions.entries.reduce((result: ts.CompletionEntryDetails[], entry: ts.CompletionEntry) => { + if (completions.isMemberCompletion || entry.name.indexOf(prefix) == 0) { var protoEntry = {}; protoEntry.name = entry.name; protoEntry.kind = entry.kind; @@ -551,9 +551,9 @@ module ts.server { if (details && (details.displayParts) && (details.displayParts.length > 0)) { protoEntry.displayParts = details.documentation; } - accum.push(protoEntry); + result.push(protoEntry); } - return accum; + return result; }, []); } From 89267bcd6fb967a6273a41ad51fbbc7445d6df24 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sat, 14 Feb 2015 19:53:12 -0800 Subject: [PATCH 066/162] Move fileWatching logic to the server to allow for testing on non-node systems --- src/compiler/sys.ts | 9 -- src/harness/harnessLanguageService.ts | 30 +---- src/server/editorServices.ts | 179 +++++++------------------- src/server/server.ts | 119 +++++++++++++++++ 4 files changed, 169 insertions(+), 168 deletions(-) diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index c666ca991cf..5f10a747d42 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -18,8 +18,6 @@ module ts { readDirectory(path: string, extension?: string): string[]; getMemoryUsage? (): number; exit(exitCode?: number): void; - getModififedTime? (fileName: string): Date; - stat? (fileName: string, callback?: (err: any, stats: any) => any): void; } export interface FileWatcher { @@ -305,13 +303,6 @@ module ts { }, exit(exitCode?: number): void { process.exit(exitCode); - }, - getModififedTime(fileName: string): Date { - var stats = _fs.statSync(fileName); - return stats.mtime; - }, - stat(fileName: string, callback?: (err: any, stats: any) => any) { - _fs.stat(fileName, callback); } }; } diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 9f0062cfd71..712f0afe0aa 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -488,6 +488,10 @@ module Harness.LanguageService { } readFile(fileName: string): string { + if (fileName.indexOf(Harness.Compiler.defaultLibFileName) >= 0) { + fileName = Harness.Compiler.defaultLibFileName; + } + var snapshot = this.host.getScriptSnapshot(fileName); return snapshot && snapshot.getText(0, snapshot.getLength()); } @@ -525,29 +529,9 @@ module Harness.LanguageService { readDirectory(path: string, extension?: string): string[] { throw new Error("Not implemented Yet."); } - - getModififedTime(fileName: string): Date { - return new Date(); - } - - stat(path: string, callback?: (err: any, stats: any) => any) { - return 0; - } - - lineColToPosition(fileName: string, line: number, col: number): number { - return this.host.lineColToPosition(fileName, line, col); - } - - positionToZeroBasedLineCol(fileName: string, position: number): ts.LineAndCharacter { - return this.host.positionToZeroBasedLineCol(fileName, position); - } - - getFileLength(fileName: string): number { - return this.host.getScriptSnapshot(fileName).getLength(); - } - - getFileNames(): string[] { - return this.host.getScriptFileNames(); + + watchFile(fileName: string, callback: (fileName: string) => void): ts.FileWatcher { + return { close() { } }; } close(): void { diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 85ee71adce5..9e6363b509f 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -62,18 +62,15 @@ module ts.server { children: ScriptInfo[] = []; // files referenced by this file defaultProject: Project; // project to use by default for file - mtime: Date; - constructor(private host: ServerHost, public filename: string, public content: string, public isOpen = false) { + fileWatcher: FileWatcher; + + constructor(private host: ServerHost, public fileName: string, public content: string, public isOpen = false) { this.svc = ScriptVersionCache.fromString(content); - if (!isOpen) { - this.mtime = this.host.getModififedTime(filename); - } } close() { this.isOpen = false; - this.mtime = this.host.getModififedTime(this.filename); } addChild(childInfo: ScriptInfo) { @@ -203,7 +200,7 @@ module ts.server { removeReferencedFile(info: ScriptInfo) { if (!info.isOpen) { - this.filenameToScript[info.filename] = undefined; + this.filenameToScript[info.fileName] = undefined; } } @@ -212,7 +209,7 @@ module ts.server { if (!scriptInfo) { scriptInfo = this.project.openReferencedFile(filename); if (scriptInfo) { - this.filenameToScript[scriptInfo.filename] = scriptInfo; + this.filenameToScript[scriptInfo.fileName] = scriptInfo; } } else { @@ -221,9 +218,9 @@ module ts.server { } addRoot(info: ScriptInfo) { - var scriptInfo = ts.lookUp(this.filenameToScript, info.filename); + var scriptInfo = ts.lookUp(this.filenameToScript, info.fileName); if (!scriptInfo) { - this.filenameToScript[info.filename] = info; + this.filenameToScript[info.fileName] = info; return info; } } @@ -363,7 +360,7 @@ module ts.server { } getSourceFile(info: ScriptInfo) { - return this.filenameToSourceFile[info.filename]; + return this.filenameToSourceFile[info.fileName]; } getSourceFileFromName(filename: string) { @@ -439,112 +436,6 @@ module ts.server { return copiedList; } - // REVIEW: for now this implementation uses polling. - // The advantage of polling is that it works reliably - // on all os and with network mounted files. - // For 90 referenced files, the average time to detect - // changes is 2*msInterval (by default 5 seconds). - // The overhead of this is .04 percent (1/2500) with - // average pause of < 1 millisecond (and max - // pause less than 1.5 milliseconds); question is - // do we anticipate reference sets in the 100s and - // do we care about waiting 10-20 seconds to detect - // changes for large reference sets? If so, do we want - // to increase the chunk size or decrease the interval - // time dynamically to match the large reference set? - export class WatchedFileSet { - watchedFiles: ScriptInfo[] = []; - nextFileToCheck = 0; - watchTimer: NodeJS.Timer; - - // average async stat takes about 30 microseconds - // set chunk size to do 30 files in < 1 millisecond - constructor(private host: ServerHost, public fileEvent: (info: ScriptInfo, eventName: string) => void, - public msInterval = 2500, public chunkSize = 30) { - } - - checkWatchedFileChanged(checkedIndex: number, stats: NodeJS.fs.Stats) { - var info = this.watchedFiles[checkedIndex]; - if (info && (!info.isOpen)) { - if (info.mtime.getTime() != stats.mtime.getTime()) { - info.svc.reloadFromFile(info.filename); - } - } - } - - fileDeleted(info: ScriptInfo) { - if (this.fileEvent) { - this.fileEvent(info, "deleted"); - } - } - - static fileDeleted = 34; - - poll(checkedIndex: number) { - var watchedFile = this.watchedFiles[checkedIndex]; - if (!watchedFile) { - return; - } - if (measurePerf) { - var start = process.hrtime(); - } - this.host.stat(watchedFile.filename,(err, stats) => { - if (err) { - var msg = err.message; - if (err.errno) { - msg += " errno: " + err.errno.toString(); - } - if (err.errno == WatchedFileSet.fileDeleted) { - this.fileDeleted(watchedFile); - } - } - else { - this.checkWatchedFileChanged(checkedIndex, stats); - } - }); - if (measurePerf) { - var elapsed = process.hrtime(start); - var elapsedNano = 1e9 * elapsed[0] + elapsed[1]; - } - } - - // this implementation uses polling and - // stat due to inconsistencies of fs.watch - // and efficiency of stat on modern filesystems - startWatchTimer() { - this.watchTimer = setInterval(() => { - var count = 0; - var nextToCheck = this.nextFileToCheck; - var firstCheck = -1; - while ((count < this.chunkSize) && (nextToCheck != firstCheck)) { - this.poll(nextToCheck); - if (firstCheck < 0) { - firstCheck = nextToCheck; - } - nextToCheck++; - if (nextToCheck == this.watchedFiles.length) { - nextToCheck = 0; - } - count++; - } - this.nextFileToCheck = nextToCheck; - }, this.msInterval); - } - - // TODO: remove watch file if opened by editor or no longer referenced - // assume normalized and absolute pathname - addFile(info: ScriptInfo) { - this.watchedFiles.push(info); - if (this.watchedFiles.length == 1) { - this.startWatchTimer(); - } - } - - removeFile(info: ScriptInfo) { - this.watchedFiles = copyListRemovingItem(info, this.watchedFiles); - } - } - interface ProjectServiceEventHandler { (eventName: string, project: Project): void; } @@ -556,20 +447,32 @@ module ts.server { openFilesReferenced: ScriptInfo[] = []; // projects covering open files inferredProjects: Project[] = []; - watchedFileSet: WatchedFileSet; constructor(public host: ServerHost, public psLogger: Logger, public eventHandler?: ProjectServiceEventHandler) { if (measurePerf) { calibrateTimer(); } ts.disableIncrementalParsing = true; - this.watchedFileSet = new WatchedFileSet(this.host,(info, eventName) => { - if (eventName == "deleted") { - this.fileDeletedInFilesystem(info); - } - }); } + watchedFileChanged(fileName: string) { + var info = this.filenameToScriptInfo[fileName]; + if (!info) { + this.psLogger.info("Error: got watch notification for unknown file: " + fileName); + } + + if (!this.host.fileExists(fileName)) { + // File was deleted + this.fileDeletedInFilesystem(info); + } + else { + if (info && (!info.isOpen)) { + info.svc.reloadFromFile(info.fileName); + } + } + } + + log(msg: string, type = "Err") { this.psLogger.msg(msg, type); } @@ -587,11 +490,15 @@ module ts.server { } fileDeletedInFilesystem(info: ScriptInfo) { - this.psLogger.info(info.filename + " deleted"); - this.watchedFileSet.removeFile(info); + this.psLogger.info(info.fileName + " deleted"); + + if (info.fileWatcher) { + info.fileWatcher.close(); + info.fileWatcher = undefined; + } if (!info.isOpen) { - this.filenameToScriptInfo[info.filename] = undefined; + this.filenameToScriptInfo[info.fileName] = undefined; var referencingProjects = this.findReferencingProjects(info); for (var i = 0, len = referencingProjects.length; i < len; i++) { referencingProjects[i].removeReferencedFile(info); @@ -697,13 +604,13 @@ module ts.server { /** * @param filename is absolute pathname */ - openFile(filename: string, openedByClient = false) { - filename = ts.normalizePath(filename); - var info = ts.lookUp(this.filenameToScriptInfo, filename); + openFile(fileName: string, openedByClient = false) { + fileName = ts.normalizePath(fileName); + var info = ts.lookUp(this.filenameToScriptInfo, fileName); if (!info) { var content: string; - if (this.host.fileExists(filename)) { - content = this.host.readFile(filename); + if (this.host.fileExists(fileName)) { + content = this.host.readFile(fileName); } if (!content) { if (openedByClient) { @@ -711,10 +618,10 @@ module ts.server { } } if (content !== undefined) { - info = new ScriptInfo(this.host, filename, content, openedByClient); - this.filenameToScriptInfo[filename] = info; + info = new ScriptInfo(this.host, fileName, content, openedByClient); + this.filenameToScriptInfo[fileName] = info; if (!info.isOpen) { - this.watchedFileSet.addFile(info); + info.fileWatcher = this.host.watchFile(fileName, _ => { this.watchedFileChanged(fileName); }); } } } @@ -800,11 +707,11 @@ module ts.server { } this.psLogger.info("Open file roots: ") for (var i = 0, len = this.openFileRoots.length; i < len; i++) { - this.psLogger.info(this.openFileRoots[i].filename); + this.psLogger.info(this.openFileRoots[i].fileName); } this.psLogger.info("Open files referenced: ") for (var i = 0, len = this.openFilesReferenced.length; i < len; i++) { - this.psLogger.info(this.openFilesReferenced[i].filename); + this.psLogger.info(this.openFilesReferenced[i].fileName); } this.psLogger.endGroup(); } diff --git a/src/server/server.ts b/src/server/server.ts index 974fb491674..6d210ff0d13 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -72,6 +72,102 @@ module ts.server { } } + interface WatchedFile { + fileName: string; + callback: (fileName: string) => void; + mtime: Date; + } + + class WatchedFileSet { + private watchedFiles: WatchedFile[] = []; + private nextFileToCheck = 0; + private watchTimer: NodeJS.Timer; + private static fileDeleted = 34; + + // average async stat takes about 30 microseconds + // set chunk size to do 30 files in < 1 millisecond + constructor(public interval = 2500, public chunkSize = 30) { + } + + private static copyListRemovingItem(item: T, list: T[]) { + var copiedList: T[] = []; + for (var i = 0, len = list.length; i < len; i++) { + if (list[i] != item) { + copiedList.push(list[i]); + } + } + return copiedList; + } + + private static getModifiedTime(fileName: string): Date { + return fs.statSync(fileName).mtime; + } + + private poll(checkedIndex: number) { + var watchedFile = this.watchedFiles[checkedIndex]; + if (!watchedFile) { + return; + } + + fs.stat(watchedFile.fileName,(err, stats) => { + if (err) { + var msg = err.message; + if (err.errno) { + msg += " errno: " + err.errno.toString(); + } + if (err.errno == WatchedFileSet.fileDeleted) { + watchedFile.callback(watchedFile.fileName); + } + } + else if (watchedFile.mtime.getTime() != stats.mtime.getTime()) { + watchedFile.mtime = WatchedFileSet.getModifiedTime(watchedFile.fileName); + watchedFile.callback(watchedFile.fileName); + } + }); + } + + // this implementation uses polling and + // stat due to inconsistencies of fs.watch + // and efficiency of stat on modern filesystems + private startWatchTimer() { + this.watchTimer = setInterval(() => { + var count = 0; + var nextToCheck = this.nextFileToCheck; + var firstCheck = -1; + while ((count < this.chunkSize) && (nextToCheck != firstCheck)) { + this.poll(nextToCheck); + if (firstCheck < 0) { + firstCheck = nextToCheck; + } + nextToCheck++; + if (nextToCheck === this.watchedFiles.length) { + nextToCheck = 0; + } + count++; + } + this.nextFileToCheck = nextToCheck; + }, this.interval); + } + + addFile(fileName: string, callback: (fileName: string) => void ): WatchedFile { + var file: WatchedFile = { + fileName, + callback, + mtime: WatchedFileSet.getModifiedTime(fileName) + }; + + this.watchedFiles.push(file); + if (this.watchedFiles.length === 1) { + this.startWatchTimer(); + } + return file; + } + + removeFile(file: WatchedFile) { + this.watchedFiles = WatchedFileSet.copyListRemovingItem(file, this.watchedFiles); + } + } + class IOSession extends Session { constructor(host: ServerHost, logger: ts.server.Logger) { super(host, logger); @@ -95,6 +191,29 @@ module ts.server { // TODO: check that this location is writable var logger = new Logger(__dirname + "/.log" + process.pid.toString()); + + // REVIEW: for now this implementation uses polling. + // The advantage of polling is that it works reliably + // on all os and with network mounted files. + // For 90 referenced files, the average time to detect + // changes is 2*msInterval (by default 5 seconds). + // The overhead of this is .04 percent (1/2500) with + // average pause of < 1 millisecond (and max + // pause less than 1.5 milliseconds); question is + // do we anticipate reference sets in the 100s and + // do we care about waiting 10-20 seconds to detect + // changes for large reference sets? If so, do we want + // to increase the chunk size or decrease the interval + // time dynamically to match the large reference set? + var watchedFileSet = new WatchedFileSet(); + ts.sys.watchFile = function (fileName, callback) { + var watchedFile = watchedFileSet.addFile(fileName, callback); + return { + close: () => watchedFileSet.removeFile(watchedFile) + } + + }; + // Start listening new IOSession(ts.sys, logger).listen(); } \ No newline at end of file From d396ddfa7b211216752647419dfc65f6f80a93cc Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sat, 14 Feb 2015 19:53:23 -0800 Subject: [PATCH 067/162] Add test for completions --- src/server/client.ts | 3 ++- tests/cases/fourslash/server/completions.ts | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/server/completions.ts diff --git a/src/server/client.ts b/src/server/client.ts index 1aa7547f541..aa1ddb34bf7 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -177,10 +177,11 @@ module ts.server { getCompletionsAtPosition(fileName: string, position: number): CompletionInfo { var lineCol = this.positionToOneBasedLineCol(fileName, position); - var args: ServerProtocol.CodeLocationRequestArgs = { + var args: ServerProtocol.CompletionsRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, + prefix: undefined }; var request = this.processRequest(CommandNames.Completions, args); diff --git a/tests/cases/fourslash/server/completions.ts b/tests/cases/fourslash/server/completions.ts new file mode 100644 index 00000000000..82d3b5b2400 --- /dev/null +++ b/tests/cases/fourslash/server/completions.ts @@ -0,0 +1,17 @@ +/// + +////var x: string[] = []; +////x.forEach(function (y) { y/*1*/ +////x.forEach(y => y/*2*/ + +goTo.marker('1'); +edit.insert('.'); +verify.memberListContains('trim'); +verify.memberListCount(20); +edit.insert('});'); // need the following lines to not have parse errors in order for completion list to appear + +goTo.marker('2'); +edit.insert('.'); +verify.memberListContains('trim'); +verify.memberListCount(20); + \ No newline at end of file From 9867e062a2b3a0d2a8850ee6aef9654c01cb9056 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sat, 14 Feb 2015 20:23:16 -0800 Subject: [PATCH 068/162] Add a new definition test --- tests/cases/fourslash/server/definition.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 tests/cases/fourslash/server/definition.ts diff --git a/tests/cases/fourslash/server/definition.ts b/tests/cases/fourslash/server/definition.ts new file mode 100644 index 00000000000..531e4562843 --- /dev/null +++ b/tests/cases/fourslash/server/definition.ts @@ -0,0 +1,12 @@ +/// + +// @Filename: b.ts +////import n = require('a/*1*/'); +////var x = new n.Foo(); + +// @Filename: a.ts +//// /*2*/export class Foo {} + +goTo.marker('1'); +goTo.definition(); +verify.caretAtMarker('2'); \ No newline at end of file From 11e246036bf962d0f7d6a7ac1ac12e8df46fe1cc Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sat, 14 Feb 2015 21:49:10 -0800 Subject: [PATCH 069/162] Add test for find references --- src/server/client.ts | 2 +- src/server/protocol.ts | 1 + src/server/protodef.d.ts | 3 +++ tests/cases/fourslash/server/references.ts | 18 ++++++++++++++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/server/references.ts diff --git a/src/server/client.ts b/src/server/client.ts index aa1ddb34bf7..3295ec76193 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -301,7 +301,7 @@ module ts.server { return { fileName: entry.file, textSpan: ts.createTextSpanFromBounds(start, end), - isWriteAccess: false, + isWriteAccess: entry.isWriteAccess, }; }); } diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 1efc79c5c40..3e28806b696 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -409,6 +409,7 @@ module ts.server { start: start, lineText: lineText, end: compilerService.host.positionToLineCol(ref.fileName, ts.textSpanEnd(ref.textSpan)), + isWriteAccess: ref.isWriteAccess }; }).sort(compareFileStart); return { diff --git a/src/server/protodef.d.ts b/src/server/protodef.d.ts index 95e671f561e..b68616a13ec 100644 --- a/src/server/protodef.d.ts +++ b/src/server/protodef.d.ts @@ -127,6 +127,9 @@ declare module ServerProtocol { loaded the referencing files). */ lineText: string; + + /** True if reference is a write location, false otherwise. */ + isWriteAccess: boolean; } /** The body of a "references" response message. */ diff --git a/tests/cases/fourslash/server/references.ts b/tests/cases/fourslash/server/references.ts new file mode 100644 index 00000000000..55b21615551 --- /dev/null +++ b/tests/cases/fourslash/server/references.ts @@ -0,0 +1,18 @@ +/// + +// Global class reference. + +// @Filename: referencesForGlobals_1.ts +////class /*2*/globalClass { +//// public f() { } +////} + +// @Filename: referencesForGlobals_2.ts +/////// +////var c = /*1*/globalClass(); + +goTo.marker("1"); +verify.referencesCountIs(2); + +goTo.marker("2"); +verify.referencesCountIs(2); \ No newline at end of file From 178e8f76e65f3c0971a1015753d0c6f11ea2e52f Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sat, 14 Feb 2015 22:28:38 -0800 Subject: [PATCH 070/162] Add test for quickInfo --- src/server/client.ts | 11 +++++---- tests/cases/fourslash/server/quickinfo.ts | 27 +++++++++++++++++++++++ 2 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 tests/cases/fourslash/server/quickinfo.ts diff --git a/src/server/client.ts b/src/server/client.ts index 3295ec76193..599de2d8505 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -152,10 +152,11 @@ module ts.server { } getQuickInfoAtPosition(fileName: string, position: number): QuickInfo { + var lineCol = this.positionToOneBasedLineCol(fileName, position); var args: ServerProtocol.CodeLocationRequestArgs = { file: fileName, - line: 0, - col: 1 + line: lineCol.line, + col: lineCol.col }; var request = this.processRequest(CommandNames.Quickinfo, args); @@ -168,10 +169,8 @@ module ts.server { kind: response.body.kind, kindModifiers: response.body.kindModifiers, textSpan: ts.createTextSpanFromBounds(start, end), - displayParts: undefined, - documentation: undefined, - documentationString: response.body.documentation, - displayString: response.body.displayString + displayParts: [{ kind: "text", text: response.body.displayString }], + documentation: [{ kind: "text", text: response.body.documentation }] }; } diff --git a/tests/cases/fourslash/server/quickinfo.ts b/tests/cases/fourslash/server/quickinfo.ts new file mode 100644 index 00000000000..b5c7dc0a01c --- /dev/null +++ b/tests/cases/fourslash/server/quickinfo.ts @@ -0,0 +1,27 @@ +/// + +////interface One { +//// commonProperty: number; +//// commonFunction(): number; +////} +//// +////interface Two { +//// commonProperty: string +//// commonFunction(): number; +////} +//// +////var /*1*/x : One | Two; +//// +////x./*2*/commonProperty; +////x./*3*/commonFunction; + + +goTo.marker("1"); +verify.quickInfoIs('(var) x: One | Two'); + + +goTo.marker("2"); +verify.quickInfoIs('(property) commonProperty: string | number'); + +goTo.marker("3"); +verify.quickInfoIs('(method) commonFunction(): number'); From 40d3cb78d50bc5adc262442c61d8e9609f856910 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sat, 14 Feb 2015 23:07:20 -0800 Subject: [PATCH 071/162] Add test for rename --- src/server/client.ts | 45 ++++++++++++++++++++- src/server/protocol.ts | 55 ++++++-------------------- src/server/protodef.d.ts | 7 ++++ tests/cases/fourslash/server/rename.ts | 11 ++++++ 4 files changed, 73 insertions(+), 45 deletions(-) create mode 100644 tests/cases/fourslash/server/rename.ts diff --git a/src/server/client.ts b/src/server/client.ts index 599de2d8505..960c0723c30 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -322,11 +322,52 @@ module ts.server { } getRenameInfo(fileName: string, position: number): RenameInfo { - throw new Error("Not Implemented Yet."); + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: ServerProtocol.RenameRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col + }; + + var request = this.processRequest(CommandNames.Rename, args); + var response = this.processResponse(request); + + return { + canRename: response.body.info.canRename, + displayName: response.body.info.displayName, + fullDisplayName: response.body.info.fullDisplayName, + kind: response.body.info.kind, + kindModifiers: response.body.info.kindModifiers, + localizedErrorMessage: response.body.info.localizedErrorMessage, + triggerSpan: ts.createTextSpanFromBounds(position, position) + }; } findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[] { - throw new Error("Not Implemented Yet."); + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: ServerProtocol.RenameRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + findInStrings, + findInComments + }; + + var request = this.processRequest(CommandNames.Rename, args); + var response = this.processResponse(request); + + if (!response.body.info.canRename) { + return []; + } + + return response.body.locs.map((entry) => { + var start = this.lineColToPosition(entry.file, entry.start); + var end = this.lineColToPosition(entry.file, entry.end); + return { + textSpan: ts.createTextSpanFromBounds(start, end), + fileName: entry.file + }; + }); } getNavigationBarItems(fileName: string): NavigationBarItem[] { diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 3e28806b696..1404b3ea4b1 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -307,7 +307,7 @@ module ts.server { })); } - rename(line: number, col: number, fileName: string): { info: RenameInfo; locs: ServerProtocol.CodeSpan[] } { + rename(line: number, col: number, fileName: string, findInComments: boolean, findInStrings: boolean): { info: RenameInfo; locs: ServerProtocol.CodeSpan[] } { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -328,48 +328,17 @@ module ts.server { }; } - var renameLocs = compilerService.languageService.findRenameLocations(file, position, false, false); - if (renameLocs) { - var bakedRenameLocs = renameLocs.map(loc=> ({ - file: loc.fileName, - start: compilerService.host.positionToLineCol(loc.fileName, loc.textSpan.start), - end: compilerService.host.positionToLineCol(loc.fileName, ts.textSpanEnd(loc.textSpan)), - })).sort((a, b) => { - if (a.file < b.file) { - return -1; - } - else if (a.file > b.file) { - return 1; - } - else { - // reverse sort assuming no overlap - if (a.start.line < b.start.line) { - return 1; - } - else if (a.start.line > b.start.line) { - return -1; - } - else { - return b.start.col - a.start.col; - } - } - }).reduce((accum, cur) => { - var curFileAccum: FileRanges; - if (accum.length > 0) { - curFileAccum = accum[accum.length - 1]; - if (curFileAccum.file != cur.file) { - curFileAccum = undefined; - } - } - if (!curFileAccum) { - curFileAccum = { file: cur.file, locs: [] }; - accum.push(curFileAccum); - } - curFileAccum.locs.push({ start: cur.start, end: cur.end }); - return accum; - }, []); + var renameLocs = compilerService.languageService.findRenameLocations(file, position, findInStrings, findInComments); + if (!renameLocs) { + throw Errors.NoContent; } + var bakedRenameLocs = renameLocs.map(loc => ({ + file: loc.fileName, + start: compilerService.host.positionToLineCol(loc.fileName, loc.textSpan.start), + end: compilerService.host.positionToLineCol(loc.fileName, ts.textSpanEnd(loc.textSpan)), + })); + return { info: renameInfo, locs: bakedRenameLocs }; } @@ -731,8 +700,8 @@ module ts.server { break; } case CommandNames.Rename: { - var renameArgs = request.arguments; - response = this.rename(renameArgs.line, renameArgs.col, renameArgs.file); + var renameArgs = request.arguments; + response = this.rename(renameArgs.line, renameArgs.col, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings); break; } case CommandNames.Open: { diff --git a/src/server/protodef.d.ts b/src/server/protodef.d.ts index b68616a13ec..fb88d30d2ef 100644 --- a/src/server/protodef.d.ts +++ b/src/server/protodef.d.ts @@ -151,6 +151,12 @@ declare module ServerProtocol { body?: ReferencesResponseBody; } + export interface RenameRequestArgs extends CodeLocationRequestArgs { + findInComments?: boolean; + findInStrings?: boolean; + } + + /** Rename request; value of command field is "rename". Return response giving the code locations that reference the symbol @@ -158,6 +164,7 @@ declare module ServerProtocol { name of the symbol so that client can print it unambiguously. */ export interface RenameRequest extends CodeLocationRequest { + arguments: RenameRequestArgs; } /** Information about the item to be renamed. */ diff --git a/tests/cases/fourslash/server/rename.ts b/tests/cases/fourslash/server/rename.ts new file mode 100644 index 00000000000..4f8b7b98cd4 --- /dev/null +++ b/tests/cases/fourslash/server/rename.ts @@ -0,0 +1,11 @@ +/// + +/////// + +////function /**/[|Bar|]() { +//// // This is a reference to [|Bar|] in a comment. +//// "this is a reference to [|Bar|] in a string" +////} + +goTo.marker(); +verify.renameLocations(/*findInStrings:*/ true, /*findInComments:*/ true); \ No newline at end of file From 2a02655f728be9b3d54e1b5c783ed588c280399f Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sun, 15 Feb 2015 16:23:36 -0800 Subject: [PATCH 072/162] Add navbar test --- src/harness/fourslash.ts | 2 +- src/server/client.ts | 26 ++++++++- src/server/protocol.ts | 78 +++++++++++++------------- src/server/protodef.d.ts | 28 +++++++++ tests/cases/fourslash/server/navbar.ts | 52 +++++++++++++++++ 5 files changed, 144 insertions(+), 42 deletions(-) create mode 100644 tests/cases/fourslash/server/navbar.ts diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index bc7a8718a76..bb144742f45 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -1932,7 +1932,7 @@ module FourSlash { } var missingItem = { name: name, kind: kind }; - this.raiseError('verifyGetScriptLexicalStructureListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(items) + ')'); + this.raiseError('verifyGetScriptLexicalStructureListContains failed - could not find the item: ' + JSON.stringify(missingItem) + ' in the returned list: (' + JSON.stringify(items, null, " ") + ')'); } private navigationBarItemsContains(items: ts.NavigationBarItem[], name: string, kind: string) { diff --git a/src/server/client.ts b/src/server/client.ts index 960c0723c30..d23bc5c7359 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -370,8 +370,32 @@ module ts.server { }); } + decodeNavigationBarItems(items: ServerProtocol.NavigationBarItem[], fileName: string): NavigationBarItem[] { + if (!items) { + return []; + } + + return items.map(item => ({ + text: item.text, + kind: item.kind, + kindModifiers: item.kindModifiers || "", + spans: item.spans.map(span=> createTextSpanFromBounds(this.lineColToPosition(fileName, span.start), this.lineColToPosition(fileName, span.end))), + childItems: this.decodeNavigationBarItems(item.childItems, fileName), + indent: 0, + bolded: false, + grayed: false + })); + } + getNavigationBarItems(fileName: string): NavigationBarItem[] { - throw new Error("Not Implemented Yet."); + var args: ServerProtocol.FileRequestArgs = { + file: fileName + }; + + var request = this.processRequest(CommandNames.NavBar, args); + var response = this.processResponse(request); + + return this.decodeNavigationBarItems(response.body, fileName); } getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan { diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 1404b3ea4b1..0e6a0ff8f65 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -4,13 +4,6 @@ /// /// -module ts { - export interface NavigationBarItem { - displayString?: string; - docString?: string; - } -} - module ts.server { var paddedLength = 8; @@ -129,6 +122,7 @@ module ts.server { export var Format = "format"; export var Formatonkey = "formatonkey"; export var Geterr = "geterr"; + export var NavBar = "navbar"; export var Navto = "navto"; export var Open = "open"; export var Quickinfo = "quickinfo"; @@ -426,7 +420,7 @@ module ts.server { if (!project) { throw Errors.NoProject; } - + var compilerService = project.compilerService; var startPosition = compilerService.host.lineColToPosition(file, line, col); var endPosition = compilerService.host.lineColToPosition(file, endLine, endCol); @@ -436,7 +430,7 @@ module ts.server { if (!edits) { throw Errors.NoContent; } - + return edits.map((edit) => { return { start: compilerService.host.positionToLineCol(file, edit.span.start), @@ -500,7 +494,7 @@ module ts.server { var compilerService = project.compilerService; var position = compilerService.host.lineColToPosition(file, line, col); - + var completions = compilerService.languageService.getCompletionsAtPosition(file, position); if (!completions) { throw Errors.NoContent; @@ -526,7 +520,7 @@ module ts.server { return result; }, []); } - + geterr(delay: number, fileNames: string[]) { var checkList = fileNames.reduce((accum: PendingErrorCheck[], fileName: string) => { fileName = ts.normalizePath(fileName); @@ -587,40 +581,39 @@ module ts.server { this.projectService.closeClientFile(file); } - decorateNavBarItem(navBarItem: ts.NavigationBarItem, compilerService: CompilerService, file: string) { - if (navBarItem.spans.length == 1) { - var span = navBarItem.spans[0]; - var offset = span.start; - var textForSpan = compilerService.host.getScriptSnapshot(file).getText(offset, offset + span.length); - var adj = textForSpan.indexOf(navBarItem.text); - if (adj > 0) { - offset += adj; - } - var quickInfo = compilerService.languageService.getQuickInfoAtPosition(file, - offset + (navBarItem.text.length / 2)); - if (quickInfo) { - var displayString = ts.displayPartsToString(quickInfo.displayParts); - var docString = ts.displayPartsToString(quickInfo.documentation); - navBarItem.displayString = displayString; - navBarItem.docString = docString; - } + decorateNavigationBarItem(project: Project, fileName: string, items: ts.NavigationBarItem[]): ServerProtocol.NavigationBarItem[] { + if (!items) { + return undefined; } - if (navBarItem.childItems.length > 0) { - navBarItem.childItems = - navBarItem.childItems.map(navBarItem => this.decorateNavBarItem(navBarItem, compilerService, file)); - } - return navBarItem; + + var compilerService = project.compilerService; + + return items.map(item => ({ + text: item.text, + kind: item.kind, + kindModifiers: item.kindModifiers, + spans: item.spans.map(span => ({ + start: compilerService.host.positionToLineCol(fileName, span.start), + end: compilerService.host.positionToLineCol(fileName, ts.textSpanEnd(span)) + })), + childItems: this.decorateNavigationBarItem(project, fileName, item.childItems) + })); } - navbar(rawfile: string, reqSeq = 0) { - var file = ts.normalizePath(rawfile); + navbar(fileName: string): ServerProtocol.NavigationBarItem[] { + var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); - if (project) { - var compilerService = project.compilerService; - var navBarItems = compilerService.languageService.getNavigationBarItems(file); - var bakedNavBarItems = navBarItems.map(navBarItem => this.decorateNavBarItem(navBarItem, compilerService, file)); - this.sendLineToClient(JSON.stringify(bakedNavBarItems, null, " ")); + if (!project) { + throw Errors.NoProject; } + + var compilerService = project.compilerService; + var items = compilerService.languageService.getNavigationBarItems(file); + if (!items) { + throw Errors.NoContent; + } + + return this.decorateNavigationBarItem(project, fileName, items); } navto(searchTerm: string, fileName: string): ServerProtocol.NavtoItem[] { @@ -765,6 +758,11 @@ module ts.server { response = this.getBraceMatching(braceArguments.line, braceArguments.col, braceArguments.file); break; } + case CommandNames.NavBar: { + var navBarArgs = request.arguments; + response = this.navbar(navBarArgs.file); + break; + } default: { this.projectService.log("Unrecognized JSON command: " + message); this.output(undefined, CommandNames.Unknown, request.seq, "Unrecognized JSON command: " + request.command); diff --git a/src/server/protodef.d.ts b/src/server/protodef.d.ts index fb88d30d2ef..12fd7163c1a 100644 --- a/src/server/protodef.d.ts +++ b/src/server/protodef.d.ts @@ -562,6 +562,34 @@ declare module ServerProtocol { export interface BraceRequest extends CodeLocationRequest { } + /** + NavBar itesm request; value of command field is "navbar". + Return response giving the list of navigation bar entries + extracted from the requested file. + */ + export interface NavBarRequest extends FileRequest { + } + + export interface NavigationBarItem { + /** The item's display text */ + text: string; + + /** The symbol's kind (such as 'className' or 'parameterName') */ + kind: string; + + /** Optional modifiers for the kind (such as 'public') */ + kindModifiers?: string; + + /** The definition locations of the item */ + spans: TextSpan[]; + + /** Optional children */ + childItems?: NavigationBarItem[]; + } + + export interface NavBarResponse extends Response { + body?: NavigationBarItem[]; + } } diff --git a/tests/cases/fourslash/server/navbar.ts b/tests/cases/fourslash/server/navbar.ts new file mode 100644 index 00000000000..e18f49c1db9 --- /dev/null +++ b/tests/cases/fourslash/server/navbar.ts @@ -0,0 +1,52 @@ +/// + +////// Interface +////{| "itemName": "IPoint", "kind": "interface", "parentName": "" |}interface IPoint { +//// {| "itemName": "getDist", "kind": "method", "parentName": "IPoint" |}getDist(): number; +//// {| "itemName": "new()", "kind": "construct", "parentName": "IPoint" |}new(): IPoint; +//// {| "itemName": "()", "kind": "call", "parentName": "IPoint" |}(): any; +//// {| "itemName": "[]", "kind": "index", "parentName": "IPoint" |}[x:string]: number; +//// {| "itemName": "prop", "kind": "property", "parentName": "IPoint" |}prop: string; +////} +//// +/////// Module +////{| "itemName": "Shapes", "kind": "module", "parentName": "" |}module Shapes { +//// +//// // Class +//// {| "itemName": "Point", "kind": "class", "parentName": "Shapes" |}export class Point implements IPoint { +//// {| "itemName": "constructor", "kind": "constructor", "parentName": "Shapes.Point" |}constructor (public x: number, public y: number) { } +//// +//// // Instance member +//// {| "itemName": "getDist", "kind": "method", "parentName": "Shapes.Point" |}getDist() { return Math.sqrt(this.x * this.x + this.y * this.y); } +//// +//// // Getter +//// {| "itemName": "value", "kind": "getter", "parentName": "Shapes.Point" |}get value(): number { return 0; } +//// +//// // Setter +//// {| "itemName": "value", "kind": "setter", "parentName": "Shapes.Point" |}set value(newValue: number) { return; } +//// +//// // Static member +//// {| "itemName": "origin", "kind": "property", "parentName": "Shapes.Point" |}static origin = new Point(0, 0); +//// +//// // Static method +//// {| "itemName": "getOrigin", "kind": "method", "parentName": "Shapes.Point" |}private static getOrigin() { return Point.origin;} +//// } +//// +//// {| "itemName": "Values", "kind": "enum", "parentName": "Shapes" |}enum Values { +//// value1, +//// {| "itemName": "value2", "kind": "property", "parentName": "Shapes.Values" |}value2, +//// value3, +//// } +////} +//// +////// Local variables +////{| "itemName": "p", "kind": "var", "parentName": "" |}var p: IPoint = new Shapes.Point(3, 4); +////{| "itemName": "dist", "kind": "var", "parentName": "" |}var dist = p.getDist(); + +test.markers().forEach((marker) => { + if (marker.data) { + verify.getScriptLexicalStructureListContains(marker.data.itemName, marker.data.kind, marker.fileName, marker.data.parentName); + } +}); + +verify.getScriptLexicalStructureListCount(23); From 50ca35a979c6ba8744061546b50e743c73280df2 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sun, 15 Feb 2015 16:28:39 -0800 Subject: [PATCH 073/162] Make method names inline with matching LS function names --- src/server/protocol.ts | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 0e6a0ff8f65..04b3ce065b0 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -277,7 +277,7 @@ module ts.server { } } - goToDefinition(line: number, col: number, fileName: string): ServerProtocol.CodeSpan[] { + getDefinition(line: number, col: number, fileName: string): ServerProtocol.CodeSpan[] { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -301,7 +301,7 @@ module ts.server { })); } - rename(line: number, col: number, fileName: string, findInComments: boolean, findInStrings: boolean): { info: RenameInfo; locs: ServerProtocol.CodeSpan[] } { + getRenameLocations(line: number, col: number, fileName: string, findInComments: boolean, findInStrings: boolean): { info: RenameInfo; locs: ServerProtocol.CodeSpan[] } { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -336,7 +336,7 @@ module ts.server { return { info: renameInfo, locs: bakedRenameLocs }; } - findReferences(line: number, col: number, fileName: string): ServerProtocol.ReferencesResponseBody { + getReferences(line: number, col: number, fileName: string): ServerProtocol.ReferencesResponseBody { // TODO: get all projects for this file; report refs for all projects deleting duplicates // can avoid duplicates by eliminating same ref file from subsequent projects var file = ts.normalizePath(fileName); @@ -388,7 +388,7 @@ module ts.server { this.projectService.openClientFile(file); } - quickInfo(line: number, col: number, fileName: string): ServerProtocol.QuickInfoResponseBody { + getQuickInfo(line: number, col: number, fileName: string): ServerProtocol.QuickInfoResponseBody { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -414,7 +414,7 @@ module ts.server { }; } - format(line: number, col: number, endLine: number, endCol: number, fileName: string): ServerProtocol.CodeEdit[] { + getFormattingEditsForRange(line: number, col: number, endLine: number, endCol: number, fileName: string): ServerProtocol.CodeEdit[] { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -440,7 +440,7 @@ module ts.server { }); } - formatOnKey(line: number, col: number, key: string, fileName: string): ServerProtocol.CodeEdit[] { + getFormattingEditsAfterKeystroke(line: number, col: number, key: string, fileName: string): ServerProtocol.CodeEdit[] { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); @@ -482,7 +482,7 @@ module ts.server { }); } - completions(line: number, col: number, prefix: string, fileName: string): ServerProtocol.CompletionItem[] { + getCompletions(line: number, col: number, prefix: string, fileName: string): ServerProtocol.CompletionItem[] { if (!prefix) { prefix = ""; } @@ -521,7 +521,7 @@ module ts.server { }, []); } - geterr(delay: number, fileNames: string[]) { + getDiagnostics(delay: number, fileNames: string[]) { var checkList = fileNames.reduce((accum: PendingErrorCheck[], fileName: string) => { fileName = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(fileName); @@ -600,7 +600,7 @@ module ts.server { })); } - navbar(fileName: string): ServerProtocol.NavigationBarItem[] { + getNavigationBarItems(fileName: string): ServerProtocol.NavigationBarItem[] { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -616,7 +616,7 @@ module ts.server { return this.decorateNavigationBarItem(project, fileName, items); } - navto(searchTerm: string, fileName: string): ServerProtocol.NavtoItem[] { + getNavigateToItems(searchTerm: string, fileName: string): ServerProtocol.NavtoItem[] { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -684,17 +684,17 @@ module ts.server { switch (request.command) { case CommandNames.Definition: { var defArgs = request.arguments; - response = this.goToDefinition(defArgs.line, defArgs.col, defArgs.file); + response = this.getDefinition(defArgs.line, defArgs.col, defArgs.file); break; } case CommandNames.References: { var refArgs = request.arguments; - response = this.findReferences(refArgs.line, refArgs.col, refArgs.file); + response = this.getReferences(refArgs.line, refArgs.col, refArgs.file); break; } case CommandNames.Rename: { var renameArgs = request.arguments; - response = this.rename(renameArgs.line, renameArgs.col, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings); + response = this.getRenameLocations(renameArgs.line, renameArgs.col, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings); break; } case CommandNames.Open: { @@ -704,27 +704,27 @@ module ts.server { } case CommandNames.Quickinfo: { var quickinfoArgs = request.arguments; - response = this.quickInfo(quickinfoArgs.line, quickinfoArgs.col, quickinfoArgs.file); + response = this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.col, quickinfoArgs.file); break; } case CommandNames.Format: { var formatArgs = request.arguments; - response = this.format(formatArgs.line, formatArgs.col, formatArgs.endLine, formatArgs.endCol, formatArgs.file); + response = this.getFormattingEditsForRange(formatArgs.line, formatArgs.col, formatArgs.endLine, formatArgs.endCol, formatArgs.file); break; } case CommandNames.Formatonkey: { var formatOnKeyArgs = request.arguments; - response = this.formatOnKey(formatOnKeyArgs.line, formatOnKeyArgs.col, formatOnKeyArgs.key, formatOnKeyArgs.file); + response = this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.col, formatOnKeyArgs.key, formatOnKeyArgs.file); break; } case CommandNames.Completions: { var completionsArgs = request.arguments; - response = this.completions(request.arguments.line, request.arguments.col, completionsArgs.prefix, request.arguments.file); + response = this.getCompletions(request.arguments.line, request.arguments.col, completionsArgs.prefix, request.arguments.file); break; } case CommandNames.Geterr: { var geterrArgs = request.arguments; - response = this.geterr(geterrArgs.delay, geterrArgs.files); + response = this.getDiagnostics(geterrArgs.delay, geterrArgs.files); break; } case CommandNames.Change: { @@ -750,7 +750,7 @@ module ts.server { } case CommandNames.Navto: { var navtoArgs = request.arguments; - response = this.navto(navtoArgs.searchTerm, navtoArgs.file); + response = this.getNavigateToItems(navtoArgs.searchTerm, navtoArgs.file); break; } case CommandNames.Brace: { @@ -760,7 +760,7 @@ module ts.server { } case CommandNames.NavBar: { var navBarArgs = request.arguments; - response = this.navbar(navBarArgs.file); + response = this.getNavigationBarItems(navBarArgs.file); break; } default: { From 8944df18d44da30b689ec53861d7214e534d8ee0 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sun, 15 Feb 2015 17:37:26 -0800 Subject: [PATCH 074/162] use EncodedFile everywhere in responses --- src/server/client.ts | 85 +++++++++++++++++++++++----------------- src/server/protocol.ts | 64 +++++++++++++++--------------- src/server/protodef.d.ts | 8 +++- 3 files changed, 85 insertions(+), 72 deletions(-) diff --git a/src/server/client.ts b/src/server/client.ts index d23bc5c7359..24666c8f4c7 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -6,11 +6,20 @@ module ts.server { writeMessage(message: string): void; } + interface RenameEntry extends RenameInfo { + fileName: string; + position: number; + locations: RenameLocation[]; + findInStrings: boolean; + findInComments: boolean; + } + export class SessionClient implements LanguageService { private sequence: number = 0; private fileMapping: ts.Map = {}; private lineMaps: ts.Map = {}; private messages: string[] = []; + private lastRenameEntry: RenameEntry; constructor(private host: SessionClientHost) { } @@ -54,7 +63,7 @@ module ts.server { }; } - private getFileNameFromEncodedFile(fileId: ServerProtocol.EncodedFile): string { + private decodeEncodedFileId(fileId: ServerProtocol.EncodedFile): string { var fileName: string; if (typeof fileId === "object") { fileName = (fileId).file; @@ -203,7 +212,7 @@ module ts.server { var response = this.processResponse(request); return response.body.map(entry => { - var fileName = this.getFileNameFromEncodedFile(entry.file); + var fileName = this.decodeEncodedFileId(entry.file); var start = this.lineColToPosition(fileName, entry.start); var end = this.lineColToPosition(fileName, entry.end); @@ -270,12 +279,13 @@ module ts.server { var response = this.processResponse(request); return response.body.map(entry => { + var fileName = this.decodeEncodedFileId(entry.file); var start = this.lineColToPosition(fileName, entry.start); var end = this.lineColToPosition(fileName, entry.end); return { containerKind: "", containerName: "", - fileName: entry.file, + fileName: fileName, textSpan: ts.createTextSpanFromBounds(start, end), kind: "", name: "" @@ -295,10 +305,11 @@ module ts.server { var response = this.processResponse(request); return response.body.refs.map(entry => { + var fileName = this.decodeEncodedFileId(entry.file); var start = this.lineColToPosition(fileName, entry.start); var end = this.lineColToPosition(fileName, entry.end); return { - fileName: entry.file, + fileName: fileName, textSpan: ts.createTextSpanFromBounds(start, end), isWriteAccess: entry.isWriteAccess, }; @@ -321,29 +332,7 @@ module ts.server { throw new Error("Not Implemented Yet."); } - getRenameInfo(fileName: string, position: number): RenameInfo { - var lineCol = this.positionToOneBasedLineCol(fileName, position); - var args: ServerProtocol.RenameRequestArgs = { - file: fileName, - line: lineCol.line, - col: lineCol.col - }; - - var request = this.processRequest(CommandNames.Rename, args); - var response = this.processResponse(request); - - return { - canRename: response.body.info.canRename, - displayName: response.body.info.displayName, - fullDisplayName: response.body.info.fullDisplayName, - kind: response.body.info.kind, - kindModifiers: response.body.info.kindModifiers, - localizedErrorMessage: response.body.info.localizedErrorMessage, - triggerSpan: ts.createTextSpanFromBounds(position, position) - }; - } - - findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[] { + getRenameInfo(fileName: string, position: number, findInStrings?: boolean, findInComments?: boolean): RenameInfo { var lineCol = this.positionToOneBasedLineCol(fileName, position); var args: ServerProtocol.RenameRequestArgs = { file: fileName, @@ -356,18 +345,40 @@ module ts.server { var request = this.processRequest(CommandNames.Rename, args); var response = this.processResponse(request); - if (!response.body.info.canRename) { - return []; + return this.lastRenameEntry = { + canRename: response.body.info.canRename, + displayName: response.body.info.displayName, + fullDisplayName: response.body.info.fullDisplayName, + kind: response.body.info.kind, + kindModifiers: response.body.info.kindModifiers, + localizedErrorMessage: response.body.info.localizedErrorMessage, + triggerSpan: ts.createTextSpanFromBounds(position, position), + fileName: fileName, + position: position, + findInStrings: findInStrings, + findInComments: findInComments, + locations: response.body.locs.map((entry) => { + var fileName = this.decodeEncodedFileId(entry.file); + var start = this.lineColToPosition(fileName, entry.start); + var end = this.lineColToPosition(fileName, entry.end); + return { + textSpan: ts.createTextSpanFromBounds(start, end), + fileName: fileName + }; + }) + }; + } + + findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean): RenameLocation[] { + if (!this.lastRenameEntry || + this.lastRenameEntry.fileName !== fileName || + this.lastRenameEntry.position !== position || + this.lastRenameEntry.findInStrings != findInStrings || + this.lastRenameEntry.findInComments != findInComments) { + this.getRenameInfo(fileName, position, findInStrings, findInComments); } - return response.body.locs.map((entry) => { - var start = this.lineColToPosition(entry.file, entry.start); - var end = this.lineColToPosition(entry.file, entry.end); - return { - textSpan: ts.createTextSpanFromBounds(start, end), - fileName: entry.file - }; - }); + return this.lastRenameEntry.locations; } decodeNavigationBarItems(items: ServerProtocol.NavigationBarItem[], fileName: string): NavigationBarItem[] { diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 04b3ce065b0..386a477cf0f 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -27,7 +27,7 @@ module ts.server { } interface FileStart { - file: string; + file: ServerProtocol.EncodedFile; start: ILineInfo; } @@ -92,9 +92,9 @@ module ts.server { locs: FileRange[]; } - function formatDiag(file: string, project: Project, diag: ts.Diagnostic) { + function formatDiag(fileName: string, project: Project, diag: ts.Diagnostic) { return { - start: project.compilerService.host.positionToLineCol(file, diag.start), + start: project.compilerService.host.positionToLineCol(fileName, diag.start), len: diag.length, text: diag.messageText, }; @@ -204,7 +204,7 @@ module ts.server { this.send(res); } - encodeFilename(fileName: string): ServerProtocol.EncodedFile { + encodeFileName(fileName: string): ServerProtocol.EncodedFile { var id = ts.lookUp(this.fileHash, fileName); if (!id) { id = this.nextFileId++; @@ -216,15 +216,15 @@ module ts.server { } } - output(info: any, cmdName: string, reqSeq = 0, errorMsg?: string) { - this.response(info, cmdName, reqSeq, errorMsg); + output(body: any, commandName: string, requestSequence = 0, errorMessage?: string) { + this.response(body, commandName, requestSequence, errorMessage); } semanticCheck(file: string, project: Project) { var diags = project.compilerService.languageService.getSemanticDiagnostics(file); if (diags) { var bakedDiags = diags.map((diag) => formatDiag(file, project, diag)); - this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag"); + this.event({ file: this.encodeFileName(file), diagnostics: bakedDiags }, "semanticDiag"); } } @@ -232,7 +232,7 @@ module ts.server { var diags = project.compilerService.languageService.getSyntacticDiagnostics(file); if (diags) { var bakedDiags = diags.map((diag) => formatDiag(file, project, diag)); - this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag"); + this.event({ file: this.encodeFileName(file), diagnostics: bakedDiags }, "syntaxDiag"); } } @@ -293,11 +293,9 @@ module ts.server { } return definitions.map(def => ({ - file: def && def.fileName, - start: def && - compilerService.host.positionToLineCol(def.fileName, def.textSpan.start), - end: def && - compilerService.host.positionToLineCol(def.fileName, ts.textSpanEnd(def.textSpan)) + file: this.encodeFileName(def.fileName), + start: compilerService.host.positionToLineCol(def.fileName, def.textSpan.start), + end: compilerService.host.positionToLineCol(def.fileName, ts.textSpanEnd(def.textSpan)) })); } @@ -322,15 +320,15 @@ module ts.server { }; } - var renameLocs = compilerService.languageService.findRenameLocations(file, position, findInStrings, findInComments); - if (!renameLocs) { + var renameLocations = compilerService.languageService.findRenameLocations(file, position, findInStrings, findInComments); + if (!renameLocations) { throw Errors.NoContent; } - var bakedRenameLocs = renameLocs.map(loc => ({ - file: loc.fileName, - start: compilerService.host.positionToLineCol(loc.fileName, loc.textSpan.start), - end: compilerService.host.positionToLineCol(loc.fileName, ts.textSpanEnd(loc.textSpan)), + var bakedRenameLocs = renameLocations.map(location => ({ + file: this.encodeFileName(location.fileName), + start: compilerService.host.positionToLineCol(location.fileName, location.textSpan.start), + end: compilerService.host.positionToLineCol(location.fileName, ts.textSpanEnd(location.textSpan)), })); return { info: renameInfo, locs: bakedRenameLocs }; @@ -368,7 +366,7 @@ module ts.server { var snap = compilerService.host.getScriptSnapshot(ref.fileName); var lineText = snap.getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); return { - file: ref.fileName, + file: this.encodeFileName(ref.fileName), start: start, lineText: lineText, end: compilerService.host.positionToLineCol(ref.fileName, ts.textSpanEnd(ref.textSpan)), @@ -383,8 +381,8 @@ module ts.server { }; } - openClientFile(rawfile: string) { - var file = ts.normalizePath(rawfile); + openClientFile(fileName: string) { + var file = ts.normalizePath(fileName); this.projectService.openClientFile(file); } @@ -536,8 +534,8 @@ module ts.server { } } - change(line: number, col: number, deleteLen: number, insertString: string, rawfile: string) { - var file = ts.normalizePath(rawfile); + change(line: number, col: number, deleteLen: number, insertString: string, fileName: string) { + var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (project) { var compilerService = project.compilerService; @@ -553,9 +551,9 @@ module ts.server { } } - reload(rawfile: string, rawtmpfile: string, reqSeq = 0) { - var file = ts.normalizePath(rawfile); - var tmpfile = ts.normalizePath(rawtmpfile); + reload(fileName: string, tempFileName: string, reqSeq = 0) { + var file = ts.normalizePath(fileName); + var tmpfile = ts.normalizePath(tempFileName); var project = this.projectService.getProjectForFile(file); if (project) { this.changeSeq++; @@ -566,9 +564,9 @@ module ts.server { } } - saveToTmp(rawfile: string, rawtmpfile: string) { - var file = ts.normalizePath(rawfile); - var tmpfile = ts.normalizePath(rawtmpfile); + saveToTmp(fileName: string, tempFileName: string) { + var file = ts.normalizePath(fileName); + var tmpfile = ts.normalizePath(tempFileName); var project = this.projectService.getProjectForFile(file); if (project) { @@ -576,8 +574,8 @@ module ts.server { } } - closeClientFile(rawfile: string) { - var file = ts.normalizePath(rawfile); + closeClientFile(fileName: string) { + var file = ts.normalizePath(fileName); this.projectService.closeClientFile(file); } @@ -635,7 +633,7 @@ module ts.server { var bakedItem: ServerProtocol.NavtoItem = { name: navItem.name, kind: navItem.kind, - file: this.encodeFilename(navItem.fileName), + file: this.encodeFileName(navItem.fileName), start: start, end: end, }; diff --git a/src/server/protodef.d.ts b/src/server/protodef.d.ts index 12fd7163c1a..d2dcf4260ef 100644 --- a/src/server/protodef.d.ts +++ b/src/server/protodef.d.ts @@ -101,8 +101,12 @@ declare module ServerProtocol { a specific source file. */ export interface CodeSpan extends TextSpan { - /** File containing the definition */ - file: string; + /** + File containing the definition; the value of this + field will always be a string, number of a mapping between + a string and a number. + */ + file: EncodedFile; } /** From 76c7fdf6d171af73be8f060457a56e2bcdd0f67f Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sun, 15 Feb 2015 18:24:30 -0800 Subject: [PATCH 075/162] Add test for completionEntryDetails --- src/server/client.ts | 31 ++++++++++++++++---- src/server/protocol.ts | 2 +- tests/cases/fourslash/server/completions2.ts | 18 ++++++++++++ 3 files changed, 44 insertions(+), 7 deletions(-) create mode 100644 tests/cases/fourslash/server/completions2.ts diff --git a/src/server/client.ts b/src/server/client.ts index 24666c8f4c7..0f06fc106af 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -6,6 +6,11 @@ module ts.server { writeMessage(message: string): void; } + interface CompletionEntry extends CompletionInfo { + fileName: string; + position: number; + } + interface RenameEntry extends RenameInfo { fileName: string; position: number; @@ -19,6 +24,7 @@ module ts.server { private fileMapping: ts.Map = {}; private lineMaps: ts.Map = {}; private messages: string[] = []; + private lastCompletionEntry: CompletionEntry; private lastRenameEntry: RenameEntry; constructor(private host: SessionClientHost) { @@ -195,13 +201,30 @@ module ts.server { var request = this.processRequest(CommandNames.Completions, args); var response = this.processResponse(request); - return { + return this.lastCompletionEntry = { isMemberCompletion: false, isNewIdentifierLocation: false, - entries: response.body.map(entry => ({ kind: entry.kind, kindModifiers: entry.kindModifiers, name: entry.name })) + entries: response.body.map(entry => ({ + kind: entry.kind, + kindModifiers: entry.kindModifiers, + name: entry.name, + displayParts: entry.displayParts, + documentation: entry.documentation + })), + fileName: fileName, + position: position }; } + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails { + debugger; + if (!this.lastCompletionEntry || this.lastCompletionEntry.fileName !== fileName || this.lastCompletionEntry.position !== position) { + this.getCompletionsAtPosition(fileName, position); + } + + return this.lastCompletionEntry.entries.filter(entry => entry.name === entryName)[0]; + } + getNavigateToItems(searchTerm: string): NavigateToItem[] { var args: ServerProtocol.NavtoRequestArgs = { searchTerm, @@ -466,10 +489,6 @@ module ts.server { throw new Error("Not Implemented Yet."); } - getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails { - throw new Error("Not Implemented Yet."); - } - getProgram(): Program { throw new Error("SourceFile objects are not serializable through the server protocol."); } diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 386a477cf0f..0b62e86d16e 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -511,7 +511,7 @@ module ts.server { protoEntry.documentation = details.documentation; } if (details && (details.displayParts) && (details.displayParts.length > 0)) { - protoEntry.displayParts = details.documentation; + protoEntry.displayParts = details.displayParts; } result.push(protoEntry); } diff --git a/tests/cases/fourslash/server/completions2.ts b/tests/cases/fourslash/server/completions2.ts new file mode 100644 index 00000000000..b34aad66ba2 --- /dev/null +++ b/tests/cases/fourslash/server/completions2.ts @@ -0,0 +1,18 @@ +/// + +////class Foo { +////} +////module Foo { +//// export var x: number; +////} +////Foo./**/ + +goTo.marker(""); +verify.completionListContains("x"); + +// Make an edit +edit.insert("a"); +edit.backspace(); + +// Checking for completion details after edit should work too +verify.completionEntryDetailIs("x", "(var) Foo.x: number"); From d9d2e994950b614f8afc91794879155464038891 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sun, 15 Feb 2015 18:43:39 -0800 Subject: [PATCH 076/162] Remove debugging statemetns --- src/server/client.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/server/client.ts b/src/server/client.ts index 0f06fc106af..8ff881611d3 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -99,8 +99,6 @@ module ts.server { } private processResponse(request: ServerProtocol.Request): T { - debugger; - var lastMessage = this.messages.shift(); Debug.assert(!!lastMessage, "Did not recieve any responses."); @@ -217,7 +215,6 @@ module ts.server { } getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails { - debugger; if (!this.lastCompletionEntry || this.lastCompletionEntry.fileName !== fileName || this.lastCompletionEntry.position !== position) { this.getCompletionsAtPosition(fileName, position); } From f5c1bfbca7618e8638f447e1679dbac6e11959e5 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sun, 15 Feb 2015 18:49:22 -0800 Subject: [PATCH 077/162] renmae protodef.d.ts to protocol.d.ts and protocol.ts to session.ts --- Jakefile | 6 ++++-- src/harness/harness.ts | 2 +- src/server/client.ts | 2 +- src/server/{protodef.d.ts => protocol.d.ts} | 0 src/server/server.ts | 2 +- src/server/{protocol.ts => session.ts} | 10 +++++----- 6 files changed, 12 insertions(+), 10 deletions(-) rename src/server/{protodef.d.ts => protocol.d.ts} (100%) rename src/server/{protocol.ts => session.ts} (97%) diff --git a/Jakefile b/Jakefile index acd81b0ccd5..bb57469ac33 100644 --- a/Jakefile +++ b/Jakefile @@ -94,7 +94,8 @@ var servicesSources = [ var serverSources = [ "node.d.ts", "editorServices.ts", - "protocol.ts", + "protocol.d.ts", + "session.ts", "server.ts" ].map(function (f) { return path.join(serverDirectory, f); @@ -141,7 +142,8 @@ var harnessSources = [ ].map(function (f) { return path.join(unittestsDirectory, f); })).concat([ - "protocol.ts", + "protocol.d.ts", + "session.ts", "client.ts", "editorServices.ts", ].map(function (f) { diff --git a/src/harness/harness.ts b/src/harness/harness.ts index cbc4064119a..8ee51f89c9c 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -16,7 +16,7 @@ /// /// -/// +/// /// /// /// diff --git a/src/server/client.ts b/src/server/client.ts index 8ff881611d3..9da5ed9fdbd 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -1,4 +1,4 @@ -/// +/// module ts.server { diff --git a/src/server/protodef.d.ts b/src/server/protocol.d.ts similarity index 100% rename from src/server/protodef.d.ts rename to src/server/protocol.d.ts diff --git a/src/server/server.ts b/src/server/server.ts index 6d210ff0d13..8921a4b4768 100644 --- a/src/server/server.ts +++ b/src/server/server.ts @@ -1,5 +1,5 @@ /// -/// +/// module ts.server { var nodeproto: typeof NodeJS._debugger = require('_debugger'); diff --git a/src/server/protocol.ts b/src/server/session.ts similarity index 97% rename from src/server/protocol.ts rename to src/server/session.ts index 0b62e86d16e..715b8fa3d6a 100644 --- a/src/server/protocol.ts +++ b/src/server/session.ts @@ -1,7 +1,7 @@ /// /// /// -/// +/// /// module ts.server { @@ -587,13 +587,13 @@ module ts.server { var compilerService = project.compilerService; return items.map(item => ({ - text: item.text, - kind: item.kind, - kindModifiers: item.kindModifiers, + text: item.text, + kind: item.kind, + kindModifiers: item.kindModifiers, spans: item.spans.map(span => ({ start: compilerService.host.positionToLineCol(fileName, span.start), end: compilerService.host.positionToLineCol(fileName, ts.textSpanEnd(span)) - })), + })), childItems: this.decorateNavigationBarItem(project, fileName, item.childItems) })); } From d081c9c463b742e79a3eb5d2d493e126f70ae92b Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sun, 15 Feb 2015 18:52:17 -0800 Subject: [PATCH 078/162] rename output file to tsserver.js --- Jakefile | 2 +- bin/tsserver | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Jakefile b/Jakefile index bb57469ac33..07b0d267a68 100644 --- a/Jakefile +++ b/Jakefile @@ -400,7 +400,7 @@ compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright jake.rmRf(tempDirPath, {silent: true}); }); -var serverFile = path.join(builtLocalDirectory, "typescriptServer.js"); +var serverFile = path.join(builtLocalDirectory, "tsserver.js"); compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true); // Local target to build the compiler and services diff --git a/bin/tsserver b/bin/tsserver index 2327c344c44..003eb0d22af 100644 --- a/bin/tsserver +++ b/bin/tsserver @@ -1,2 +1,2 @@ #!/usr/bin/env node -require('./typescriptServer.js') +require('./tsserver.js') From ca348385354d563014b7b7b56c76c65750808f6c Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sun, 15 Feb 2015 19:13:52 -0800 Subject: [PATCH 079/162] Remove unused code --- src/server/editorServices.ts | 61 +----------------------------------- 1 file changed, 1 insertion(+), 60 deletions(-) diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 9e6363b509f..4f23e9a7c14 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -12,7 +12,6 @@ module ts.server { msg(s: string, type?: string): void; } - var measurePerf = false; var lineCollectionCapacity = 4; var indentStrings: string[] = []; var indentBase = " "; @@ -26,37 +25,6 @@ module ts.server { return indentStrings[indentAmt]; } - export function printLine(s: string) { - ts.sys.write(s + '\n'); - } - - function showLines(s: string) { - var strBuilder = ""; - for (var i = 0, len = s.length; i < len; i++) { - if (s.charCodeAt(i) == 10) { - strBuilder += '\\n'; - } - else if (s.charCodeAt(i) == 13) { - strBuilder += '\\r'; - } - else { - strBuilder += s.charAt(i); - } - } - return strBuilder; - } - - function calibrateTimer() { - var count = 20; - var total = 0; - for (var i = 0; i < count; i++) { - var start = process.hrtime(); - var elapsed = process.hrtime(start); - var elapsedNano = 1e9 * elapsed[0] + elapsed[1]; - total += elapsedNano; - } - } - export class ScriptInfo { svc: ScriptVersionCache; children: ScriptInfo[] = []; // files referenced by this file @@ -449,10 +417,7 @@ module ts.server { inferredProjects: Project[] = []; constructor(public host: ServerHost, public psLogger: Logger, public eventHandler?: ProjectServiceEventHandler) { - if (measurePerf) { - calibrateTimer(); - } - ts.disableIncrementalParsing = true; + // ts.disableIncrementalParsing = true; } watchedFileChanged(fileName: string) { @@ -820,7 +785,6 @@ module ts.server { lineCount(): number; isLeaf(): boolean; walk(rangeStart: number, rangeLength: number, walkFns: ILineIndexWalker): void; - print(indentAmt: number): void; } export interface ILineInfo { @@ -1253,12 +1217,6 @@ module ts.server { } } - print() { - printLine("index TC " + this.root.charCount() + " TL " + this.root.lineCount()); - this.root.print(0); - printLine(""); - } - load(lines: string[]) { if (lines.length > 0) { var leaves: LineLeaf[] = []; @@ -1424,15 +1382,6 @@ module ts.server { return false; } - print(indentAmt: number) { - var strBuilder = getIndent(indentAmt); - strBuilder += ("node ch " + this.children.length + " TC " + this.totalChars + " TL " + this.totalLines + " :"); - printLine(strBuilder); - for (var ch = 0, clen = this.children.length; ch < clen; ch++) { - this.children[ch].print(indentAmt + 1); - } - } - updateCounts() { this.totalChars = 0; this.totalLines = 0; @@ -1492,9 +1441,6 @@ module ts.server { } var adjustedLength = rangeLength - (childCharCount - adjustedStart); child = this.children[++childIndex]; - if (!child) { - this.print(2); - } childCharCount = child.charCount(); while (adjustedLength > childCharCount) { if (this.execWalk(0, childCharCount, walkFns, childIndex, CharRangeSection.Mid)) { @@ -1743,10 +1689,5 @@ module ts.server { lineCount() { return 1; } - - print(indentAmt: number) { - var strBuilder = getIndent(indentAmt); - printLine(strBuilder + showLines(this.text)); - } } } \ No newline at end of file From 8a9ac8d33802b8105b68fc8866fd3b760b590c38 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sun, 15 Feb 2015 19:14:33 -0800 Subject: [PATCH 080/162] Change ServerProtocol module to ts.server.protocol --- src/server/client.ts | 86 +-- src/server/protocol.d.ts | 1192 +++++++++++++++++++------------------- src/server/session.ts | 68 +-- 3 files changed, 670 insertions(+), 676 deletions(-) diff --git a/src/server/client.ts b/src/server/client.ts index 9da5ed9fdbd..22b346aa3ec 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -47,11 +47,11 @@ module ts.server { return lineMap; } - private lineColToPosition(fileName: string, lineCol: ServerProtocol.LineCol): number { + private lineColToPosition(fileName: string, lineCol: ts.server.protocol.LineCol): number { return ts.computePositionFromLineAndCharacter(this.getLineMap(fileName), lineCol.line, lineCol.col); } - private positionToOneBasedLineCol(fileName: string, position: number): ServerProtocol.LineCol { + private positionToOneBasedLineCol(fileName: string, position: number): ts.server.protocol.LineCol { var lineCol = ts.computeLineAndCharacterOfPosition(this.getLineMap(fileName), position); return { line: lineCol.line, @@ -59,7 +59,7 @@ module ts.server { }; } - private convertCodeEditsToTextChange(fileName: string, codeEdit: ServerProtocol.CodeEdit): ts.TextChange { + private convertCodeEditsToTextChange(fileName: string, codeEdit: ts.server.protocol.CodeEdit): ts.TextChange { var start = this.lineColToPosition(fileName, codeEdit.start); var end = this.lineColToPosition(fileName, codeEdit.end); @@ -69,11 +69,11 @@ module ts.server { }; } - private decodeEncodedFileId(fileId: ServerProtocol.EncodedFile): string { + private decodeEncodedFileId(fileId: ts.server.protocol.EncodedFile): string { var fileName: string; if (typeof fileId === "object") { - fileName = (fileId).file; - this.fileMapping[(fileId).id] = fileName; + fileName = (fileId).file; + this.fileMapping[(fileId).id] = fileName; } else if (typeof fileId === "number") { fileName = ts.lookUp(this.fileMapping, fileId.toString()); @@ -85,8 +85,8 @@ module ts.server { return fileName; } - private processRequest(command: string, arguments?: any): T { - var request: ServerProtocol.Request = { + private processRequest(command: string, arguments?: any): T { + var request: ts.server.protocol.Request = { seq: this.sequence++, type: "request", command: command, @@ -98,7 +98,7 @@ module ts.server { return request; } - private processResponse(request: ServerProtocol.Request): T { + private processResponse(request: ts.server.protocol.Request): T { var lastMessage = this.messages.shift(); Debug.assert(!!lastMessage, "Did not recieve any responses."); @@ -138,12 +138,12 @@ module ts.server { } openFile(fileName: string): void { - var args: ServerProtocol.FileRequestArgs = { file: fileName }; + var args: ts.server.protocol.FileRequestArgs = { file: fileName }; this.processRequest(CommandNames.Open, args); } closeFile(fileName: string): void { - var args: ServerProtocol.FileRequestArgs = { file: fileName }; + var args: ts.server.protocol.FileRequestArgs = { file: fileName }; this.processRequest(CommandNames.Close, args); } @@ -152,7 +152,7 @@ module ts.server { this.lineMaps[fileName] = undefined; var lineCol = this.positionToOneBasedLineCol(fileName, start); - var args: ServerProtocol.ChangeRequestArgs = { + var args: ts.server.protocol.ChangeRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, @@ -166,14 +166,14 @@ module ts.server { getQuickInfoAtPosition(fileName: string, position: number): QuickInfo { var lineCol = this.positionToOneBasedLineCol(fileName, position); - var args: ServerProtocol.CodeLocationRequestArgs = { + var args: ts.server.protocol.CodeLocationRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col }; - var request = this.processRequest(CommandNames.Quickinfo, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.Quickinfo, args); + var response = this.processResponse(request); var start = this.lineColToPosition(fileName, response.body.start); var end = this.lineColToPosition(fileName, response.body.end); @@ -189,15 +189,15 @@ module ts.server { getCompletionsAtPosition(fileName: string, position: number): CompletionInfo { var lineCol = this.positionToOneBasedLineCol(fileName, position); - var args: ServerProtocol.CompletionsRequestArgs = { + var args: ts.server.protocol.CompletionsRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, prefix: undefined }; - var request = this.processRequest(CommandNames.Completions, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.Completions, args); + var response = this.processResponse(request); return this.lastCompletionEntry = { isMemberCompletion: false, @@ -223,13 +223,13 @@ module ts.server { } getNavigateToItems(searchTerm: string): NavigateToItem[] { - var args: ServerProtocol.NavtoRequestArgs = { + var args: ts.server.protocol.NavtoRequestArgs = { searchTerm, file: this.host.getScriptFileNames()[0] }; - var request = this.processRequest(CommandNames.Navto, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.Navto, args); + var response = this.processResponse(request); return response.body.map(entry => { var fileName = this.decodeEncodedFileId(entry.file); @@ -252,7 +252,7 @@ module ts.server { getFormattingEditsForRange(fileName: string, start: number, end: number, options: ts.FormatCodeOptions): ts.TextChange[] { var startLineCol = this.positionToOneBasedLineCol(fileName, start); var endLineCol = this.positionToOneBasedLineCol(fileName, end); - var args: ServerProtocol.FormatRequestArgs = { + var args: ts.server.protocol.FormatRequestArgs = { file: fileName, line: startLineCol.line, col: startLineCol.col, @@ -261,8 +261,8 @@ module ts.server { }; // TODO: handle FormatCodeOptions - var request = this.processRequest(CommandNames.Format, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.Format, args); + var response = this.processResponse(request); return response.body.map(entry=> this.convertCodeEditsToTextChange(fileName, entry)); } @@ -273,7 +273,7 @@ module ts.server { getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): ts.TextChange[] { var lineCol = this.positionToOneBasedLineCol(fileName, position); - var args: ServerProtocol.FormatOnKeyRequestArgs = { + var args: ts.server.protocol.FormatOnKeyRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, @@ -281,22 +281,22 @@ module ts.server { }; // TODO: handle FormatCodeOptions - var request = this.processRequest(CommandNames.Formatonkey, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.Formatonkey, args); + var response = this.processResponse(request); return response.body.map(entry=> this.convertCodeEditsToTextChange(fileName, entry)); } getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] { var lineCol = this.positionToOneBasedLineCol(fileName, position); - var args: ServerProtocol.CodeLocationRequestArgs = { + var args: ts.server.protocol.CodeLocationRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, }; - var request = this.processRequest(CommandNames.Definition, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.Definition, args); + var response = this.processResponse(request); return response.body.map(entry => { var fileName = this.decodeEncodedFileId(entry.file); @@ -315,14 +315,14 @@ module ts.server { getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[] { var lineCol = this.positionToOneBasedLineCol(fileName, position); - var args: ServerProtocol.CodeLocationRequestArgs = { + var args: ts.server.protocol.CodeLocationRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, }; - var request = this.processRequest(CommandNames.References, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.References, args); + var response = this.processResponse(request); return response.body.refs.map(entry => { var fileName = this.decodeEncodedFileId(entry.file); @@ -354,7 +354,7 @@ module ts.server { getRenameInfo(fileName: string, position: number, findInStrings?: boolean, findInComments?: boolean): RenameInfo { var lineCol = this.positionToOneBasedLineCol(fileName, position); - var args: ServerProtocol.RenameRequestArgs = { + var args: ts.server.protocol.RenameRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, @@ -362,8 +362,8 @@ module ts.server { findInComments }; - var request = this.processRequest(CommandNames.Rename, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.Rename, args); + var response = this.processResponse(request); return this.lastRenameEntry = { canRename: response.body.info.canRename, @@ -401,7 +401,7 @@ module ts.server { return this.lastRenameEntry.locations; } - decodeNavigationBarItems(items: ServerProtocol.NavigationBarItem[], fileName: string): NavigationBarItem[] { + decodeNavigationBarItems(items: ts.server.protocol.NavigationBarItem[], fileName: string): NavigationBarItem[] { if (!items) { return []; } @@ -419,12 +419,12 @@ module ts.server { } getNavigationBarItems(fileName: string): NavigationBarItem[] { - var args: ServerProtocol.FileRequestArgs = { + var args: ts.server.protocol.FileRequestArgs = { file: fileName }; - var request = this.processRequest(CommandNames.NavBar, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.NavBar, args); + var response = this.processResponse(request); return this.decodeNavigationBarItems(response.body, fileName); } @@ -455,14 +455,14 @@ module ts.server { getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[] { var lineCol = this.positionToOneBasedLineCol(fileName, position); - var args: ServerProtocol.CodeLocationRequestArgs = { + var args: ts.server.protocol.CodeLocationRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, }; - var request = this.processRequest(CommandNames.Brace, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.Brace, args); + var response = this.processResponse(request); return response.body.map(entry => { var start = this.lineColToPosition(fileName, entry.start); diff --git a/src/server/protocol.d.ts b/src/server/protocol.d.ts index d2dcf4260ef..b1eef8f1b7f 100644 --- a/src/server/protocol.d.ts +++ b/src/server/protocol.d.ts @@ -1,603 +1,597 @@ -/** Declaration module describing the TypeScript Server protocol */ -declare module ServerProtocol { - /** A TypeScript Server message */ - export interface Message { - /** Sequence number of the message */ - seq: number; - /** One of "request", "response", or "event" */ - type: string; - } - - /** Client-initiated request message */ - export interface Request extends Message { - /** The command to execute */ - command: string; - /** Object containing arguments for the command */ - arguments?: any; - } - - /** Server-initiated event message */ - export interface Event extends Message { - /** Name of event */ - event: string; - /** Event-specific information */ - body?: any; - } - - /** Response by server to client request message */ - export interface Response extends Message { - /** Sequence number of the request message */ - request_seq: number; - /** Outcome of the request */ - success: boolean; - /** The command requested */ - command: string; - /** Contains error message if success == false. */ - message?: string; - /** Contains message body if success == true. */ - body?: any; - } - - /** Arguments for FileRequest messages */ - export interface FileRequestArgs { - /** The file for the request (absolute pathname required) */ - file: string; - } - - /** - Request whose sole parameter is a file name - */ - export interface FileRequest extends Request { - arguments: FileRequestArgs; - } - - /** - Instances of this interface specify a code location: - (file, line, col), where line and column are 1-based. - */ - export interface CodeLocationRequestArgs extends FileRequestArgs { - /** The line number for the request (1-based) */ - line: number; - /** The column for the request (1-based) */ - col: number; - } - - /** - A request whose arguments specify a code location (file, line, col) - */ - export interface CodeLocationRequest extends FileRequest { - arguments: CodeLocationRequestArgs; - } - - /** - Go to definition request; value of command field is - "definition". Return response giving the code locations that - define the symbol found in file at location line, col. - */ - export interface DefinitionRequest extends CodeLocationRequest { - } - - /** - Object containing line and column (one-based) of code location - */ - export interface LineCol { - line: number; - col: number; - } - - /** - Object found in response messages defining a span of text in - source code. - */ - export interface TextSpan { - /** First character of the definition */ - start: LineCol; - /** One character past last character of the definition */ - end: LineCol; - } - - /** - Object found in response messages defining a span of text in - a specific source file. - */ - export interface CodeSpan extends TextSpan { - /** - File containing the definition; the value of this - field will always be a string, number of a mapping between - a string and a number. - */ - file: EncodedFile; - } - - /** - Definition response message. Gives text range for definition. - */ - export interface DefinitionResponse extends Response { - body?: CodeSpan[]; - } - - /** - Find references request; value of command field is - "references". Return response giving the code locations that - reference the symbol found in file at location line, col. - */ - export interface ReferencesRequest extends CodeLocationRequest { - } - - export interface ReferencesResponseItem extends CodeSpan { - /** Text of line containing the reference. Including this - with the response avoids latency of editor loading files - to show text of reference line (the server already has - loaded the referencing files). - */ - lineText: string; - - /** True if reference is a write location, false otherwise. */ - isWriteAccess: boolean; - } - - /** The body of a "references" response message. */ - export interface ReferencesResponseBody { - /** The code locations referencing the symbol */ - refs: ReferencesResponseItem[]; - /** The name of the symbol */ - symbolName: string; - /** - The start column of the symbol (on the line provided by the references request) - */ - symbolStartCol: number; - /** The full display name of the symbol */ - symbolDisplayString: string; - } - - /** Response to "references" request. */ - export interface ReferencesResponse extends Response { - body?: ReferencesResponseBody; - } - - export interface RenameRequestArgs extends CodeLocationRequestArgs { - findInComments?: boolean; - findInStrings?: boolean; - } - - - /** - Rename request; value of command field is "rename". Return - response giving the code locations that reference the symbol - found in file at location line, col. Also return full display - name of the symbol so that client can print it unambiguously. - */ - export interface RenameRequest extends CodeLocationRequest { - arguments: RenameRequestArgs; - } - - /** Information about the item to be renamed. */ - export interface RenameInfo { - /** True if item can be renamed */ - canRename: boolean; - /** Error message if item can not be renamed */ - localizedErrorMessage: string; - /** Display name of the item to be renamed */ - displayName: string; - /** Full display name of item to be renamed */ - fullDisplayName: string; - /** The items's kind (such as 'className' or 'parameterName' or plain 'text') */ - kind: string; - /** Optional modifiers for the kind (such as 'public') */ - kindModifiers: string; - } - - /** - Rename response message. - */ - export interface RenameResponse extends Response { - body?: { - /** Information about the item to be renamed */ - info: RenameInfo; - /** - An array of code locations that refer to the - item to be renamed. - */ - locs: CodeSpan[]; - } - } - - /** - Open request; value of command field is "open". Notify the - server that the client has file open. The server will not - monitor the filesystem for changes in this file and will assume - that the client is updating the server (using the change and/or - reload messages) when the file changes. Server does not currently - send a response to an open request. - */ - export interface OpenRequest extends FileRequest { - } - - /** - Close request; value of command field is "close". Notify the - server that the client has closed a previously open file. If - file is still referenced by open files, the server will resume - monitoring the filesystem for changes to file. Server does not - currently send a response to a close request. - */ - export interface CloseRequest extends FileRequest { - } - - /** - Quickinfo request; value of command field is - "quickinfo". Return response giving a quick type and - documentation string for the symbol found in file at location - line, col. - */ - export interface QuickInfoRequest extends CodeLocationRequest { - } - - /** Body of QuickInfoResponse */ - export interface QuickInfoResponseBody { - /** The symbol's kind (such as 'className' or 'parameterName' or plain 'text') */ - kind: string; - /** Optional modifiers for the kind (such as 'public') */ - kindModifiers: string; - /** Starting code location of symbol */ - start: LineCol; - /** One past last character of symbol */ - end: LineCol; - /** Type and kind of symbol */ - displayString: string; - /** Documentation associated with symbol */ - documentation: string; - } - - /** Quickinfo response message */ - export interface QuickInfoResponse extends Response { - body?: QuickInfoResponseBody; - } - - /** Arguments for format messages */ - export interface FormatRequestArgs extends CodeLocationRequestArgs { - /** Last line of range for which to format text in file */ - endLine: number; - /** Last column of range for which to format text in file */ - endCol: number; - } - - /** - Format request; value of command field is "format". Return - response giving zero or more edit instructions. The edit - instructions will be sorted in file order. Applying the edit - instructions in reverse to file will result in correctly - reformatted text. - */ - export interface FormatRequest extends CodeLocationRequest { - arguments: FormatRequestArgs; - } - - /** - Object found in response messages defining an editing - instruction for a span of text in source code. The effect of - this instruction is to replace the text starting at start and - ending one character before end with newText. For an insertion, - the text span is empty. For a deletion, newText is empty. - */ - export interface CodeEdit { - /** First character of the text span to edit. */ - start: LineCol; - /** One character past last character of the text span to edit */ - end: LineCol; - /** - Replace the span defined above with this string (may be - the empty string) - */ - newText: string; - } - - /** Format and format on key response message */ - export interface FormatResponse extends Response { - body?: CodeEdit[]; - } - - /** Arguments for format on key messages */ - export interface FormatOnKeyRequestArgs extends CodeLocationRequestArgs { - /** Key pressed (';', '\n', or '}') */ - key: string; - } - - /** - Format on key request; value of command field is - "formatonkey". Given file location and key typed (as string), - return response giving zero or more edit instructions. The - edit instructions will be sorted in file order. Applying the - edit instructions in reverse to file will result in correctly - reformatted text. - */ - export interface FormatOnKeyRequest extends CodeLocationRequest { - arguments: FormatOnKeyRequestArgs; - } - - /** Arguments for completions messages */ - export interface CompletionsRequestArgs extends CodeLocationRequestArgs { - /** Optional prefix to apply to possible completions. */ - prefix?: string; - } - - /** - Completions request; value of command field is "completions". - Given a file location (file, line, col) and a prefix (which may - be the empty string), return the possible completions that - begin with prefix. - */ - export interface CompletionsRequest extends CodeLocationRequest { - arguments: CompletionsRequestArgs; - } - - /** - Part of a symbol description. - */ - export interface SymbolDisplayPart { - /** Text of an item describing the symbol */ - text: string; - /** The symbol's kind (such as 'className' or 'parameterName' or plain 'text') */ - kind: string; - } - - /** An item found in a completion response */ - export interface CompletionItem { - /** The symbol's name */ - name: string; - /** The symbol's kind (such as 'className' or 'parameterName') */ - kind: string; - /** Optional modifiers for the kind (such as 'public') */ - kindModifiers?: string; - /** Display parts of the symbol (similar to quick info) */ - displayParts?: SymbolDisplayPart[]; - /** Documentation strings for the symbol */ - documentation?: SymbolDisplayPart[]; - } - - export interface CompletionsResponse extends Response { - body?: CompletionItem[]; - } - - /** Arguments for geterr messages. */ - export interface GeterrRequestArgs { - /** - List of file names for which to compute compiler errors. - The files will be checked in list order. - */ - files: string[]; - /** - Delay in milliseconds to wait before starting to compute - errors for the files in the file list - */ - delay: number; - } - - /** - Geterr request; value of command field is "geterr". Wait for - delay milliseconds and then, if during the wait no change or - reload messages have arrived for the first file in the files - list, get the syntactic errors for the file, field requests, - and then get the semantic errors for the file. Repeat with a - smaller delay for each subsequent file on the files list. Best - practice for an editor is to send a file list containing each - file that is currently visible, in most-recently-used order. - */ - export interface GeterrRequest extends Request { - arguments: GeterrRequestArgs; - } - - /** Item of diagnostic information found in a DiagEvent message */ - export interface Diagnostic { - /** Starting code location at which text appies */ - start: LineCol; - /** Length of code location at which text applies */ - len: number; - /** Text of diagnostic message */ - text: string; - } - - /** Event message for "syntaxDiag" and "semanticDiag" event types. - These events provide syntactic and semantic errors for a file. - */ - export interface DiagEvent extends Event { - body?: { - /** The file for which diagnostic information is reported */ - file: string; - /** An array of diagnostic information items */ - diagnostics: Diagnostic[]; - }; - } - - /** Arguments for reload request. */ - export interface ReloadRequestArgs extends FileRequestArgs { - /** - Name of temporary file from which to reload file - contents. May be same as file. - */ - tmpfile: string; - } - - /** - Reload request message; value of command field is "reload". - Reload contents of file with name given by the 'file' argument - from temporary file with name given by the 'tmpfile' argument. - The two names can be identical. - */ - export interface ReloadRequest extends FileRequest { - arguments: ReloadRequestArgs; - } - - /** - Response to "reload" request. This is just an acknowledgement, so - no body field is required. - */ - export interface ReloadResponse extends Response { - } - - /** Arguments for saveto request. */ - export interface SavetoRequestArgs extends FileRequestArgs { - /** - Name of temporary file into which to save server's view of - file contents. - */ - tmpfile: string; - } - - /** - Saveto request message; value of command field is "saveto". - For debugging purposes, save to a temporaryfile (named by - argument 'tmpfile') the contents of file named by argument - 'file'. The server does not currently send a response to a - "saveto" request. - */ - export interface SavetoRequest extends FileRequest { - arguments: SavetoRequestArgs; - } - - /** Arguments for navto request message */ - export interface NavtoRequestArgs extends FileRequestArgs { - /** - Search term to navigate to from current location; term can - be '.*' or an identifier prefix. - */ - searchTerm: string; - } - - /** - Navto request message; value of command field is "navto". - Return list of objects giving code locations and symbols that - match the search term given in argument 'searchTerm'. The - context for the search is given by the named file. - */ - export interface NavtoRequest extends FileRequest { - arguments: NavtoRequestArgs; - } - - /** An item found in a navto response. */ - export interface NavtoItem { - /** The symbol's name */ - name: string; - /** The symbol's kind (such as 'className' or 'parameterName') */ - kind: string; - /** exact, substring, or prefix */ - matchKind?: string; - /** Optional modifiers for the kind (such as 'public') */ - kindModifiers?: string; - /** - The file in which the symbol is found; the value of this - field will always be a string, number of a mapping between - a string and a number. - */ - file: EncodedFile; - /** The location within file at which the symbol is found*/ - start: LineCol; - /** One past the last character of the symbol */ - end: LineCol; - /** - Name of symbol's container symbol (if any); for example, - the class name if symbol is a class member - */ - containerName?: string; - /** Kind of symbol's container symbol (if any) */ - containerKind?: string; - } - - /** - Navto response message. Body is an array of navto items. Each - item gives a symbol that matched the search term. - */ - export interface NavtoResponse extends Response { - body?: NavtoItem[]; - } - - /** Arguments for change request message. */ - export interface ChangeRequestArgs extends CodeLocationRequestArgs { - /** - Length of span deleted at location (file, line, col); nothing deleted - if this field is zero or undefined. - */ - deleteLen?: number; - /** Optional string to insert at location (file, line col). */ - insertString?: string; - } - - /** - Change request message; value of command field is "change". - Update the server's view of the file named by argument 'file'. - Server does not currently send a response to a change request. - */ - export interface ChangeRequest extends CodeLocationRequest { - arguments: ChangeRequestArgs; - } - - /** - If an object of this type is returned in place of a string as - the value of a file field in a response message, add the - mapping id => file to the client's cache of file id mappings, - and interpret the value as if it was the string in the 'file' - field. - */ - export interface IdFile { - /** Id to assign to file */ - id: number; - /** File name that will correspond to id */ - file: string; - } - - /** - The type of an encoded file name. If of type number, the value - is a file id. If of type IdFile, the value is interpreted as - 'file' and in addition the mapping 'id' to 'file' is - established. If of type string, the value is simply the file - name. - */ - export type EncodedFile = number | IdFile | string; - - /** Response to "brace" request. */ - export interface BraceResponse extends Response { - body?: TextSpan[]; - } - - /** - Brace matching request; value of command field is "brace". - Return response giving the code locations of matching braces - found in file at location line, col. - */ - export interface BraceRequest extends CodeLocationRequest { - } - - /** - NavBar itesm request; value of command field is "navbar". - Return response giving the list of navigation bar entries - extracted from the requested file. - */ - export interface NavBarRequest extends FileRequest { - } - +/** Declaration module describing the TypeScript Server protocol */ +declare module ts.server.protocol { + /** A TypeScript Server message */ + export interface Message { + /** Sequence number of the message */ + seq: number; + /** One of "request", "response", or "event" */ + type: string; + } + + /** Client-initiated request message */ + export interface Request extends Message { + /** The command to execute */ + command: string; + /** Object containing arguments for the command */ + arguments?: any; + } + + /** Server-initiated event message */ + export interface Event extends Message { + /** Name of event */ + event: string; + /** Event-specific information */ + body?: any; + } + + /** Response by server to client request message */ + export interface Response extends Message { + /** Sequence number of the request message */ + request_seq: number; + /** Outcome of the request */ + success: boolean; + /** The command requested */ + command: string; + /** Contains error message if success == false. */ + message?: string; + /** Contains message body if success == true. */ + body?: any; + } + + /** Arguments for FileRequest messages */ + export interface FileRequestArgs { + /** The file for the request (absolute pathname required) */ + file: string; + } + + /** + Request whose sole parameter is a file name + */ + export interface FileRequest extends Request { + arguments: FileRequestArgs; + } + + /** + Instances of this interface specify a code location: + (file, line, col), where line and column are 1-based. + */ + export interface CodeLocationRequestArgs extends FileRequestArgs { + /** The line number for the request (1-based) */ + line: number; + /** The column for the request (1-based) */ + col: number; + } + + /** + A request whose arguments specify a code location (file, line, col) + */ + export interface CodeLocationRequest extends FileRequest { + arguments: CodeLocationRequestArgs; + } + + /** + Go to definition request; value of command field is + "definition". Return response giving the code locations that + define the symbol found in file at location line, col. + */ + export interface DefinitionRequest extends CodeLocationRequest { + } + + /** + Object containing line and column (one-based) of code location + */ + export interface LineCol { + line: number; + col: number; + } + + /** + Object found in response messages defining a span of text in + source code. + */ + export interface TextSpan { + /** First character of the definition */ + start: LineCol; + /** One character past last character of the definition */ + end: LineCol; + } + + /** + Object found in response messages defining a span of text in + a specific source file. + */ + export interface CodeSpan extends TextSpan { + /** + File containing the definition; the value of this + field will always be a string, number of a mapping between + a string and a number. + */ + file: EncodedFile; + } + + /** + Definition response message. Gives text range for definition. + */ + export interface DefinitionResponse extends Response { + body?: CodeSpan[]; + } + + /** + Find references request; value of command field is + "references". Return response giving the code locations that + reference the symbol found in file at location line, col. + */ + export interface ReferencesRequest extends CodeLocationRequest { + } + + export interface ReferencesResponseItem extends CodeSpan { + /** Text of line containing the reference. Including this + with the response avoids latency of editor loading files + to show text of reference line (the server already has + loaded the referencing files). + */ + lineText: string; + + /** True if reference is a write location, false otherwise. */ + isWriteAccess: boolean; + } + + /** The body of a "references" response message. */ + export interface ReferencesResponseBody { + /** The code locations referencing the symbol */ + refs: ReferencesResponseItem[]; + /** The name of the symbol */ + symbolName: string; + /** + The start column of the symbol (on the line provided by the references request) + */ + symbolStartCol: number; + /** The full display name of the symbol */ + symbolDisplayString: string; + } + + /** Response to "references" request. */ + export interface ReferencesResponse extends Response { + body?: ReferencesResponseBody; + } + + export interface RenameRequestArgs extends CodeLocationRequestArgs { + findInComments?: boolean; + findInStrings?: boolean; + } + + + /** + Rename request; value of command field is "rename". Return + response giving the code locations that reference the symbol + found in file at location line, col. Also return full display + name of the symbol so that client can print it unambiguously. + */ + export interface RenameRequest extends CodeLocationRequest { + arguments: RenameRequestArgs; + } + + /** Information about the item to be renamed. */ + export interface RenameInfo { + /** True if item can be renamed */ + canRename: boolean; + /** Error message if item can not be renamed */ + localizedErrorMessage: string; + /** Display name of the item to be renamed */ + displayName: string; + /** Full display name of item to be renamed */ + fullDisplayName: string; + /** The items's kind (such as 'className' or 'parameterName' or plain 'text') */ + kind: string; + /** Optional modifiers for the kind (such as 'public') */ + kindModifiers: string; + } + + /** + Rename response message. + */ + export interface RenameResponse extends Response { + body?: { + /** Information about the item to be renamed */ + info: RenameInfo; + /** + An array of code locations that refer to the + item to be renamed. + */ + locs: CodeSpan[]; + } + } + + /** + Open request; value of command field is "open". Notify the + server that the client has file open. The server will not + monitor the filesystem for changes in this file and will assume + that the client is updating the server (using the change and/or + reload messages) when the file changes. Server does not currently + send a response to an open request. + */ + export interface OpenRequest extends FileRequest { + } + + /** + Close request; value of command field is "close". Notify the + server that the client has closed a previously open file. If + file is still referenced by open files, the server will resume + monitoring the filesystem for changes to file. Server does not + currently send a response to a close request. + */ + export interface CloseRequest extends FileRequest { + } + + /** + Quickinfo request; value of command field is + "quickinfo". Return response giving a quick type and + documentation string for the symbol found in file at location + line, col. + */ + export interface QuickInfoRequest extends CodeLocationRequest { + } + + /** Body of QuickInfoResponse */ + export interface QuickInfoResponseBody { + /** The symbol's kind (such as 'className' or 'parameterName' or plain 'text') */ + kind: string; + /** Optional modifiers for the kind (such as 'public') */ + kindModifiers: string; + /** Starting code location of symbol */ + start: LineCol; + /** One past last character of symbol */ + end: LineCol; + /** Type and kind of symbol */ + displayString: string; + /** Documentation associated with symbol */ + documentation: string; + } + + /** Quickinfo response message */ + export interface QuickInfoResponse extends Response { + body?: QuickInfoResponseBody; + } + + /** Arguments for format messages */ + export interface FormatRequestArgs extends CodeLocationRequestArgs { + /** Last line of range for which to format text in file */ + endLine: number; + /** Last column of range for which to format text in file */ + endCol: number; + } + + /** + Format request; value of command field is "format". Return + response giving zero or more edit instructions. The edit + instructions will be sorted in file order. Applying the edit + instructions in reverse to file will result in correctly + reformatted text. + */ + export interface FormatRequest extends CodeLocationRequest { + arguments: FormatRequestArgs; + } + + /** + Object found in response messages defining an editing + instruction for a span of text in source code. The effect of + this instruction is to replace the text starting at start and + ending one character before end with newText. For an insertion, + the text span is empty. For a deletion, newText is empty. + */ + export interface CodeEdit { + /** First character of the text span to edit. */ + start: LineCol; + /** One character past last character of the text span to edit */ + end: LineCol; + /** + Replace the span defined above with this string (may be + the empty string) + */ + newText: string; + } + + /** Format and format on key response message */ + export interface FormatResponse extends Response { + body?: CodeEdit[]; + } + + /** Arguments for format on key messages */ + export interface FormatOnKeyRequestArgs extends CodeLocationRequestArgs { + /** Key pressed (';', '\n', or '}') */ + key: string; + } + + /** + Format on key request; value of command field is + "formatonkey". Given file location and key typed (as string), + return response giving zero or more edit instructions. The + edit instructions will be sorted in file order. Applying the + edit instructions in reverse to file will result in correctly + reformatted text. + */ + export interface FormatOnKeyRequest extends CodeLocationRequest { + arguments: FormatOnKeyRequestArgs; + } + + /** Arguments for completions messages */ + export interface CompletionsRequestArgs extends CodeLocationRequestArgs { + /** Optional prefix to apply to possible completions. */ + prefix?: string; + } + + /** + Completions request; value of command field is "completions". + Given a file location (file, line, col) and a prefix (which may + be the empty string), return the possible completions that + begin with prefix. + */ + export interface CompletionsRequest extends CodeLocationRequest { + arguments: CompletionsRequestArgs; + } + + /** + Part of a symbol description. + */ + export interface SymbolDisplayPart { + /** Text of an item describing the symbol */ + text: string; + /** The symbol's kind (such as 'className' or 'parameterName' or plain 'text') */ + kind: string; + } + + /** An item found in a completion response */ + export interface CompletionItem { + /** The symbol's name */ + name: string; + /** The symbol's kind (such as 'className' or 'parameterName') */ + kind: string; + /** Optional modifiers for the kind (such as 'public') */ + kindModifiers?: string; + /** Display parts of the symbol (similar to quick info) */ + displayParts?: SymbolDisplayPart[]; + /** Documentation strings for the symbol */ + documentation?: SymbolDisplayPart[]; + } + + export interface CompletionsResponse extends Response { + body?: CompletionItem[]; + } + + /** Arguments for geterr messages. */ + export interface GeterrRequestArgs { + /** + List of file names for which to compute compiler errors. + The files will be checked in list order. + */ + files: string[]; + /** + Delay in milliseconds to wait before starting to compute + errors for the files in the file list + */ + delay: number; + } + + /** + Geterr request; value of command field is "geterr". Wait for + delay milliseconds and then, if during the wait no change or + reload messages have arrived for the first file in the files + list, get the syntactic errors for the file, field requests, + and then get the semantic errors for the file. Repeat with a + smaller delay for each subsequent file on the files list. Best + practice for an editor is to send a file list containing each + file that is currently visible, in most-recently-used order. + */ + export interface GeterrRequest extends Request { + arguments: GeterrRequestArgs; + } + + /** Item of diagnostic information found in a DiagEvent message */ + export interface Diagnostic { + /** Starting code location at which text appies */ + start: LineCol; + /** Length of code location at which text applies */ + len: number; + /** Text of diagnostic message */ + text: string; + } + + /** Event message for "syntaxDiag" and "semanticDiag" event types. + These events provide syntactic and semantic errors for a file. + */ + export interface DiagEvent extends Event { + body?: { + /** The file for which diagnostic information is reported */ + file: string; + /** An array of diagnostic information items */ + diagnostics: Diagnostic[]; + }; + } + + /** Arguments for reload request. */ + export interface ReloadRequestArgs extends FileRequestArgs { + /** + Name of temporary file from which to reload file + contents. May be same as file. + */ + tmpfile: string; + } + + /** + Reload request message; value of command field is "reload". + Reload contents of file with name given by the 'file' argument + from temporary file with name given by the 'tmpfile' argument. + The two names can be identical. + */ + export interface ReloadRequest extends FileRequest { + arguments: ReloadRequestArgs; + } + + /** + Response to "reload" request. This is just an acknowledgement, so + no body field is required. + */ + export interface ReloadResponse extends Response { + } + + /** Arguments for saveto request. */ + export interface SavetoRequestArgs extends FileRequestArgs { + /** + Name of temporary file into which to save server's view of + file contents. + */ + tmpfile: string; + } + + /** + Saveto request message; value of command field is "saveto". + For debugging purposes, save to a temporaryfile (named by + argument 'tmpfile') the contents of file named by argument + 'file'. The server does not currently send a response to a + "saveto" request. + */ + export interface SavetoRequest extends FileRequest { + arguments: SavetoRequestArgs; + } + + /** Arguments for navto request message */ + export interface NavtoRequestArgs extends FileRequestArgs { + /** + Search term to navigate to from current location; term can + be '.*' or an identifier prefix. + */ + searchTerm: string; + } + + /** + Navto request message; value of command field is "navto". + Return list of objects giving code locations and symbols that + match the search term given in argument 'searchTerm'. The + context for the search is given by the named file. + */ + export interface NavtoRequest extends FileRequest { + arguments: NavtoRequestArgs; + } + + /** An item found in a navto response. */ + export interface NavtoItem { + /** The symbol's name */ + name: string; + /** The symbol's kind (such as 'className' or 'parameterName') */ + kind: string; + /** exact, substring, or prefix */ + matchKind?: string; + /** Optional modifiers for the kind (such as 'public') */ + kindModifiers?: string; + /** + The file in which the symbol is found; the value of this + field will always be a string, number of a mapping between + a string and a number. + */ + file: EncodedFile; + /** The location within file at which the symbol is found*/ + start: LineCol; + /** One past the last character of the symbol */ + end: LineCol; + /** + Name of symbol's container symbol (if any); for example, + the class name if symbol is a class member + */ + containerName?: string; + /** Kind of symbol's container symbol (if any) */ + containerKind?: string; + } + + /** + Navto response message. Body is an array of navto items. Each + item gives a symbol that matched the search term. + */ + export interface NavtoResponse extends Response { + body?: NavtoItem[]; + } + + /** Arguments for change request message. */ + export interface ChangeRequestArgs extends CodeLocationRequestArgs { + /** + Length of span deleted at location (file, line, col); nothing deleted + if this field is zero or undefined. + */ + deleteLen?: number; + /** Optional string to insert at location (file, line col). */ + insertString?: string; + } + + /** + Change request message; value of command field is "change". + Update the server's view of the file named by argument 'file'. + Server does not currently send a response to a change request. + */ + export interface ChangeRequest extends CodeLocationRequest { + arguments: ChangeRequestArgs; + } + + /** + If an object of this type is returned in place of a string as + the value of a file field in a response message, add the + mapping id => file to the client's cache of file id mappings, + and interpret the value as if it was the string in the 'file' + field. + */ + export interface IdFile { + /** Id to assign to file */ + id: number; + /** File name that will correspond to id */ + file: string; + } + + /** + The type of an encoded file name. If of type number, the value + is a file id. If of type IdFile, the value is interpreted as + 'file' and in addition the mapping 'id' to 'file' is + established. If of type string, the value is simply the file + name. + */ + export type EncodedFile = number | IdFile | string; + + /** Response to "brace" request. */ + export interface BraceResponse extends Response { + body?: TextSpan[]; + } + + /** + Brace matching request; value of command field is "brace". + Return response giving the code locations of matching braces + found in file at location line, col. + */ + export interface BraceRequest extends CodeLocationRequest { + } + + /** + NavBar itesm request; value of command field is "navbar". + Return response giving the list of navigation bar entries + extracted from the requested file. + */ + export interface NavBarRequest extends FileRequest { + } + export interface NavigationBarItem { - /** The item's display text */ - text: string; - - /** The symbol's kind (such as 'className' or 'parameterName') */ - kind: string; - - /** Optional modifiers for the kind (such as 'public') */ - kindModifiers?: string; - - /** The definition locations of the item */ - spans: TextSpan[]; + /** The item's display text */ + text: string; + + /** The symbol's kind (such as 'className' or 'parameterName') */ + kind: string; + + /** Optional modifiers for the kind (such as 'public') */ + kindModifiers?: string; + + /** The definition locations of the item */ + spans: TextSpan[]; /** Optional children */ childItems?: NavigationBarItem[]; - } - - export interface NavBarResponse extends Response { - body?: NavigationBarItem[]; - } -} - - - - - - + } + + export interface NavBarResponse extends Response { + body?: NavigationBarItem[]; + } +} diff --git a/src/server/session.ts b/src/server/session.ts index 715b8fa3d6a..e88932dcb77 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -27,7 +27,7 @@ module ts.server { } interface FileStart { - file: ServerProtocol.EncodedFile; + file: ts.server.protocol.EncodedFile; start: ILineInfo; } @@ -188,7 +188,7 @@ module ts.server { } response(info: any, cmdName: string, reqSeq = 0, errorMsg?: string) { - var res: ServerProtocol.Response = { + var res: ts.server.protocol.Response = { seq: 0, type: "response", command: cmdName, @@ -204,7 +204,7 @@ module ts.server { this.send(res); } - encodeFileName(fileName: string): ServerProtocol.EncodedFile { + encodeFileName(fileName: string): ts.server.protocol.EncodedFile { var id = ts.lookUp(this.fileHash, fileName); if (!id) { id = this.nextFileId++; @@ -277,7 +277,7 @@ module ts.server { } } - getDefinition(line: number, col: number, fileName: string): ServerProtocol.CodeSpan[] { + getDefinition(line: number, col: number, fileName: string): ts.server.protocol.CodeSpan[] { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -299,7 +299,7 @@ module ts.server { })); } - getRenameLocations(line: number, col: number, fileName: string, findInComments: boolean, findInStrings: boolean): { info: RenameInfo; locs: ServerProtocol.CodeSpan[] } { + getRenameLocations(line: number, col: number, fileName: string, findInComments: boolean, findInStrings: boolean): { info: RenameInfo; locs: ts.server.protocol.CodeSpan[] } { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -325,7 +325,7 @@ module ts.server { throw Errors.NoContent; } - var bakedRenameLocs = renameLocations.map(location => ({ + var bakedRenameLocs = renameLocations.map(location => ({ file: this.encodeFileName(location.fileName), start: compilerService.host.positionToLineCol(location.fileName, location.textSpan.start), end: compilerService.host.positionToLineCol(location.fileName, ts.textSpanEnd(location.textSpan)), @@ -334,7 +334,7 @@ module ts.server { return { info: renameInfo, locs: bakedRenameLocs }; } - getReferences(line: number, col: number, fileName: string): ServerProtocol.ReferencesResponseBody { + getReferences(line: number, col: number, fileName: string): ts.server.protocol.ReferencesResponseBody { // TODO: get all projects for this file; report refs for all projects deleting duplicates // can avoid duplicates by eliminating same ref file from subsequent projects var file = ts.normalizePath(fileName); @@ -360,7 +360,7 @@ module ts.server { var nameSpan = nameInfo.textSpan; var nameColStart = compilerService.host.positionToLineCol(file, nameSpan.start).col; var nameText = compilerService.host.getScriptSnapshot(file).getText(nameSpan.start, ts.textSpanEnd(nameSpan)); - var bakedRefs: ServerProtocol.ReferencesResponseItem[] = references.map((ref) => { + var bakedRefs: ts.server.protocol.ReferencesResponseItem[] = references.map((ref) => { var start = compilerService.host.positionToLineCol(ref.fileName, ref.textSpan.start); var refLineSpan = compilerService.host.lineToTextSpan(ref.fileName, start.line - 1); var snap = compilerService.host.getScriptSnapshot(ref.fileName); @@ -386,7 +386,7 @@ module ts.server { this.projectService.openClientFile(file); } - getQuickInfo(line: number, col: number, fileName: string): ServerProtocol.QuickInfoResponseBody { + getQuickInfo(line: number, col: number, fileName: string): ts.server.protocol.QuickInfoResponseBody { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -412,7 +412,7 @@ module ts.server { }; } - getFormattingEditsForRange(line: number, col: number, endLine: number, endCol: number, fileName: string): ServerProtocol.CodeEdit[] { + getFormattingEditsForRange(line: number, col: number, endLine: number, endCol: number, fileName: string): ts.server.protocol.CodeEdit[] { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -438,7 +438,7 @@ module ts.server { }); } - getFormattingEditsAfterKeystroke(line: number, col: number, key: string, fileName: string): ServerProtocol.CodeEdit[] { + getFormattingEditsAfterKeystroke(line: number, col: number, key: string, fileName: string): ts.server.protocol.CodeEdit[] { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); @@ -480,7 +480,7 @@ module ts.server { }); } - getCompletions(line: number, col: number, prefix: string, fileName: string): ServerProtocol.CompletionItem[] { + getCompletions(line: number, col: number, prefix: string, fileName: string): ts.server.protocol.CompletionItem[] { if (!prefix) { prefix = ""; } @@ -579,7 +579,7 @@ module ts.server { this.projectService.closeClientFile(file); } - decorateNavigationBarItem(project: Project, fileName: string, items: ts.NavigationBarItem[]): ServerProtocol.NavigationBarItem[] { + decorateNavigationBarItem(project: Project, fileName: string, items: ts.NavigationBarItem[]): ts.server.protocol.NavigationBarItem[] { if (!items) { return undefined; } @@ -598,7 +598,7 @@ module ts.server { })); } - getNavigationBarItems(fileName: string): ServerProtocol.NavigationBarItem[] { + getNavigationBarItems(fileName: string): ts.server.protocol.NavigationBarItem[] { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -614,7 +614,7 @@ module ts.server { return this.decorateNavigationBarItem(project, fileName, items); } - getNavigateToItems(searchTerm: string, fileName: string): ServerProtocol.NavtoItem[] { + getNavigateToItems(searchTerm: string, fileName: string): ts.server.protocol.NavtoItem[] { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -630,7 +630,7 @@ module ts.server { return navItems.map((navItem) => { var start = compilerService.host.positionToLineCol(navItem.fileName, navItem.textSpan.start); var end = compilerService.host.positionToLineCol(navItem.fileName, ts.textSpanEnd(navItem.textSpan)); - var bakedItem: ServerProtocol.NavtoItem = { + var bakedItem: ts.server.protocol.NavtoItem = { name: navItem.name, kind: navItem.kind, file: this.encodeFileName(navItem.fileName), @@ -653,7 +653,7 @@ module ts.server { }); } - getBraceMatching(line: number, col: number, fileName: string): ServerProtocol.TextSpan[] { + getBraceMatching(line: number, col: number, fileName: string): ts.server.protocol.TextSpan[] { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); @@ -677,87 +677,87 @@ module ts.server { onMessage(message: string) { try { - var request = JSON.parse(message); + var request = JSON.parse(message); var response: any; switch (request.command) { case CommandNames.Definition: { - var defArgs = request.arguments; + var defArgs = request.arguments; response = this.getDefinition(defArgs.line, defArgs.col, defArgs.file); break; } case CommandNames.References: { - var refArgs = request.arguments; + var refArgs = request.arguments; response = this.getReferences(refArgs.line, refArgs.col, refArgs.file); break; } case CommandNames.Rename: { - var renameArgs = request.arguments; + var renameArgs = request.arguments; response = this.getRenameLocations(renameArgs.line, renameArgs.col, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings); break; } case CommandNames.Open: { - var openArgs = request.arguments; + var openArgs = request.arguments; this.openClientFile(openArgs.file); break; } case CommandNames.Quickinfo: { - var quickinfoArgs = request.arguments; + var quickinfoArgs = request.arguments; response = this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.col, quickinfoArgs.file); break; } case CommandNames.Format: { - var formatArgs = request.arguments; + var formatArgs = request.arguments; response = this.getFormattingEditsForRange(formatArgs.line, formatArgs.col, formatArgs.endLine, formatArgs.endCol, formatArgs.file); break; } case CommandNames.Formatonkey: { - var formatOnKeyArgs = request.arguments; + var formatOnKeyArgs = request.arguments; response = this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.col, formatOnKeyArgs.key, formatOnKeyArgs.file); break; } case CommandNames.Completions: { - var completionsArgs = request.arguments; + var completionsArgs = request.arguments; response = this.getCompletions(request.arguments.line, request.arguments.col, completionsArgs.prefix, request.arguments.file); break; } case CommandNames.Geterr: { - var geterrArgs = request.arguments; + var geterrArgs = request.arguments; response = this.getDiagnostics(geterrArgs.delay, geterrArgs.files); break; } case CommandNames.Change: { - var changeArgs = request.arguments; + var changeArgs = request.arguments; this.change(changeArgs.line, changeArgs.col, changeArgs.deleteLen, changeArgs.insertString, changeArgs.file); break; } case CommandNames.Reload: { - var reloadArgs = request.arguments; + var reloadArgs = request.arguments; this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq); break; } case CommandNames.Saveto: { - var savetoArgs = request.arguments; + var savetoArgs = request.arguments; this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile); break; } case CommandNames.Close: { - var closeArgs = request.arguments; + var closeArgs = request.arguments; this.closeClientFile(closeArgs.file); break; } case CommandNames.Navto: { - var navtoArgs = request.arguments; + var navtoArgs = request.arguments; response = this.getNavigateToItems(navtoArgs.searchTerm, navtoArgs.file); break; } case CommandNames.Brace: { - var braceArguments = request.arguments; + var braceArguments = request.arguments; response = this.getBraceMatching(braceArguments.line, braceArguments.col, braceArguments.file); break; } case CommandNames.NavBar: { - var navBarArgs = request.arguments; + var navBarArgs = request.arguments; response = this.getNavigationBarItems(navBarArgs.file); break; } From bdd0bf341b171ceba3eaecd2f84a21f435aa992f Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sun, 15 Feb 2015 19:48:35 -0800 Subject: [PATCH 081/162] Comment formatting --- src/server/protocol.d.ts | 777 +++++++++++++++++++++++++-------------- 1 file changed, 500 insertions(+), 277 deletions(-) diff --git a/src/server/protocol.d.ts b/src/server/protocol.d.ts index b1eef8f1b7f..e3433e24690 100644 --- a/src/server/protocol.d.ts +++ b/src/server/protocol.d.ts @@ -1,156 +1,222 @@ -/** Declaration module describing the TypeScript Server protocol */ +/** + * Declaration module describing the TypeScript Server protocol + */ declare module ts.server.protocol { - /** A TypeScript Server message */ + /** + * A TypeScript Server message + */ export interface Message { - /** Sequence number of the message */ + /** + * Sequence number of the message + */ seq: number; - /** One of "request", "response", or "event" */ + + /** + * One of "request", "response", or "event" + */ type: string; } - /** Client-initiated request message */ + /** + * Client-initiated request message + */ export interface Request extends Message { - /** The command to execute */ + /** + * The command to execute + */ command: string; - /** Object containing arguments for the command */ + + /** + * Object containing arguments for the command + */ arguments?: any; } - /** Server-initiated event message */ + /** + * Server-initiated event message + */ export interface Event extends Message { - /** Name of event */ + /** + * Name of event + */ event: string; - /** Event-specific information */ + + /** + * Event-specific information + */ body?: any; } - /** Response by server to client request message */ + /** + * Response by server to client request message. + */ export interface Response extends Message { - /** Sequence number of the request message */ + /** + * Sequence number of the request message. + */ request_seq: number; - /** Outcome of the request */ + + /** + * Outcome of the request. + */ success: boolean; - /** The command requested */ + + /** + * The command requested. + */ command: string; - /** Contains error message if success == false. */ + + /** + * Contains error message if success == false. + */ message?: string; - /** Contains message body if success == true. */ + + /** + * Contains message body if success == true. + */ body?: any; } - /** Arguments for FileRequest messages */ + /** + * Arguments for FileRequest messages. + */ export interface FileRequestArgs { - /** The file for the request (absolute pathname required) */ + /** + * The file for the request (absolute pathname required). + */ file: string; } /** - Request whose sole parameter is a file name - */ + * Request whose sole parameter is a file name. + */ export interface FileRequest extends Request { arguments: FileRequestArgs; } /** - Instances of this interface specify a code location: - (file, line, col), where line and column are 1-based. - */ + * Instances of this interface specify a code location: + * (file, line, col), where line and column are 1-based. + */ export interface CodeLocationRequestArgs extends FileRequestArgs { - /** The line number for the request (1-based) */ + /** + * The line number for the request (1-based). + */ line: number; - /** The column for the request (1-based) */ + + /** + * The column for the request (1-based). + */ col: number; } /** - A request whose arguments specify a code location (file, line, col) - */ + * A request whose arguments specify a code location (file, line, col). + */ export interface CodeLocationRequest extends FileRequest { arguments: CodeLocationRequestArgs; } /** - Go to definition request; value of command field is - "definition". Return response giving the code locations that - define the symbol found in file at location line, col. - */ + * Go to definition request; value of command field is + * "definition". Return response giving the code locations that + * define the symbol found in file at location line, col. + */ export interface DefinitionRequest extends CodeLocationRequest { } /** - Object containing line and column (one-based) of code location - */ + * Object containing line and column (one-based) of code location. + */ export interface LineCol { line: number; col: number; } /** - Object found in response messages defining a span of text in - source code. - */ + * Object found in response messages defining a span of text in source code. + */ export interface TextSpan { - /** First character of the definition */ + /** + * First character of the definition. + */ start: LineCol; - /** One character past last character of the definition */ + + /** + * One character past last character of the definition. + */ end: LineCol; } /** - Object found in response messages defining a span of text in - a specific source file. - */ + * Object found in response messages defining a span of text in a specific source file. + */ export interface CodeSpan extends TextSpan { /** - File containing the definition; the value of this - field will always be a string, number of a mapping between - a string and a number. - */ + * File containing the definition; the value of this + * field will always be a string, number of a mapping between + * a string and a number. + */ file: EncodedFile; } /** - Definition response message. Gives text range for definition. - */ + * Definition response message. Gives text range for definition. + */ export interface DefinitionResponse extends Response { body?: CodeSpan[]; } /** - Find references request; value of command field is - "references". Return response giving the code locations that - reference the symbol found in file at location line, col. - */ + * Find references request; value of command field is + * "references". Return response giving the code locations that + * reference the symbol found in file at location line, col. + */ export interface ReferencesRequest extends CodeLocationRequest { } export interface ReferencesResponseItem extends CodeSpan { /** Text of line containing the reference. Including this - with the response avoids latency of editor loading files - to show text of reference line (the server already has - loaded the referencing files). - */ + * with the response avoids latency of editor loading files + * to show text of reference line (the server already has + * loaded the referencing files). + */ lineText: string; - /** True if reference is a write location, false otherwise. */ + /** + * True if reference is a write location, false otherwise. + */ isWriteAccess: boolean; } - /** The body of a "references" response message. */ + /** + * The body of a "references" response message. + */ export interface ReferencesResponseBody { - /** The code locations referencing the symbol */ - refs: ReferencesResponseItem[]; - /** The name of the symbol */ - symbolName: string; /** - The start column of the symbol (on the line provided by the references request) - */ + * The code locations referencing the symbol. + */ + refs: ReferencesResponseItem[]; + + /** + * The name of the symbol. + */ + symbolName: string; + + /** + * The start column of the symbol (on the line provided by the references request). + */ symbolStartCol: number; - /** The full display name of the symbol */ + + /** + * The full display name of the symbol. + */ symbolDisplayString: string; } - /** Response to "references" request. */ + /** + * Response to "references" request. + */ export interface ReferencesResponse extends Response { body?: ReferencesResponseBody; } @@ -162,195 +228,281 @@ declare module ts.server.protocol { /** - Rename request; value of command field is "rename". Return - response giving the code locations that reference the symbol - found in file at location line, col. Also return full display - name of the symbol so that client can print it unambiguously. - */ + * Rename request; value of command field is "rename". Return + * response giving the code locations that reference the symbol + * found in file at location line, col. Also return full display + * name of the symbol so that client can print it unambiguously. + */ export interface RenameRequest extends CodeLocationRequest { arguments: RenameRequestArgs; } - /** Information about the item to be renamed. */ + /** + * Information about the item to be renamed. + */ export interface RenameInfo { - /** True if item can be renamed */ + /** + * True if item can be renamed. + */ canRename: boolean; - /** Error message if item can not be renamed */ + + /** + * Error message if item can not be renamed. + */ localizedErrorMessage: string; - /** Display name of the item to be renamed */ + + /** + * Display name of the item to be renamed. + */ displayName: string; - /** Full display name of item to be renamed */ + + /** + * Full display name of item to be renamed. + */ fullDisplayName: string; - /** The items's kind (such as 'className' or 'parameterName' or plain 'text') */ + + /** + * The items's kind (such as 'className' or 'parameterName' or plain 'text'). + */ kind: string; - /** Optional modifiers for the kind (such as 'public') */ + + /** + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers: string; } /** - Rename response message. - */ + * Rename response message. + */ export interface RenameResponse extends Response { body?: { - /** Information about the item to be renamed */ - info: RenameInfo; /** - An array of code locations that refer to the - item to be renamed. - */ + * Information about the item to be renamed. + */ + info: RenameInfo; + + /** + * An array of code locations that refer to the item to be renamed. + */ locs: CodeSpan[]; } } /** - Open request; value of command field is "open". Notify the - server that the client has file open. The server will not - monitor the filesystem for changes in this file and will assume - that the client is updating the server (using the change and/or - reload messages) when the file changes. Server does not currently - send a response to an open request. - */ + * Open request; value of command field is "open". Notify the + * server that the client has file open. The server will not + * monitor the filesystem for changes in this file and will assume + * that the client is updating the server (using the change and/or + * reload messages) when the file changes. Server does not currently + * send a response to an open request. + */ export interface OpenRequest extends FileRequest { } /** - Close request; value of command field is "close". Notify the - server that the client has closed a previously open file. If - file is still referenced by open files, the server will resume - monitoring the filesystem for changes to file. Server does not - currently send a response to a close request. - */ + * Close request; value of command field is "close". Notify the + * server that the client has closed a previously open file. If + * file is still referenced by open files, the server will resume + * monitoring the filesystem for changes to file. Server does not + * currently send a response to a close request. + */ export interface CloseRequest extends FileRequest { } /** - Quickinfo request; value of command field is - "quickinfo". Return response giving a quick type and - documentation string for the symbol found in file at location - line, col. - */ + * Quickinfo request; value of command field is + * "quickinfo". Return response giving a quick type and + * documentation string for the symbol found in file at location + * line, col. + */ export interface QuickInfoRequest extends CodeLocationRequest { } - /** Body of QuickInfoResponse */ + /** + * Body of QuickInfoResponse. + */ export interface QuickInfoResponseBody { - /** The symbol's kind (such as 'className' or 'parameterName' or plain 'text') */ + /** + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). + */ kind: string; - /** Optional modifiers for the kind (such as 'public') */ + + /** + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers: string; - /** Starting code location of symbol */ + + /** + * Starting code location of symbol. + */ start: LineCol; - /** One past last character of symbol */ + + /** + * One past last character of symbol. + */ end: LineCol; - /** Type and kind of symbol */ + + /** + * Type and kind of symbol. + */ displayString: string; - /** Documentation associated with symbol */ + + /** + * Documentation associated with symbol. + */ documentation: string; } - /** Quickinfo response message */ + /** + * Quickinfo response message. + */ export interface QuickInfoResponse extends Response { body?: QuickInfoResponseBody; } - /** Arguments for format messages */ + /** + * Arguments for format messages. + */ export interface FormatRequestArgs extends CodeLocationRequestArgs { - /** Last line of range for which to format text in file */ + /** + * Last line of range for which to format text in file. + */ endLine: number; - /** Last column of range for which to format text in file */ + + /** + * Last column of range for which to format text in file. + */ endCol: number; } /** - Format request; value of command field is "format". Return - response giving zero or more edit instructions. The edit - instructions will be sorted in file order. Applying the edit - instructions in reverse to file will result in correctly - reformatted text. - */ + * Format request; value of command field is "format". Return + * response giving zero or more edit instructions. The edit + * instructions will be sorted in file order. Applying the edit + * instructions in reverse to file will result in correctly + * reformatted text. + */ export interface FormatRequest extends CodeLocationRequest { arguments: FormatRequestArgs; } /** - Object found in response messages defining an editing - instruction for a span of text in source code. The effect of - this instruction is to replace the text starting at start and - ending one character before end with newText. For an insertion, - the text span is empty. For a deletion, newText is empty. - */ + * Object found in response messages defining an editing + * instruction for a span of text in source code. The effect of + * this instruction is to replace the text starting at start and + * ending one character before end with newText. For an insertion, + * the text span is empty. For a deletion, newText is empty. + */ export interface CodeEdit { - /** First character of the text span to edit. */ - start: LineCol; - /** One character past last character of the text span to edit */ - end: LineCol; /** - Replace the span defined above with this string (may be - the empty string) - */ + * First character of the text span to edit. + */ + start: LineCol; + + /** + * One character past last character of the text span to edit. + */ + end: LineCol; + + /** + * Replace the span defined above with this string (may be + * the empty string). + */ newText: string; } - /** Format and format on key response message */ + /** + * Format and format on key response message. + */ export interface FormatResponse extends Response { body?: CodeEdit[]; } - /** Arguments for format on key messages */ + /** + * Arguments for format on key messages. + */ export interface FormatOnKeyRequestArgs extends CodeLocationRequestArgs { - /** Key pressed (';', '\n', or '}') */ + /** + * Key pressed (';', '\n', or '}'). + */ key: string; } /** - Format on key request; value of command field is - "formatonkey". Given file location and key typed (as string), - return response giving zero or more edit instructions. The - edit instructions will be sorted in file order. Applying the - edit instructions in reverse to file will result in correctly - reformatted text. - */ + * Format on key request; value of command field is + * "formatonkey". Given file location and key typed (as string), + * return response giving zero or more edit instructions. The + * edit instructions will be sorted in file order. Applying the + * edit instructions in reverse to file will result in correctly + * reformatted text. + */ export interface FormatOnKeyRequest extends CodeLocationRequest { arguments: FormatOnKeyRequestArgs; } - /** Arguments for completions messages */ + /** + * Arguments for completions messages. + */ export interface CompletionsRequestArgs extends CodeLocationRequestArgs { - /** Optional prefix to apply to possible completions. */ + /** + * Optional prefix to apply to possible completions. + */ prefix?: string; } /** - Completions request; value of command field is "completions". - Given a file location (file, line, col) and a prefix (which may - be the empty string), return the possible completions that - begin with prefix. - */ + * Completions request; value of command field is "completions". + * Given a file location (file, line, col) and a prefix (which may + * be the empty string), return the possible completions that + * begin with prefix. + */ export interface CompletionsRequest extends CodeLocationRequest { arguments: CompletionsRequestArgs; } /** - Part of a symbol description. - */ + * Part of a symbol description. + */ export interface SymbolDisplayPart { - /** Text of an item describing the symbol */ + /** + * Text of an item describing the symbol. + */ text: string; - /** The symbol's kind (such as 'className' or 'parameterName' or plain 'text') */ + + /** + * The symbol's kind (such as 'className' or 'parameterName' or plain 'text'). + */ kind: string; } - /** An item found in a completion response */ + /** + * An item found in a completion response. + */ export interface CompletionItem { - /** The symbol's name */ + /** + * The symbol's name. + */ name: string; - /** The symbol's kind (such as 'className' or 'parameterName') */ + + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ kind: string; - /** Optional modifiers for the kind (such as 'public') */ + + /** + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers?: string; - /** Display parts of the symbol (similar to quick info) */ + + /** + * Display parts of the symbol (similar to quick info). + */ displayParts?: SymbolDisplayPart[]; - /** Documentation strings for the symbol */ + + /** + * Documentation strings for the symbol. + */ documentation?: SymbolDisplayPart[]; } @@ -358,236 +510,307 @@ declare module ts.server.protocol { body?: CompletionItem[]; } - /** Arguments for geterr messages. */ + /** + * Arguments for geterr messages. + */ export interface GeterrRequestArgs { /** - List of file names for which to compute compiler errors. - The files will be checked in list order. - */ + * List of file names for which to compute compiler errors. + * The files will be checked in list order. + */ files: string[]; + /** - Delay in milliseconds to wait before starting to compute - errors for the files in the file list - */ + * Delay in milliseconds to wait before starting to compute + * errors for the files in the file list + */ delay: number; } /** - Geterr request; value of command field is "geterr". Wait for - delay milliseconds and then, if during the wait no change or - reload messages have arrived for the first file in the files - list, get the syntactic errors for the file, field requests, - and then get the semantic errors for the file. Repeat with a - smaller delay for each subsequent file on the files list. Best - practice for an editor is to send a file list containing each - file that is currently visible, in most-recently-used order. - */ + * Geterr request; value of command field is "geterr". Wait for + * delay milliseconds and then, if during the wait no change or + * reload messages have arrived for the first file in the files + * list, get the syntactic errors for the file, field requests, + * and then get the semantic errors for the file. Repeat with a + * smaller delay for each subsequent file on the files list. Best + * practice for an editor is to send a file list containing each + * file that is currently visible, in most-recently-used order. + */ export interface GeterrRequest extends Request { arguments: GeterrRequestArgs; } - /** Item of diagnostic information found in a DiagEvent message */ + /** + * Item of diagnostic information found in a DiagEvent message. + */ export interface Diagnostic { - /** Starting code location at which text appies */ + /** + * Starting code location at which text appies. + */ start: LineCol; - /** Length of code location at which text applies */ + + /** + * Length of code location at which text applies. + */ len: number; - /** Text of diagnostic message */ + + /** + * Text of diagnostic message. + */ text: string; } - /** Event message for "syntaxDiag" and "semanticDiag" event types. - These events provide syntactic and semantic errors for a file. - */ + /** + * Event message for "syntaxDiag" and "semanticDiag" event types. + * These events provide syntactic and semantic errors for a file. + */ export interface DiagEvent extends Event { body?: { - /** The file for which diagnostic information is reported */ + /** + * The file for which diagnostic information is reported. + */ file: string; - /** An array of diagnostic information items */ + + /** + * An array of diagnostic information items. + */ diagnostics: Diagnostic[]; }; } - /** Arguments for reload request. */ + /** + * Arguments for reload request. + */ export interface ReloadRequestArgs extends FileRequestArgs { /** - Name of temporary file from which to reload file - contents. May be same as file. - */ + * Name of temporary file from which to reload file + * contents. May be same as file. + */ tmpfile: string; } /** - Reload request message; value of command field is "reload". - Reload contents of file with name given by the 'file' argument - from temporary file with name given by the 'tmpfile' argument. - The two names can be identical. - */ + * Reload request message; value of command field is "reload". + * Reload contents of file with name given by the 'file' argument + * from temporary file with name given by the 'tmpfile' argument. + * The two names can be identical. + */ export interface ReloadRequest extends FileRequest { arguments: ReloadRequestArgs; } /** - Response to "reload" request. This is just an acknowledgement, so - no body field is required. - */ + * Response to "reload" request. This is just an acknowledgement, so + * no body field is required. + */ export interface ReloadResponse extends Response { } - /** Arguments for saveto request. */ + /** + * Arguments for saveto request. + */ export interface SavetoRequestArgs extends FileRequestArgs { /** - Name of temporary file into which to save server's view of - file contents. - */ + * Name of temporary file into which to save server's view of + * file contents. + */ tmpfile: string; } /** - Saveto request message; value of command field is "saveto". - For debugging purposes, save to a temporaryfile (named by - argument 'tmpfile') the contents of file named by argument - 'file'. The server does not currently send a response to a - "saveto" request. - */ + * Saveto request message; value of command field is "saveto". + * For debugging purposes, save to a temporaryfile (named by + * argument 'tmpfile') the contents of file named by argument + * 'file'. The server does not currently send a response to a + * "saveto" request. + */ export interface SavetoRequest extends FileRequest { arguments: SavetoRequestArgs; } - /** Arguments for navto request message */ + /** + * Arguments for navto request message. + */ export interface NavtoRequestArgs extends FileRequestArgs { /** - Search term to navigate to from current location; term can - be '.*' or an identifier prefix. - */ + * Search term to navigate to from current location; term can + * be '.*' or an identifier prefix. + */ searchTerm: string; } /** - Navto request message; value of command field is "navto". - Return list of objects giving code locations and symbols that - match the search term given in argument 'searchTerm'. The - context for the search is given by the named file. - */ + * Navto request message; value of command field is "navto". + * Return list of objects giving code locations and symbols that + * match the search term given in argument 'searchTerm'. The + * context for the search is given by the named file. + */ export interface NavtoRequest extends FileRequest { arguments: NavtoRequestArgs; } - /** An item found in a navto response. */ + /** + * An item found in a navto response. + */ export interface NavtoItem { - /** The symbol's name */ - name: string; - /** The symbol's kind (such as 'className' or 'parameterName') */ - kind: string; - /** exact, substring, or prefix */ - matchKind?: string; - /** Optional modifiers for the kind (such as 'public') */ - kindModifiers?: string; - /** - The file in which the symbol is found; the value of this - field will always be a string, number of a mapping between - a string and a number. - */ - file: EncodedFile; - /** The location within file at which the symbol is found*/ - start: LineCol; - /** One past the last character of the symbol */ - end: LineCol; /** - Name of symbol's container symbol (if any); for example, - the class name if symbol is a class member - */ + * The symbol's name. + */ + name: string; + + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ + kind: string; + + /** + * exact, substring, or prefix. + */ + matchKind?: string; + + /** + * Optional modifiers for the kind (such as 'public'). + */ + kindModifiers?: string; + + /** + * The file in which the symbol is found; the value of this + * field will always be a string, number of a mapping between + * a string and a number. + */ + file: EncodedFile; + + /** + * The location within file at which the symbol is found. + */ + start: LineCol; + + /** + * One past the last character of the symbol. + */ + end: LineCol; + + /** + * Name of symbol's container symbol (if any); for example, + * the class name if symbol is a class member. + */ containerName?: string; - /** Kind of symbol's container symbol (if any) */ + + /** + * Kind of symbol's container symbol (if any). + */ containerKind?: string; } /** - Navto response message. Body is an array of navto items. Each - item gives a symbol that matched the search term. - */ + * Navto response message. Body is an array of navto items. Each + * item gives a symbol that matched the search term. + */ export interface NavtoResponse extends Response { body?: NavtoItem[]; } - /** Arguments for change request message. */ + /** + * Arguments for change request message. + */ export interface ChangeRequestArgs extends CodeLocationRequestArgs { /** - Length of span deleted at location (file, line, col); nothing deleted - if this field is zero or undefined. - */ + * Length of span deleted at location (file, line, col); nothing deleted + * if this field is zero or undefined. + */ deleteLen?: number; - /** Optional string to insert at location (file, line col). */ + + /** + * Optional string to insert at location (file, line col). + */ insertString?: string; } /** - Change request message; value of command field is "change". - Update the server's view of the file named by argument 'file'. - Server does not currently send a response to a change request. - */ + * Change request message; value of command field is "change". + * Update the server's view of the file named by argument 'file'. + * Server does not currently send a response to a change request. + */ export interface ChangeRequest extends CodeLocationRequest { arguments: ChangeRequestArgs; } /** - If an object of this type is returned in place of a string as - the value of a file field in a response message, add the - mapping id => file to the client's cache of file id mappings, - and interpret the value as if it was the string in the 'file' - field. - */ + * If an object of this type is returned in place of a string as + * the value of a file field in a response message, add the + * mapping id => file to the client's cache of file id mappings, + * and interpret the value as if it was the string in the 'file' + * field. + */ export interface IdFile { - /** Id to assign to file */ + /** + * Id to assign to file. + */ id: number; - /** File name that will correspond to id */ + + /** + * File name that will correspond to id. + */ file: string; } /** - The type of an encoded file name. If of type number, the value - is a file id. If of type IdFile, the value is interpreted as - 'file' and in addition the mapping 'id' to 'file' is - established. If of type string, the value is simply the file - name. - */ + * The type of an encoded file name. If of type number, the value + * is a file id. If of type IdFile, the value is interpreted as + * 'file' and in addition the mapping 'id' to 'file' is + * established. If of type string, the value is simply the file + * name. + */ export type EncodedFile = number | IdFile | string; - /** Response to "brace" request. */ + /** + * Response to "brace" request. + */ export interface BraceResponse extends Response { body?: TextSpan[]; } /** - Brace matching request; value of command field is "brace". - Return response giving the code locations of matching braces - found in file at location line, col. - */ + * Brace matching request; value of command field is "brace". + * Return response giving the code locations of matching braces + * found in file at location line, col. + */ export interface BraceRequest extends CodeLocationRequest { } /** - NavBar itesm request; value of command field is "navbar". - Return response giving the list of navigation bar entries - extracted from the requested file. + * NavBar itesm request; value of command field is "navbar". + * Return response giving the list of navigation bar entries + * extracted from the requested file. */ export interface NavBarRequest extends FileRequest { } export interface NavigationBarItem { - /** The item's display text */ + /** + * The item's display text. + */ text: string; - /** The symbol's kind (such as 'className' or 'parameterName') */ + /** + * The symbol's kind (such as 'className' or 'parameterName'). + */ kind: string; - /** Optional modifiers for the kind (such as 'public') */ + /** + * Optional modifiers for the kind (such as 'public'). + */ kindModifiers?: string; - /** The definition locations of the item */ + /** + * The definition locations of the item. + */ spans: TextSpan[]; - /** Optional children */ + /** + * Optional children. + */ childItems?: NavigationBarItem[]; } From bbcdb6125487a68cbed44ffc981758e9a5dc5e11 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sun, 15 Feb 2015 19:55:10 -0800 Subject: [PATCH 082/162] remove unused cancellationToken class --- src/server/editorServices.ts | 39 ++---------------------------------- 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 4f23e9a7c14..7a055b77eac 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -72,34 +72,12 @@ module ts.server { } } - export class CancellationToken { - public static None = new CancellationToken(); - - requestPending = false; - - constructor() { - } - - cancel() { - this.requestPending = true; - } - - reset() { - this.requestPending = false; - } - - public isCancellationRequested() { - var temp = this.requestPending; - return temp; - } - } - export class LSHost implements ts.LanguageServiceHost { ls: ts.LanguageService = null; compilationSettings: ts.CompilerOptions; filenameToScript: ts.Map = {}; - constructor(public host: ServerHost, public project: Project, private cancellationToken: CancellationToken = CancellationToken.None) { + constructor(public host: ServerHost, public project: Project) { } getDefaultLibFileName() { @@ -107,14 +85,6 @@ module ts.server { return ts.combinePaths(nodeModuleBinDir, ts.getDefaultLibFileName(this.compilationSettings)); } - cancel() { - this.cancellationToken.cancel(); - } - - reset() { - this.cancellationToken.reset(); - } - getScriptSnapshot(filename: string): ts.IScriptSnapshot { var scriptInfo = this.getScriptInfo(filename); if (scriptInfo) { @@ -154,10 +124,6 @@ module ts.server { return this.getScriptInfo(filename).svc.latestVersion().toString(); } - getCancellationToken(): ts.CancellationToken { - return this.cancellationToken; - } - getCurrentDirectory(): string { return ""; } @@ -736,7 +702,6 @@ module ts.server { } export class CompilerService { - cancellationToken = new CancellationToken(); host: LSHost; languageService: ts.LanguageService; classifier: ts.Classifier; @@ -745,7 +710,7 @@ module ts.server { formatCodeOptions: ts.FormatCodeOptions = CompilerService.defaultFormatCodeOptions; constructor(public project: Project) { - this.host = new LSHost(project.projectService.host, project, this.cancellationToken); + this.host = new LSHost(project.projectService.host, project); // override default ES6 (remove when compiler default back at ES5) this.settings.target = ts.ScriptTarget.ES5; this.host.setCompilationSettings(this.settings); From 54e67568318dc852b62a012a92cbc231806f610a Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sun, 15 Feb 2015 20:04:14 -0800 Subject: [PATCH 083/162] Remove unused code and only expose needed types/classes --- src/server/editorServices.ts | 40 +++++++++++++----------------------- 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 7a055b77eac..5b5ee27d707 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -13,19 +13,8 @@ module ts.server { } var lineCollectionCapacity = 4; - var indentStrings: string[] = []; - var indentBase = " "; - function getIndent(indentAmt: number) { - if (!indentStrings[indentAmt]) { - indentStrings[indentAmt] = ""; - for (var i = 0; i < indentAmt; i++) { - indentStrings[indentAmt] += indentBase; - } - } - return indentStrings[indentAmt]; - } - export class ScriptInfo { + class ScriptInfo { svc: ScriptVersionCache; children: ScriptInfo[] = []; // files referenced by this file @@ -72,7 +61,7 @@ module ts.server { } } - export class LSHost implements ts.LanguageServiceHost { + class LSHost implements ts.LanguageServiceHost { ls: ts.LanguageService = null; compilationSettings: ts.CompilerOptions; filenameToScript: ts.Map = {}; @@ -270,7 +259,7 @@ module ts.server { } } - export interface ProjectOptions { + interface ProjectOptions { // these fields can be present in the project file files?: string[]; formatCodeOptions?: ts.FormatCodeOptions; @@ -354,7 +343,7 @@ module ts.server { } } - export interface ProjectOpenResult { + interface ProjectOpenResult { success?: boolean; errorMsg?: string; project?: Project; @@ -701,7 +690,7 @@ module ts.server { } - export class CompilerService { + class CompilerService { host: LSHost; languageService: ts.LanguageService; classifier: ts.Classifier; @@ -745,7 +734,7 @@ module ts.server { } - export interface LineCollection { + interface LineCollection { charCount(): number; lineCount(): number; isLeaf(): boolean; @@ -759,7 +748,7 @@ module ts.server { leaf?: LineLeaf; } - export enum CharRangeSection { + enum CharRangeSection { PreStart, Start, Entire, @@ -768,7 +757,7 @@ module ts.server { PostEnd } - export interface ILineIndexWalker { + interface ILineIndexWalker { goSubtree: boolean; done: boolean; leaf(relativeStart: number, relativeLength: number, lineCollection: LineLeaf): void; @@ -994,7 +983,7 @@ module ts.server { } // text change information - export class TextChange { + class TextChange { constructor(public pos: number, public deleteLen: number, public insertedText?: string) { } @@ -1004,7 +993,7 @@ module ts.server { } } - export class ScriptVersionCache { + class ScriptVersionCache { changes: TextChange[] = []; versions: LineIndexSnapshot[] = []; minVersion = 0; // no versions earlier than min version will maintain change history @@ -1109,7 +1098,7 @@ module ts.server { } } - export class LineIndexSnapshot implements ts.IScriptSnapshot { + class LineIndexSnapshot implements ts.IScriptSnapshot { index: LineIndex; changesSincePreviousVersion: TextChange[] = []; @@ -1157,8 +1146,7 @@ module ts.server { } } - - export class LineIndex { + class LineIndex { root: LineNode; // set this to true to check each edit for accuracy checkEdits = false; @@ -1338,7 +1326,7 @@ module ts.server { } } - export class LineNode implements LineCollection { + class LineNode implements LineCollection { totalChars = 0; totalLines = 0; children: LineCollection[] = []; @@ -1624,7 +1612,7 @@ module ts.server { } } - export class LineLeaf implements LineCollection { + class LineLeaf implements LineCollection { udata: any; constructor(public text: string) { From ac829a838457762fe00f6e116c543a0c81f496c5 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Mon, 16 Feb 2015 10:44:30 -0800 Subject: [PATCH 084/162] Error for naming an interface 'symbol' --- src/compiler/checker.ts | 1 + tests/baselines/reference/symbolType20.errors.txt | 7 +++++++ tests/baselines/reference/symbolType20.js | 4 ++++ tests/cases/conformance/es6/Symbols/symbolType20.ts | 2 ++ 4 files changed, 14 insertions(+) create mode 100644 tests/baselines/reference/symbolType20.errors.txt create mode 100644 tests/baselines/reference/symbolType20.js create mode 100644 tests/cases/conformance/es6/Symbols/symbolType20.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 08ed3c622e5..5d840a51264 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8903,6 +8903,7 @@ module ts { case "number": case "boolean": case "string": + case "symbol": case "void": error(name, message, (name).text); } diff --git a/tests/baselines/reference/symbolType20.errors.txt b/tests/baselines/reference/symbolType20.errors.txt new file mode 100644 index 00000000000..41345e371f8 --- /dev/null +++ b/tests/baselines/reference/symbolType20.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/es6/Symbols/symbolType20.ts(1,11): error TS2427: Interface name cannot be 'symbol' + + +==== tests/cases/conformance/es6/Symbols/symbolType20.ts (1 errors) ==== + interface symbol { } + ~~~~~~ +!!! error TS2427: Interface name cannot be 'symbol' \ No newline at end of file diff --git a/tests/baselines/reference/symbolType20.js b/tests/baselines/reference/symbolType20.js new file mode 100644 index 00000000000..cf80d0d30ac --- /dev/null +++ b/tests/baselines/reference/symbolType20.js @@ -0,0 +1,4 @@ +//// [symbolType20.ts] +interface symbol { } + +//// [symbolType20.js] diff --git a/tests/cases/conformance/es6/Symbols/symbolType20.ts b/tests/cases/conformance/es6/Symbols/symbolType20.ts new file mode 100644 index 00000000000..ef14e34048b --- /dev/null +++ b/tests/cases/conformance/es6/Symbols/symbolType20.ts @@ -0,0 +1,2 @@ +//@target: ES6 +interface symbol { } \ No newline at end of file From 32e2f4d95d007667b827f34c8109be5b32b49ffe Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Mon, 16 Feb 2015 12:04:34 -0800 Subject: [PATCH 085/162] Accept APISamples baselines --- tests/baselines/reference/APISample_compile.js | 1 + tests/baselines/reference/APISample_compile.types | 3 +++ tests/baselines/reference/APISample_linter.js | 1 + tests/baselines/reference/APISample_linter.types | 3 +++ tests/baselines/reference/APISample_transform.js | 1 + tests/baselines/reference/APISample_transform.types | 3 +++ tests/baselines/reference/APISample_watcher.js | 1 + tests/baselines/reference/APISample_watcher.types | 3 +++ 8 files changed, 16 insertions(+) diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 7d89d88b5b3..1b7ca0c37d2 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -1605,6 +1605,7 @@ declare module "typescript" { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number | string; } interface DefinitionInfo { fileName: string; diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 8cf789bf20f..98063887df4 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -5195,6 +5195,9 @@ declare module "typescript" { PlaceOpenBraceOnNewLineForControlBlocks: boolean; >PlaceOpenBraceOnNewLineForControlBlocks : boolean + + [s: string]: boolean | number | string; +>s : string } interface DefinitionInfo { >DefinitionInfo : DefinitionInfo diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 0ce5a277968..ebb2f7503d8 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -1636,6 +1636,7 @@ declare module "typescript" { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number | string; } interface DefinitionInfo { fileName: string; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 115a0f5a16b..4d92af6dd2e 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -5339,6 +5339,9 @@ declare module "typescript" { PlaceOpenBraceOnNewLineForControlBlocks: boolean; >PlaceOpenBraceOnNewLineForControlBlocks : boolean + + [s: string]: boolean | number | string; +>s : string } interface DefinitionInfo { >DefinitionInfo : DefinitionInfo diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 6ecf4e7c395..315b1a97eac 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -1637,6 +1637,7 @@ declare module "typescript" { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number | string; } interface DefinitionInfo { fileName: string; diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index e2797fe5267..bad0f064116 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -5291,6 +5291,9 @@ declare module "typescript" { PlaceOpenBraceOnNewLineForControlBlocks: boolean; >PlaceOpenBraceOnNewLineForControlBlocks : boolean + + [s: string]: boolean | number | string; +>s : string } interface DefinitionInfo { >DefinitionInfo : DefinitionInfo diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index eb141f20672..543677016a5 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -1674,6 +1674,7 @@ declare module "typescript" { InsertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis: boolean; PlaceOpenBraceOnNewLineForFunctions: boolean; PlaceOpenBraceOnNewLineForControlBlocks: boolean; + [s: string]: boolean | number | string; } interface DefinitionInfo { fileName: string; diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 692e07f317a..7889e492db6 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -5464,6 +5464,9 @@ declare module "typescript" { PlaceOpenBraceOnNewLineForControlBlocks: boolean; >PlaceOpenBraceOnNewLineForControlBlocks : boolean + + [s: string]: boolean | number | string; +>s : string } interface DefinitionInfo { >DefinitionInfo : DefinitionInfo From 67638cbc002bdeca4ccb259ad7393d2ed14680c8 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 16 Feb 2015 12:21:16 -0800 Subject: [PATCH 086/162] Make 'syntacticClassifierAbsent' non-optional. --- tests/cases/unittests/services/colorization.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/cases/unittests/services/colorization.ts b/tests/cases/unittests/services/colorization.ts index c834f85806d..890ced3b891 100644 --- a/tests/cases/unittests/services/colorization.ts +++ b/tests/cases/unittests/services/colorization.ts @@ -43,7 +43,7 @@ describe('Colorization', function () { } function testLexicalClassification(text: string, initialEndOfLineState: ts.EndOfLineState, ...expectedEntries: ClassificationEntry[]): void { - var result = classifier.getClassificationsForLine(text, initialEndOfLineState); + var result = classifier.getClassificationsForLine(text, initialEndOfLineState, /*syntacticClassifierAbsent*/ false); for (var i = 0, n = expectedEntries.length; i < n; i++) { var expectedEntry = expectedEntries[i]; From 3b967e3489450f04696a7813a678278f17e0415d Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Mon, 16 Feb 2015 12:45:03 -0800 Subject: [PATCH 087/162] Move 4000-coded type check errors to 2000s where they belong --- .../diagnosticInformationMap.generated.ts | 18 ++--- src/compiler/diagnosticMessages.json | 72 +++++++++---------- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index c6061e3570a..2c64f8ff4b0 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -304,6 +304,15 @@ module ts { super_cannot_be_referenced_in_a_computed_property_name: { code: 2466, category: DiagnosticCategory.Error, key: "'super' cannot be referenced in a computed property name." }, A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type: { code: 2466, category: DiagnosticCategory.Error, key: "A computed property name cannot reference a type parameter from its containing type." }, Spread_operator_in_new_expressions_is_only_available_when_targeting_ECMAScript_6_and_higher: { code: 2468, category: DiagnosticCategory.Error, key: "Spread operator in 'new' expressions is only available when targeting ECMAScript 6 and higher." }, + Enum_declarations_must_all_be_const_or_non_const: { code: 2469, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." }, + In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 2470, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression." }, + const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 2471, category: DiagnosticCategory.Error, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, + A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 2472, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal." }, + const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 2473, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to a non-finite value." }, + const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 2474, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, + Property_0_does_not_exist_on_const_enum_1: { code: 2475, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, + let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2476, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, + Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2477, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, @@ -373,15 +382,6 @@ module ts { Parameter_0_of_exported_function_has_or_is_using_name_1_from_private_module_2: { code: 4077, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using name '{1}' from private module '{2}'." }, Parameter_0_of_exported_function_has_or_is_using_private_name_1: { code: 4078, category: DiagnosticCategory.Error, key: "Parameter '{0}' of exported function has or is using private name '{1}'." }, Exported_type_alias_0_has_or_is_using_private_name_1: { code: 4081, category: DiagnosticCategory.Error, key: "Exported type alias '{0}' has or is using private name '{1}'." }, - Enum_declarations_must_all_be_const_or_non_const: { code: 4082, category: DiagnosticCategory.Error, key: "Enum declarations must all be const or non-const." }, - In_const_enum_declarations_member_initializer_must_be_constant_expression: { code: 4083, category: DiagnosticCategory.Error, key: "In 'const' enum declarations member initializer must be constant expression." }, - const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment: { code: 4084, category: DiagnosticCategory.Error, key: "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment." }, - A_const_enum_member_can_only_be_accessed_using_a_string_literal: { code: 4085, category: DiagnosticCategory.Error, key: "A const enum member can only be accessed using a string literal." }, - const_enum_member_initializer_was_evaluated_to_a_non_finite_value: { code: 4086, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to a non-finite value." }, - const_enum_member_initializer_was_evaluated_to_disallowed_value_NaN: { code: 4087, category: DiagnosticCategory.Error, key: "'const' enum member initializer was evaluated to disallowed value 'NaN'." }, - Property_0_does_not_exist_on_const_enum_1: { code: 4088, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, - let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 4089, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, - Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 4090, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, The_current_host_does_not_support_the_0_option: { code: 5001, category: DiagnosticCategory.Error, key: "The current host does not support the '{0}' option." }, Cannot_find_the_common_subdirectory_path_for_the_input_files: { code: 5009, category: DiagnosticCategory.Error, key: "Cannot find the common subdirectory path for the input files." }, Cannot_read_file_0_Colon_1: { code: 5012, category: DiagnosticCategory.Error, key: "Cannot read file '{0}': {1}" }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index fdeec58a705..8299e9f7733 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1208,6 +1208,42 @@ "category": "Error", "code": 2468 }, + "Enum declarations must all be const or non-const.": { + "category": "Error", + "code": 2469 + }, + "In 'const' enum declarations member initializer must be constant expression.": { + "category": "Error", + "code": 2470 + }, + "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.": { + "category": "Error", + "code": 2471 + }, + "A const enum member can only be accessed using a string literal.": { + "category": "Error", + "code": 2472 + }, + "'const' enum member initializer was evaluated to a non-finite value.": { + "category": "Error", + "code": 2473 + }, + "'const' enum member initializer was evaluated to disallowed value 'NaN'.": { + "category": "Error", + "code": 2474 + }, + "Property '{0}' does not exist on 'const' enum '{1}'.": { + "category": "Error", + "code": 2475 + }, + "'let' is not allowed to be used as a name in 'let' or 'const' declarations.": { + "category": "Error", + "code": 2476 + }, + "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'.": { + "category": "Error", + "code": 2477 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", @@ -1485,42 +1521,6 @@ "category": "Error", "code": 4081 }, - "Enum declarations must all be const or non-const.": { - "category": "Error", - "code": 4082 - }, - "In 'const' enum declarations member initializer must be constant expression.": { - "category": "Error", - "code": 4083 - }, - "'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.": { - "category": "Error", - "code": 4084 - }, - "A const enum member can only be accessed using a string literal.": { - "category": "Error", - "code": 4085 - }, - "'const' enum member initializer was evaluated to a non-finite value.": { - "category": "Error", - "code": 4086 - }, - "'const' enum member initializer was evaluated to disallowed value 'NaN'.": { - "category": "Error", - "code": 4087 - }, - "Property '{0}' does not exist on 'const' enum '{1}'.": { - "category": "Error", - "code": 4088 - }, - "'let' is not allowed to be used as a name in 'let' or 'const' declarations.": { - "category": "Error", - "code": 4089 - }, - "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'.": { - "category": "Error", - "code": 4090 - }, "The current host does not support the '{0}' option.": { "category": "Error", "code": 5001 From 87ea37f2e876b45755086f0e21b07d431ce5c8b9 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Mon, 16 Feb 2015 12:45:13 -0800 Subject: [PATCH 088/162] Accept baselines --- ...arationShadowedByVarDeclaration.errors.txt | 12 ++--- .../constEnumBadPropertyNames.errors.txt | 4 +- .../reference/constEnumErrors.errors.txt | 44 +++++++++---------- .../letInLetOrConstDeclarations.errors.txt | 12 ++--- .../shadowingViaLocalValue.errors.txt | 8 ++-- 5 files changed, 40 insertions(+), 40 deletions(-) diff --git a/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt b/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt index 99c02d87f45..ff669e41396 100644 --- a/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt +++ b/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(7,9): error TS4090: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. -tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(15,13): error TS4090: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'. -tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS4090: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'. +tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(7,9): error TS2477: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(15,13): error TS2477: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'. +tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS2477: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'. ==== tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts (3 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS var x = 0; ~ -!!! error TS4090: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +!!! error TS2477: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. } @@ -22,7 +22,7 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS { var y = 0; ~ -!!! error TS4090: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'. +!!! error TS2477: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'. } } @@ -31,5 +31,5 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS const z = 0; var z = 0 ~ -!!! error TS4090: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'. +!!! error TS2477: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'. } \ No newline at end of file diff --git a/tests/baselines/reference/constEnumBadPropertyNames.errors.txt b/tests/baselines/reference/constEnumBadPropertyNames.errors.txt index 7cccf86b1c8..52c78fa68ae 100644 --- a/tests/baselines/reference/constEnumBadPropertyNames.errors.txt +++ b/tests/baselines/reference/constEnumBadPropertyNames.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/constEnumBadPropertyNames.ts(2,11): error TS4088: Property 'B' does not exist on 'const' enum 'E'. +tests/cases/compiler/constEnumBadPropertyNames.ts(2,11): error TS2475: Property 'B' does not exist on 'const' enum 'E'. ==== tests/cases/compiler/constEnumBadPropertyNames.ts (1 errors) ==== const enum E { A } var x = E["B"] ~~~ -!!! error TS4088: Property 'B' does not exist on 'const' enum 'E'. \ No newline at end of file +!!! error TS2475: Property 'B' does not exist on 'const' enum 'E'. \ No newline at end of file diff --git a/tests/baselines/reference/constEnumErrors.errors.txt b/tests/baselines/reference/constEnumErrors.errors.txt index 53fed12f382..edd3044f0bc 100644 --- a/tests/baselines/reference/constEnumErrors.errors.txt +++ b/tests/baselines/reference/constEnumErrors.errors.txt @@ -1,16 +1,16 @@ tests/cases/compiler/constEnumErrors.ts(1,12): error TS2300: Duplicate identifier 'E'. tests/cases/compiler/constEnumErrors.ts(5,8): error TS2300: Duplicate identifier 'E'. -tests/cases/compiler/constEnumErrors.ts(12,9): error TS4083: In 'const' enum declarations member initializer must be constant expression. -tests/cases/compiler/constEnumErrors.ts(14,9): error TS4083: In 'const' enum declarations member initializer must be constant expression. -tests/cases/compiler/constEnumErrors.ts(15,10): error TS4083: In 'const' enum declarations member initializer must be constant expression. -tests/cases/compiler/constEnumErrors.ts(22,13): error TS4085: A const enum member can only be accessed using a string literal. -tests/cases/compiler/constEnumErrors.ts(24,13): error TS4085: A const enum member can only be accessed using a string literal. -tests/cases/compiler/constEnumErrors.ts(26,9): error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. -tests/cases/compiler/constEnumErrors.ts(27,10): error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. -tests/cases/compiler/constEnumErrors.ts(32,5): error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. -tests/cases/compiler/constEnumErrors.ts(40,9): error TS4086: 'const' enum member initializer was evaluated to a non-finite value. -tests/cases/compiler/constEnumErrors.ts(41,9): error TS4086: 'const' enum member initializer was evaluated to a non-finite value. -tests/cases/compiler/constEnumErrors.ts(42,9): error TS4087: 'const' enum member initializer was evaluated to disallowed value 'NaN'. +tests/cases/compiler/constEnumErrors.ts(12,9): error TS2470: In 'const' enum declarations member initializer must be constant expression. +tests/cases/compiler/constEnumErrors.ts(14,9): error TS2470: In 'const' enum declarations member initializer must be constant expression. +tests/cases/compiler/constEnumErrors.ts(15,10): error TS2470: In 'const' enum declarations member initializer must be constant expression. +tests/cases/compiler/constEnumErrors.ts(22,13): error TS2472: A const enum member can only be accessed using a string literal. +tests/cases/compiler/constEnumErrors.ts(24,13): error TS2472: A const enum member can only be accessed using a string literal. +tests/cases/compiler/constEnumErrors.ts(26,9): error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +tests/cases/compiler/constEnumErrors.ts(27,10): error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +tests/cases/compiler/constEnumErrors.ts(32,5): error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +tests/cases/compiler/constEnumErrors.ts(40,9): error TS2473: 'const' enum member initializer was evaluated to a non-finite value. +tests/cases/compiler/constEnumErrors.ts(41,9): error TS2473: 'const' enum member initializer was evaluated to a non-finite value. +tests/cases/compiler/constEnumErrors.ts(42,9): error TS2474: 'const' enum member initializer was evaluated to disallowed value 'NaN'. ==== tests/cases/compiler/constEnumErrors.ts (13 errors) ==== @@ -31,14 +31,14 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS4087: 'const' enum member // forward reference to the element of the same enum X = Y, ~ -!!! error TS4083: In 'const' enum declarations member initializer must be constant expression. +!!! error TS2470: In 'const' enum declarations member initializer must be constant expression. // forward reference to the element of the same enum Y = E1.Z, ~~~~ -!!! error TS4083: In 'const' enum declarations member initializer must be constant expression. +!!! error TS2470: In 'const' enum declarations member initializer must be constant expression. Y1 = E1["Z"] ~~~~~~~ -!!! error TS4083: In 'const' enum declarations member initializer must be constant expression. +!!! error TS2470: In 'const' enum declarations member initializer must be constant expression. } const enum E2 { @@ -47,25 +47,25 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS4087: 'const' enum member var y0 = E2[1] ~ -!!! error TS4085: A const enum member can only be accessed using a string literal. +!!! error TS2472: A const enum member can only be accessed using a string literal. var name = "A"; var y1 = E2[name]; ~~~~ -!!! error TS4085: A const enum member can only be accessed using a string literal. +!!! error TS2472: A const enum member can only be accessed using a string literal. var x = E2; ~~ -!!! error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +!!! error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. var y = [E2]; ~~ -!!! error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +!!! error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. function foo(t: any): void { } foo(E2); ~~ -!!! error TS4084: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +!!! error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. const enum NaNOrInfinity { A = 9007199254740992, @@ -75,11 +75,11 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS4087: 'const' enum member E = D * D, F = E * E, // overflow ~~~~~ -!!! error TS4086: 'const' enum member initializer was evaluated to a non-finite value. +!!! error TS2473: 'const' enum member initializer was evaluated to a non-finite value. G = 1 / 0, // overflow ~~~~~ -!!! error TS4086: 'const' enum member initializer was evaluated to a non-finite value. +!!! error TS2473: 'const' enum member initializer was evaluated to a non-finite value. H = 0 / 0 // NaN ~~~~~ -!!! error TS4087: 'const' enum member initializer was evaluated to disallowed value 'NaN'. +!!! error TS2474: 'const' enum member initializer was evaluated to disallowed value 'NaN'. } \ No newline at end of file diff --git a/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt b/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt index 93dc307fc85..799d2d6b698 100644 --- a/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt +++ b/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt @@ -1,21 +1,21 @@ -tests/cases/compiler/letInLetOrConstDeclarations.ts(2,9): error TS4089: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. -tests/cases/compiler/letInLetOrConstDeclarations.ts(3,14): error TS4089: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. -tests/cases/compiler/letInLetOrConstDeclarations.ts(6,11): error TS4089: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetOrConstDeclarations.ts(2,9): error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetOrConstDeclarations.ts(3,14): error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetOrConstDeclarations.ts(6,11): error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. ==== tests/cases/compiler/letInLetOrConstDeclarations.ts (3 errors) ==== { let let = 1; // should error ~~~ -!!! error TS4089: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +!!! error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. for (let let in []) { } // should error ~~~ -!!! error TS4089: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +!!! error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. } { const let = 1; // should error ~~~ -!!! error TS4089: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +!!! error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. } { function let() { // should be ok diff --git a/tests/baselines/reference/shadowingViaLocalValue.errors.txt b/tests/baselines/reference/shadowingViaLocalValue.errors.txt index 2a585ba8b7d..5e683d3ee6f 100644 --- a/tests/baselines/reference/shadowingViaLocalValue.errors.txt +++ b/tests/baselines/reference/shadowingViaLocalValue.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/shadowingViaLocalValue.ts(2,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/shadowingViaLocalValue.ts(4,13): error TS4090: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +tests/cases/compiler/shadowingViaLocalValue.ts(4,13): error TS2477: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. tests/cases/compiler/shadowingViaLocalValue.ts(9,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS4090: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. +tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS2477: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. ==== tests/cases/compiler/shadowingViaLocalValue.ts (4 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS4090: Cannot init { var x = 1; ~ -!!! error TS4090: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +!!! error TS2477: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. } } @@ -23,7 +23,7 @@ tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS4090: Cannot init { for (var x1 = 0; ;); ~~ -!!! error TS4090: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. +!!! error TS2477: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. } } From 935c6024c27593388a00bc1975f21e5e291b41a9 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Mon, 16 Feb 2015 13:48:36 -0800 Subject: [PATCH 089/162] Rebaseline after merge --- ...arationShadowedByVarDeclaration.errors.txt | 12 ++--- .../constEnumBadPropertyNames.errors.txt | 4 +- .../reference/constEnumErrors.errors.txt | 44 +++++++++---------- .../letInLetOrConstDeclarations.errors.txt | 12 ++--- .../shadowingViaLocalValue.errors.txt | 8 ++-- 5 files changed, 40 insertions(+), 40 deletions(-) diff --git a/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt b/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt index ff669e41396..24af601139f 100644 --- a/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt +++ b/tests/baselines/reference/constDeclarationShadowedByVarDeclaration.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(7,9): error TS2477: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. -tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(15,13): error TS2477: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'. -tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS2477: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'. +tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(7,9): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(15,13): error TS2481: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'. +tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS2481: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'. ==== tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts (3 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS var x = 0; ~ -!!! error TS2477: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. } @@ -22,7 +22,7 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS { var y = 0; ~ -!!! error TS2477: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'. +!!! error TS2481: Cannot initialize outer scoped variable 'y' in the same scope as block scoped declaration 'y'. } } @@ -31,5 +31,5 @@ tests/cases/compiler/constDeclarationShadowedByVarDeclaration.ts(22,7): error TS const z = 0; var z = 0 ~ -!!! error TS2477: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'. +!!! error TS2481: Cannot initialize outer scoped variable 'z' in the same scope as block scoped declaration 'z'. } \ No newline at end of file diff --git a/tests/baselines/reference/constEnumBadPropertyNames.errors.txt b/tests/baselines/reference/constEnumBadPropertyNames.errors.txt index 52c78fa68ae..f2330617dea 100644 --- a/tests/baselines/reference/constEnumBadPropertyNames.errors.txt +++ b/tests/baselines/reference/constEnumBadPropertyNames.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/constEnumBadPropertyNames.ts(2,11): error TS2475: Property 'B' does not exist on 'const' enum 'E'. +tests/cases/compiler/constEnumBadPropertyNames.ts(2,11): error TS2479: Property 'B' does not exist on 'const' enum 'E'. ==== tests/cases/compiler/constEnumBadPropertyNames.ts (1 errors) ==== const enum E { A } var x = E["B"] ~~~ -!!! error TS2475: Property 'B' does not exist on 'const' enum 'E'. \ No newline at end of file +!!! error TS2479: Property 'B' does not exist on 'const' enum 'E'. \ No newline at end of file diff --git a/tests/baselines/reference/constEnumErrors.errors.txt b/tests/baselines/reference/constEnumErrors.errors.txt index edd3044f0bc..be7dad54eeb 100644 --- a/tests/baselines/reference/constEnumErrors.errors.txt +++ b/tests/baselines/reference/constEnumErrors.errors.txt @@ -1,16 +1,16 @@ tests/cases/compiler/constEnumErrors.ts(1,12): error TS2300: Duplicate identifier 'E'. tests/cases/compiler/constEnumErrors.ts(5,8): error TS2300: Duplicate identifier 'E'. -tests/cases/compiler/constEnumErrors.ts(12,9): error TS2470: In 'const' enum declarations member initializer must be constant expression. -tests/cases/compiler/constEnumErrors.ts(14,9): error TS2470: In 'const' enum declarations member initializer must be constant expression. -tests/cases/compiler/constEnumErrors.ts(15,10): error TS2470: In 'const' enum declarations member initializer must be constant expression. -tests/cases/compiler/constEnumErrors.ts(22,13): error TS2472: A const enum member can only be accessed using a string literal. -tests/cases/compiler/constEnumErrors.ts(24,13): error TS2472: A const enum member can only be accessed using a string literal. -tests/cases/compiler/constEnumErrors.ts(26,9): error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. -tests/cases/compiler/constEnumErrors.ts(27,10): error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. -tests/cases/compiler/constEnumErrors.ts(32,5): error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. -tests/cases/compiler/constEnumErrors.ts(40,9): error TS2473: 'const' enum member initializer was evaluated to a non-finite value. -tests/cases/compiler/constEnumErrors.ts(41,9): error TS2473: 'const' enum member initializer was evaluated to a non-finite value. -tests/cases/compiler/constEnumErrors.ts(42,9): error TS2474: 'const' enum member initializer was evaluated to disallowed value 'NaN'. +tests/cases/compiler/constEnumErrors.ts(12,9): error TS2474: In 'const' enum declarations member initializer must be constant expression. +tests/cases/compiler/constEnumErrors.ts(14,9): error TS2474: In 'const' enum declarations member initializer must be constant expression. +tests/cases/compiler/constEnumErrors.ts(15,10): error TS2474: In 'const' enum declarations member initializer must be constant expression. +tests/cases/compiler/constEnumErrors.ts(22,13): error TS2476: A const enum member can only be accessed using a string literal. +tests/cases/compiler/constEnumErrors.ts(24,13): error TS2476: A const enum member can only be accessed using a string literal. +tests/cases/compiler/constEnumErrors.ts(26,9): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +tests/cases/compiler/constEnumErrors.ts(27,10): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +tests/cases/compiler/constEnumErrors.ts(32,5): error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +tests/cases/compiler/constEnumErrors.ts(40,9): error TS2477: 'const' enum member initializer was evaluated to a non-finite value. +tests/cases/compiler/constEnumErrors.ts(41,9): error TS2477: 'const' enum member initializer was evaluated to a non-finite value. +tests/cases/compiler/constEnumErrors.ts(42,9): error TS2478: 'const' enum member initializer was evaluated to disallowed value 'NaN'. ==== tests/cases/compiler/constEnumErrors.ts (13 errors) ==== @@ -31,14 +31,14 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS2474: 'const' enum member // forward reference to the element of the same enum X = Y, ~ -!!! error TS2470: In 'const' enum declarations member initializer must be constant expression. +!!! error TS2474: In 'const' enum declarations member initializer must be constant expression. // forward reference to the element of the same enum Y = E1.Z, ~~~~ -!!! error TS2470: In 'const' enum declarations member initializer must be constant expression. +!!! error TS2474: In 'const' enum declarations member initializer must be constant expression. Y1 = E1["Z"] ~~~~~~~ -!!! error TS2470: In 'const' enum declarations member initializer must be constant expression. +!!! error TS2474: In 'const' enum declarations member initializer must be constant expression. } const enum E2 { @@ -47,25 +47,25 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS2474: 'const' enum member var y0 = E2[1] ~ -!!! error TS2472: A const enum member can only be accessed using a string literal. +!!! error TS2476: A const enum member can only be accessed using a string literal. var name = "A"; var y1 = E2[name]; ~~~~ -!!! error TS2472: A const enum member can only be accessed using a string literal. +!!! error TS2476: A const enum member can only be accessed using a string literal. var x = E2; ~~ -!!! error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. var y = [E2]; ~~ -!!! error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. function foo(t: any): void { } foo(E2); ~~ -!!! error TS2471: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. +!!! error TS2475: 'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment. const enum NaNOrInfinity { A = 9007199254740992, @@ -75,11 +75,11 @@ tests/cases/compiler/constEnumErrors.ts(42,9): error TS2474: 'const' enum member E = D * D, F = E * E, // overflow ~~~~~ -!!! error TS2473: 'const' enum member initializer was evaluated to a non-finite value. +!!! error TS2477: 'const' enum member initializer was evaluated to a non-finite value. G = 1 / 0, // overflow ~~~~~ -!!! error TS2473: 'const' enum member initializer was evaluated to a non-finite value. +!!! error TS2477: 'const' enum member initializer was evaluated to a non-finite value. H = 0 / 0 // NaN ~~~~~ -!!! error TS2474: 'const' enum member initializer was evaluated to disallowed value 'NaN'. +!!! error TS2478: 'const' enum member initializer was evaluated to disallowed value 'NaN'. } \ No newline at end of file diff --git a/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt b/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt index 799d2d6b698..fbcee276583 100644 --- a/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt +++ b/tests/baselines/reference/letInLetOrConstDeclarations.errors.txt @@ -1,21 +1,21 @@ -tests/cases/compiler/letInLetOrConstDeclarations.ts(2,9): error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. -tests/cases/compiler/letInLetOrConstDeclarations.ts(3,14): error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. -tests/cases/compiler/letInLetOrConstDeclarations.ts(6,11): error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetOrConstDeclarations.ts(2,9): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetOrConstDeclarations.ts(3,14): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +tests/cases/compiler/letInLetOrConstDeclarations.ts(6,11): error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. ==== tests/cases/compiler/letInLetOrConstDeclarations.ts (3 errors) ==== { let let = 1; // should error ~~~ -!!! error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. for (let let in []) { } // should error ~~~ -!!! error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. } { const let = 1; // should error ~~~ -!!! error TS2476: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. +!!! error TS2480: 'let' is not allowed to be used as a name in 'let' or 'const' declarations. } { function let() { // should be ok diff --git a/tests/baselines/reference/shadowingViaLocalValue.errors.txt b/tests/baselines/reference/shadowingViaLocalValue.errors.txt index 5e683d3ee6f..8e6f16b91cc 100644 --- a/tests/baselines/reference/shadowingViaLocalValue.errors.txt +++ b/tests/baselines/reference/shadowingViaLocalValue.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/shadowingViaLocalValue.ts(2,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/shadowingViaLocalValue.ts(4,13): error TS2477: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +tests/cases/compiler/shadowingViaLocalValue.ts(4,13): error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. tests/cases/compiler/shadowingViaLocalValue.ts(9,5): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. -tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS2477: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. +tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS2481: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. ==== tests/cases/compiler/shadowingViaLocalValue.ts (4 errors) ==== @@ -12,7 +12,7 @@ tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS2477: Cannot init { var x = 1; ~ -!!! error TS2477: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. +!!! error TS2481: Cannot initialize outer scoped variable 'x' in the same scope as block scoped declaration 'x'. } } @@ -23,7 +23,7 @@ tests/cases/compiler/shadowingViaLocalValue.ts(11,18): error TS2477: Cannot init { for (var x1 = 0; ;); ~~ -!!! error TS2477: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. +!!! error TS2481: Cannot initialize outer scoped variable 'x1' in the same scope as block scoped declaration 'x1'. } } From fee50a6dbc6132fb8a3cdf3596db0cd161cb9045 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Mon, 16 Feb 2015 14:59:22 -0800 Subject: [PATCH 090/162] Made the actual implementation of the lexical classifier be non-optional. --- src/services/services.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index 0a901f0df0b..6e3cdf0a344 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -5680,7 +5680,7 @@ module ts { keyword2 === SyntaxKind.ConstructorKeyword || keyword2 === SyntaxKind.StaticKeyword) { - // Allow things like "public get", "public constructor" and "public static". + // Allow things like "public get", "public constructor" and "public static". // These are all legal. return true; } @@ -5697,7 +5697,7 @@ module ts { // If there is a syntactic classifier ('syntacticClassifierAbsent' is false), // we will be more conservative in order to avoid conflicting with the syntactic classifier. - function getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): ClassificationResult { + function getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult { var offset = 0; var token = SyntaxKind.Unknown; var lastNonTriviaToken = SyntaxKind.Unknown; From 35b489d7d1ca6da4c2440e65a7f0215bdc951499 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 15:20:05 -0800 Subject: [PATCH 091/162] Rename our one-based methods to more clearly indicate that that's what base they use. --- src/compiler/emitter.ts | 10 +++++----- src/compiler/scanner.ts | 12 ++++++------ src/compiler/tsc.ts | 4 ++-- src/compiler/utilities.ts | 2 +- src/harness/fourslash.ts | 6 +++--- src/harness/harnessLanguageService.ts | 8 ++++---- src/services/formatting/smartIndenter.ts | 2 +- src/services/services.ts | 8 ++++---- 8 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 6a2338268e8..86a8ca584a2 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -134,7 +134,7 @@ module ts { } function getLineOfLocalPosition(currentSourceFile: SourceFile, pos: number) { - return getLineAndCharacterOfPosition(currentSourceFile, pos).line; + return getOneBasedLineAndCharacterOfPosition(currentSourceFile, pos).line; } function emitNewLineBeforeLeadingComments(currentSourceFile: SourceFile, writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]) { @@ -169,16 +169,16 @@ module ts { function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string){ if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { - var firstCommentLineAndCharacter = getLineAndCharacterOfPosition(currentSourceFile, comment.pos); + var firstCommentLineAndCharacter = getOneBasedLineAndCharacterOfPosition(currentSourceFile, comment.pos); var lastLine = getLineStarts(currentSourceFile).length; var firstCommentLineIndent: number; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = currentLine === lastLine ? (comment.end + 1) : getPositionFromLineAndCharacter(currentSourceFile, currentLine + 1, /*character*/1); + var nextLineStart = currentLine === lastLine ? (comment.end + 1) : getPositionFromOneBasedLineAndCharacter(currentSourceFile, currentLine + 1, /*character*/1); if (pos !== comment.pos) { // If we are not emitting first line, we need to write the spaces to adjust the alignment if (firstCommentLineIndent === undefined) { - firstCommentLineIndent = calculateIndent(getPositionFromLineAndCharacter(currentSourceFile, firstCommentLineAndCharacter.line, /*character*/1), + firstCommentLineIndent = calculateIndent(getPositionFromOneBasedLineAndCharacter(currentSourceFile, firstCommentLineAndCharacter.line, /*character*/1), comment.pos); } @@ -1733,7 +1733,7 @@ module ts { } function recordSourceMapSpan(pos: number) { - var sourceLinePos = getLineAndCharacterOfPosition(currentSourceFile, pos); + var sourceLinePos = getOneBasedLineAndCharacterOfPosition(currentSourceFile, pos); var emittedLine = writer.getLine(); var emittedColumn = writer.getColumn(); diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index fbbd69bbd69..bf5c4116074 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -278,11 +278,11 @@ module ts { return result; } - export function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { - return computePositionFromLineAndCharacter(getLineStarts(sourceFile), line, character); + export function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { + return computePositionFromOneBasedLineAndCharacter(getLineStarts(sourceFile), line, character); } - export function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number { + export function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number { Debug.assert(line > 0 && line <= lineStarts.length); return lineStarts[line - 1] + character - 1; } @@ -291,7 +291,7 @@ module ts { return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text)); } - export function computeLineAndCharacterOfPosition(lineStarts: number[], position: number) { + export function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number) { var lineNumber = binarySearch(lineStarts, position); if (lineNumber < 0) { // If the actual position was not found, @@ -306,8 +306,8 @@ module ts { }; } - export function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter { - return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); + export function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter { + return computeOneBasedLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } var hasOwnProperty = Object.prototype.hasOwnProperty; diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 3f7e6362e19..84d8a25e790 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -72,7 +72,7 @@ module ts { function countLines(program: Program): number { var count = 0; forEach(program.getSourceFiles(), file => { - count += getLineAndCharacterOfPosition(file, file.end).line; + count += getOneBasedLineAndCharacterOfPosition(file, file.end).line; }); return count; } @@ -86,7 +86,7 @@ module ts { var output = ""; if (diagnostic.file) { - var loc = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); + var loc = getOneBasedLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); output += diagnostic.file.fileName + "(" + loc.line + "," + loc.character + "): "; } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 5a50e2799dc..6323ffd4313 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -108,7 +108,7 @@ module ts { // This is a useful function for debugging purposes. export function nodePosToString(node: Node): string { var file = getSourceFileOfNode(node); - var loc = getLineAndCharacterOfPosition(file, node.pos); + var loc = getOneBasedLineAndCharacterOfPosition(file, node.pos); return file.fileName + "(" + loc.line + "," + loc.character + ")"; } diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 603a78b5f75..8511d042194 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -395,7 +395,7 @@ module FourSlash { this.currentCaretPosition = pos; var lineStarts = ts.computeLineStarts(this.getFileContent(this.activeFile.fileName)); - var lineCharPos = ts.computeLineAndCharacterOfPosition(lineStarts, pos); + var lineCharPos = ts.computeOneBasedLineAndCharacterOfPosition(lineStarts, pos); this.scenarioActions.push(''); } @@ -2033,7 +2033,7 @@ module FourSlash { } private getCurrentCaretFilePosition() { - var result = this.languageServiceAdapterHost.positionToZeroBasedLineCol(this.activeFile.fileName, this.currentCaretPosition); + var result = this.languageServiceAdapterHost.positionToZeroBasedLineAndCharacter(this.activeFile.fileName, this.currentCaretPosition); if (result.line >= 0) { result.line++; } @@ -2120,7 +2120,7 @@ module FourSlash { } private getLineColStringAtPosition(position: number) { - var pos = this.languageServiceAdapterHost.positionToZeroBasedLineCol(this.activeFile.fileName, position); + var pos = this.languageServiceAdapterHost.positionToZeroBasedLineAndCharacter(this.activeFile.fileName, position); return 'line ' + (pos.line + 1) + ', col ' + pos.character; } diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 2f95f5072d0..f0d788a1c6b 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -175,18 +175,18 @@ module Harness.LanguageService { assert.isTrue(line >= 1); assert.isTrue(col >= 1); - return ts.computePositionFromLineAndCharacter(script.lineMap, line, col); + return ts.computePositionFromOneBasedLineAndCharacter(script.lineMap, line, col); } /** * @param line 0 based index * @param col 0 based index */ - public positionToZeroBasedLineCol(fileName: string, position: number): ts.LineAndCharacter { + public positionToZeroBasedLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { var script: ScriptInfo = this.fileNameToScript[fileName]; assert.isNotNull(script); - var result = ts.computeLineAndCharacterOfPosition(script.lineMap, position); + var result = ts.computeOneBasedLineAndCharacterOfPosition(script.lineMap, position); assert.isTrue(result.line >= 1); assert.isTrue(result.character >= 1); @@ -239,7 +239,7 @@ module Harness.LanguageService { updateScript(fileName: string, content: string): void { return this.nativeHost.updateScript(fileName, content); } editScript(fileName: string, minChar: number, limChar: number, newText: string): void { this.nativeHost.editScript(fileName, minChar, limChar, newText); } lineColToPosition(fileName: string, line: number, col: number): number { return this.nativeHost.lineColToPosition(fileName, line, col); } - positionToZeroBasedLineCol(fileName: string, position: number): ts.LineAndCharacter { return this.nativeHost.positionToZeroBasedLineCol(fileName, position); } + positionToZeroBasedLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { return this.nativeHost.positionToZeroBasedLineAndCharacter(fileName, position); } getCompilationSettings(): string { return JSON.stringify(this.nativeHost.getCompilationSettings()); } getCancellationToken(): ts.CancellationToken { return this.nativeHost.getCancellationToken(); } diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 3aa97fe6ae6..efc279cfca6 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -303,7 +303,7 @@ module ts.formatting { } function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter: LineAndCharacter, sourceFile: SourceFile, options: EditorOptions): number { - var lineStart = sourceFile.getPositionFromLineAndCharacter(lineAndCharacter.line, 1); + var lineStart = sourceFile.getPositionFromOneBasedLineAndCharacter(lineAndCharacter.line, 1); return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options); } diff --git a/src/services/services.ts b/src/services/services.ts index 6e3cdf0a344..07a0bac2dc6 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -63,7 +63,7 @@ module ts { getNamedDeclarations(): Declaration[]; getLineAndCharacterFromPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } @@ -751,15 +751,15 @@ module ts { } public getLineAndCharacterFromPosition(position: number): LineAndCharacter { - return getLineAndCharacterOfPosition(this, position); + return getOneBasedLineAndCharacterOfPosition(this, position); } public getLineStarts(): number[] { return getLineStarts(this); } - public getPositionFromLineAndCharacter(line: number, character: number): number { - return getPositionFromLineAndCharacter(this, line, character); + public getPositionFromOneBasedLineAndCharacter(line: number, character: number): number { + return getPositionFromOneBasedLineAndCharacter(this, line, character); } public getNamedDeclarations() { From 78cfbb6e5024ac32c15cb2b082796fcf36854f0b Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 15:20:40 -0800 Subject: [PATCH 092/162] Update baselines. --- .../baselines/reference/APISample_compile.js | 10 +++++----- .../reference/APISample_compile.types | 20 +++++++++---------- tests/baselines/reference/APISample_linter.js | 10 +++++----- .../reference/APISample_linter.types | 20 +++++++++---------- .../reference/APISample_transform.js | 10 +++++----- .../reference/APISample_transform.types | 20 +++++++++---------- .../baselines/reference/APISample_watcher.js | 10 +++++----- .../reference/APISample_watcher.types | 20 +++++++++---------- 8 files changed, 60 insertions(+), 60 deletions(-) diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index b91a706aa45..83951d237a3 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -1384,14 +1384,14 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; - function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { + function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; character: number; }; - function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; + function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; function isWhiteSpace(ch: number): boolean; function isLineBreak(ch: number): boolean; function isOctalDigit(ch: number): boolean; @@ -1471,7 +1471,7 @@ declare module "typescript" { getNamedDeclarations(): Declaration[]; getLineAndCharacterFromPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index ae53c666807..18b6f84c702 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -4368,15 +4368,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionFromOneBasedLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionFromOneBasedLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -4386,8 +4386,8 @@ declare module "typescript" { >sourceFile : SourceFile >SourceFile : SourceFile - function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { ->computeLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } + function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): { +>computeOneBasedLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } >lineStarts : number[] >position : number @@ -4398,8 +4398,8 @@ declare module "typescript" { >character : number }; - function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; ->getLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter + function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; +>getOneBasedLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter >sourceFile : SourceFile >SourceFile : SourceFile >position : number @@ -4743,8 +4743,8 @@ declare module "typescript" { getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromLineAndCharacter(line: number, character: number): number; ->getPositionFromLineAndCharacter : (line: number, character: number) => number + getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; +>getPositionFromOneBasedLineAndCharacter : (line: number, character: number) => number >line : number >character : number diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 68c13edb7db..0b090bebd7f 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -1415,14 +1415,14 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; - function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { + function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; character: number; }; - function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; + function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; function isWhiteSpace(ch: number): boolean; function isLineBreak(ch: number): boolean; function isOctalDigit(ch: number): boolean; @@ -1502,7 +1502,7 @@ declare module "typescript" { getNamedDeclarations(): Declaration[]; getLineAndCharacterFromPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 0c153e7b1dc..5e25227836b 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -4512,15 +4512,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionFromOneBasedLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionFromOneBasedLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -4530,8 +4530,8 @@ declare module "typescript" { >sourceFile : SourceFile >SourceFile : SourceFile - function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { ->computeLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } + function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): { +>computeOneBasedLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } >lineStarts : number[] >position : number @@ -4542,8 +4542,8 @@ declare module "typescript" { >character : number }; - function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; ->getLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter + function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; +>getOneBasedLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter >sourceFile : SourceFile >SourceFile : SourceFile >position : number @@ -4887,8 +4887,8 @@ declare module "typescript" { getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromLineAndCharacter(line: number, character: number): number; ->getPositionFromLineAndCharacter : (line: number, character: number) => number + getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; +>getPositionFromOneBasedLineAndCharacter : (line: number, character: number) => number >line : number >character : number diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 0e80f6b55b9..4e933d72b3e 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -1416,14 +1416,14 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; - function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { + function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; character: number; }; - function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; + function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; function isWhiteSpace(ch: number): boolean; function isLineBreak(ch: number): boolean; function isOctalDigit(ch: number): boolean; @@ -1503,7 +1503,7 @@ declare module "typescript" { getNamedDeclarations(): Declaration[]; getLineAndCharacterFromPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 0c201b0a5fd..5d39868e610 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -4464,15 +4464,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionFromOneBasedLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionFromOneBasedLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -4482,8 +4482,8 @@ declare module "typescript" { >sourceFile : SourceFile >SourceFile : SourceFile - function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { ->computeLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } + function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): { +>computeOneBasedLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } >lineStarts : number[] >position : number @@ -4494,8 +4494,8 @@ declare module "typescript" { >character : number }; - function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; ->getLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter + function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; +>getOneBasedLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter >sourceFile : SourceFile >SourceFile : SourceFile >position : number @@ -4839,8 +4839,8 @@ declare module "typescript" { getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromLineAndCharacter(line: number, character: number): number; ->getPositionFromLineAndCharacter : (line: number, character: number) => number + getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; +>getPositionFromOneBasedLineAndCharacter : (line: number, character: number) => number >line : number >character : number diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 27a2ce5e415..0ab43d3f64f 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -1453,14 +1453,14 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; - function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { + function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; character: number; }; - function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; + function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; function isWhiteSpace(ch: number): boolean; function isLineBreak(ch: number): boolean; function isOctalDigit(ch: number): boolean; @@ -1540,7 +1540,7 @@ declare module "typescript" { getNamedDeclarations(): Declaration[]; getLineAndCharacterFromPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromLineAndCharacter(line: number, character: number): number; + getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 4e137cae59d..824ca033f2b 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -4637,15 +4637,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionFromOneBasedLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionFromOneBasedLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -4655,8 +4655,8 @@ declare module "typescript" { >sourceFile : SourceFile >SourceFile : SourceFile - function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { ->computeLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } + function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): { +>computeOneBasedLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } >lineStarts : number[] >position : number @@ -4667,8 +4667,8 @@ declare module "typescript" { >character : number }; - function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; ->getLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter + function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; +>getOneBasedLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter >sourceFile : SourceFile >SourceFile : SourceFile >position : number @@ -5012,8 +5012,8 @@ declare module "typescript" { getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromLineAndCharacter(line: number, character: number): number; ->getPositionFromLineAndCharacter : (line: number, character: number) => number + getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; +>getPositionFromOneBasedLineAndCharacter : (line: number, character: number) => number >line : number >character : number From 11a9df2cc95c7859d5a08a14e9c39e6f5938d720 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 15:30:21 -0800 Subject: [PATCH 093/162] Expose zero-based helpers that code will be able to call. --- src/compiler/scanner.ts | 13 ++++++++ src/harness/harness.ts | 2 +- src/harness/typeWriter.ts | 2 +- src/services/breakpoints.ts | 8 ++--- src/services/formatting/formatting.ts | 32 ++++++++++---------- src/services/formatting/formattingContext.ts | 12 ++++---- src/services/formatting/smartIndenter.ts | 12 ++++---- src/services/services.ts | 6 ++-- src/services/utilities.ts | 4 +-- 9 files changed, 52 insertions(+), 39 deletions(-) diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index bf5c4116074..a7ff60ebd34 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -278,6 +278,10 @@ module ts { return result; } + export function getPositionFromZeroBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { + return computePositionFromOneBasedLineAndCharacter(getLineStarts(sourceFile), line + 1, character + 1); + } + export function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { return computePositionFromOneBasedLineAndCharacter(getLineStarts(sourceFile), line, character); } @@ -291,6 +295,11 @@ module ts { return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text)); } + export function computeZeroBasedLineAndCharacterOfPosition(lineStarts: number[], position: number) { + var oneBased = computeOneBasedLineAndCharacterOfPosition(lineStarts, position); + return { line: oneBased.line - 1, character: oneBased.character -1 }; + } + export function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number) { var lineNumber = binarySearch(lineStarts, position); if (lineNumber < 0) { @@ -306,6 +315,10 @@ module ts { }; } + export function getZeroBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter { + return computeZeroBasedLineAndCharacterOfPosition(getLineStarts(sourceFile), position); + } + export function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter { return computeOneBasedLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 86a68af1145..9e4d49c267d 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -1184,7 +1184,7 @@ module Harness { } export function getMinimalDiagnostic(err: ts.Diagnostic): HarnessDiagnostic { - var errorLineInfo = err.file ? err.file.getLineAndCharacterFromPosition(err.start) : { line: 0, character: 0 }; + var errorLineInfo = err.file ? err.file.getOneBasedLineAndCharacterFromPosition(err.start) : { line: 0, character: 0 }; return { fileName: err.file && err.file.fileName, start: err.start, diff --git a/src/harness/typeWriter.ts b/src/harness/typeWriter.ts index 1d8b3efef68..8747265d218 100644 --- a/src/harness/typeWriter.ts +++ b/src/harness/typeWriter.ts @@ -85,7 +85,7 @@ class TypeWriterWalker { private log(node: ts.Node, type: ts.Type): void { var actualPos = ts.skipTrivia(this.currentSourceFile.text, node.pos); - var lineAndCharacter = this.currentSourceFile.getLineAndCharacterFromPosition(actualPos); + var lineAndCharacter = this.currentSourceFile.getOneBasedLineAndCharacterFromPosition(actualPos); var sourceText = ts.getTextOfNodeFromSourceText(this.currentSourceFile.text, node); // If we got an unknown type, we temporarily want to fall back to just pretending the name diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index e49d035559b..68932e32fad 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -14,8 +14,8 @@ module ts.BreakpointResolver { } var tokenAtLocation = getTokenAtPosition(sourceFile, position); - var lineOfPosition = sourceFile.getLineAndCharacterFromPosition(position).line; - if (sourceFile.getLineAndCharacterFromPosition(tokenAtLocation.getStart()).line > lineOfPosition) { + var lineOfPosition = sourceFile.getOneBasedLineAndCharacterFromPosition(position).line; + if (sourceFile.getOneBasedLineAndCharacterFromPosition(tokenAtLocation.getStart()).line > lineOfPosition) { // Get previous token if the token is returned starts on new line // eg: var x =10; |--- curser is here // var y = 10; @@ -24,7 +24,7 @@ module ts.BreakpointResolver { tokenAtLocation = findPrecedingToken(tokenAtLocation.pos, sourceFile); // Its a blank line - if (!tokenAtLocation || sourceFile.getLineAndCharacterFromPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { + if (!tokenAtLocation || sourceFile.getOneBasedLineAndCharacterFromPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { return undefined; } } @@ -42,7 +42,7 @@ module ts.BreakpointResolver { } function spanInNodeIfStartsOnSameLine(node: Node, otherwiseOnNode?: Node): TextSpan { - if (node && lineOfPosition === sourceFile.getLineAndCharacterFromPosition(node.getStart()).line) { + if (node && lineOfPosition === sourceFile.getOneBasedLineAndCharacterFromPosition(node.getStart()).line) { return spanInNode(node); } return spanInNode(otherwiseOnNode); diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 969f7260744..1d3410c189c 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -67,7 +67,7 @@ module ts.formatting { } export function formatOnEnter(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[] { - var line = sourceFile.getLineAndCharacterFromPosition(position).line; + var line = sourceFile.getOneBasedLineAndCharacterFromPosition(position).line; if (line === 1) { return []; } @@ -100,7 +100,7 @@ module ts.formatting { export function formatSelection(start: number, end: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[] { // format from the beginning of the line var span = { - pos: getStartLinePositionForPosition(start, sourceFile), + pos: getLineStartPositionForPosition(start, sourceFile), end: end }; return formatSpan(span, sourceFile, options, rulesProvider, FormattingRequestKind.FormatSelection); @@ -112,7 +112,7 @@ module ts.formatting { return []; } var span = { - pos: getStartLinePositionForPosition(parent.getStart(sourceFile), sourceFile), + pos: getLineStartPositionForPosition(parent.getStart(sourceFile), sourceFile), end: parent.end }; return formatSpan(span, sourceFile, options, rulesProvider, requestKind); @@ -283,7 +283,7 @@ module ts.formatting { var previousLine = Constants.Unknown; var childKind = SyntaxKind.Unknown; while (n) { - var line = sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)).line; + var line = sourceFile.getOneBasedLineAndCharacterFromPosition(n.getStart(sourceFile)).line; if (previousLine !== Constants.Unknown && line !== previousLine) { break; } @@ -327,7 +327,7 @@ module ts.formatting { formattingScanner.advance(); if (formattingScanner.isOnToken()) { - var startLine = sourceFile.getLineAndCharacterFromPosition(enclosingNode.getStart(sourceFile)).line; + var startLine = sourceFile.getOneBasedLineAndCharacterFromPosition(enclosingNode.getStart(sourceFile)).line; var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); processNode(enclosingNode, enclosingNode, startLine, initialIndentation, delta); } @@ -357,8 +357,8 @@ module ts.formatting { } } else { - var startLine = sourceFile.getLineAndCharacterFromPosition(startPos).line; - var startLinePosition = getStartLinePositionForPosition(startPos, sourceFile); + var startLine = sourceFile.getOneBasedLineAndCharacterFromPosition(startPos).line; + var startLinePosition = getLineStartPositionForPosition(startPos, sourceFile); var column = SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); if (startLine !== parentStartLine || startPos === column) { return column @@ -521,7 +521,7 @@ module ts.formatting { var childStartPos = child.getStart(sourceFile); - var childStart = sourceFile.getLineAndCharacterFromPosition(childStartPos); + var childStart = sourceFile.getOneBasedLineAndCharacterFromPosition(childStartPos); // if child is a list item - try to get its indentation var childIndentationAmount = Constants.Unknown; @@ -594,7 +594,7 @@ module ts.formatting { } else if (tokenInfo.token.kind === listStartToken) { // consume list start token - startLine = sourceFile.getLineAndCharacterFromPosition(tokenInfo.token.pos).line; + startLine = sourceFile.getOneBasedLineAndCharacterFromPosition(tokenInfo.token.pos).line; var indentation = computeIndentation(tokenInfo.token, startLine, Constants.Unknown, parent, parentDynamicIndentation, startLine); @@ -641,7 +641,7 @@ module ts.formatting { var lineAdded: boolean; var isTokenInRange = rangeContainsRange(originalRange, currentTokenInfo.token); - var tokenStart = sourceFile.getLineAndCharacterFromPosition(currentTokenInfo.token.pos); + var tokenStart = sourceFile.getOneBasedLineAndCharacterFromPosition(currentTokenInfo.token.pos); if (isTokenInRange) { var rangeHasError = rangeContainsError(currentTokenInfo.token); // save prevStartLine since processRange will overwrite this value with current ones @@ -674,7 +674,7 @@ module ts.formatting { continue; } - var triviaStartLine = sourceFile.getLineAndCharacterFromPosition(triviaItem.pos).line; + var triviaStartLine = sourceFile.getOneBasedLineAndCharacterFromPosition(triviaItem.pos).line; switch (triviaItem.kind) { case SyntaxKind.MultiLineCommentTrivia: var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); @@ -712,7 +712,7 @@ module ts.formatting { for (var i = 0, len = trivia.length; i < len; ++i) { var triviaItem = trivia[i]; if (isComment(triviaItem.kind) && rangeContainsRange(originalRange, triviaItem)) { - var triviaItemStart = sourceFile.getLineAndCharacterFromPosition(triviaItem.pos); + var triviaItemStart = sourceFile.getOneBasedLineAndCharacterFromPosition(triviaItem.pos); processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); } } @@ -729,7 +729,7 @@ module ts.formatting { if (!rangeHasError && !previousRangeHasError) { if (!previousRange) { // trim whitespaces starting from the beginning of the span up to the current line - var originalStart = sourceFile.getLineAndCharacterFromPosition(originalRange.pos); + var originalStart = sourceFile.getOneBasedLineAndCharacterFromPosition(originalRange.pos); trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); } else { @@ -807,7 +807,7 @@ module ts.formatting { recordReplace(pos, 0, indentationString); } else { - var tokenStart = sourceFile.getLineAndCharacterFromPosition(pos); + var tokenStart = sourceFile.getOneBasedLineAndCharacterFromPosition(pos); if (indentation !== tokenStart.character - 1) { var startLinePosition = getStartPositionOfLine(tokenStart.line, sourceFile); recordReplace(startLinePosition, tokenStart.character - 1, indentationString); @@ -817,8 +817,8 @@ module ts.formatting { function indentMultilineComment(commentRange: TextRange, indentation: number, firstLineIsIndented: boolean) { // split comment in lines - var startLine = sourceFile.getLineAndCharacterFromPosition(commentRange.pos).line; - var endLine = sourceFile.getLineAndCharacterFromPosition(commentRange.end).line; + var startLine = sourceFile.getOneBasedLineAndCharacterFromPosition(commentRange.pos).line; + var endLine = sourceFile.getOneBasedLineAndCharacterFromPosition(commentRange.end).line; if (startLine === endLine) { if (!firstLineIsIndented) { diff --git a/src/services/formatting/formattingContext.ts b/src/services/formatting/formattingContext.ts index 2bfb155921e..c6680b4a80e 100644 --- a/src/services/formatting/formattingContext.ts +++ b/src/services/formatting/formattingContext.ts @@ -71,8 +71,8 @@ module ts.formatting { public TokensAreOnSameLine(): boolean { if (this.tokensAreOnSameLine === undefined) { - var startLine = this.sourceFile.getLineAndCharacterFromPosition(this.currentTokenSpan.pos).line; - var endLine = this.sourceFile.getLineAndCharacterFromPosition(this.nextTokenSpan.pos).line; + var startLine = this.sourceFile.getOneBasedLineAndCharacterFromPosition(this.currentTokenSpan.pos).line; + var endLine = this.sourceFile.getOneBasedLineAndCharacterFromPosition(this.nextTokenSpan.pos).line; this.tokensAreOnSameLine = (startLine == endLine); } @@ -96,8 +96,8 @@ module ts.formatting { } private NodeIsOnOneLine(node: Node): boolean { - var startLine = this.sourceFile.getLineAndCharacterFromPosition(node.getStart(this.sourceFile)).line; - var endLine = this.sourceFile.getLineAndCharacterFromPosition(node.getEnd()).line; + var startLine = this.sourceFile.getOneBasedLineAndCharacterFromPosition(node.getStart(this.sourceFile)).line; + var endLine = this.sourceFile.getOneBasedLineAndCharacterFromPosition(node.getEnd()).line; return startLine == endLine; } @@ -105,8 +105,8 @@ module ts.formatting { var openBrace = findChildOfKind(node, SyntaxKind.OpenBraceToken, this.sourceFile); var closeBrace = findChildOfKind(node, SyntaxKind.CloseBraceToken, this.sourceFile); if (openBrace && closeBrace) { - var startLine = this.sourceFile.getLineAndCharacterFromPosition(openBrace.getEnd()).line; - var endLine = this.sourceFile.getLineAndCharacterFromPosition(closeBrace.getStart(this.sourceFile)).line; + var startLine = this.sourceFile.getOneBasedLineAndCharacterFromPosition(openBrace.getEnd()).line; + var endLine = this.sourceFile.getOneBasedLineAndCharacterFromPosition(closeBrace.getStart(this.sourceFile)).line; return startLine === endLine; } return false; diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index efc279cfca6..629c82ef0a8 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -24,7 +24,7 @@ module ts.formatting { return 0; } - var lineAtPosition = sourceFile.getLineAndCharacterFromPosition(position).line; + var lineAtPosition = sourceFile.getOneBasedLineAndCharacterFromPosition(position).line; if (precedingToken.kind === SyntaxKind.CommaToken && precedingToken.parent.kind !== SyntaxKind.BinaryExpression) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it @@ -74,7 +74,7 @@ module ts.formatting { } export function getIndentationForNode(n: Node, ignoreActualIndentationRange: TextRange, sourceFile: SourceFile, options: FormatCodeOptions): number { - var start = sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)); + var start = sourceFile.getOneBasedLineAndCharacterFromPosition(n.getStart(sourceFile)); return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, /*indentationDelta*/ 0, sourceFile, options); } @@ -135,10 +135,10 @@ module ts.formatting { function getParentStart(parent: Node, child: Node, sourceFile: SourceFile): LineAndCharacter { var containingList = getContainingList(child, sourceFile); if (containingList) { - return sourceFile.getLineAndCharacterFromPosition(containingList.pos); + return sourceFile.getOneBasedLineAndCharacterFromPosition(containingList.pos); } - return sourceFile.getLineAndCharacterFromPosition(parent.getStart(sourceFile)); + return sourceFile.getOneBasedLineAndCharacterFromPosition(parent.getStart(sourceFile)); } /* @@ -204,7 +204,7 @@ module ts.formatting { } function getStartLineAndCharacterForNode(n: Node, sourceFile: SourceFile): LineAndCharacter { - return sourceFile.getLineAndCharacterFromPosition(n.getStart(sourceFile)); + return sourceFile.getOneBasedLineAndCharacterFromPosition(n.getStart(sourceFile)); } function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean { @@ -292,7 +292,7 @@ module ts.formatting { continue; } // skip list items that ends on the same line with the current list element - var prevEndLine = sourceFile.getLineAndCharacterFromPosition(list[i].end).line; + var prevEndLine = sourceFile.getOneBasedLineAndCharacterFromPosition(list[i].end).line; if (prevEndLine !== lineAndCharacter.line) { return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); } diff --git a/src/services/services.ts b/src/services/services.ts index 07a0bac2dc6..04e846e88e9 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -61,7 +61,7 @@ module ts { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getOneBasedLineAndCharacterFromPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; @@ -612,7 +612,7 @@ module ts { } if (paramHelpStringMargin === undefined) { - paramHelpStringMargin = sourceFile.getLineAndCharacterFromPosition(firstLineParamHelpStringPos).character - 1; + paramHelpStringMargin = sourceFile.getOneBasedLineAndCharacterFromPosition(firstLineParamHelpStringPos).character - 1; } // Now consume white spaces max @@ -750,7 +750,7 @@ module ts { return updateSourceFile(this, newText, textChangeRange); } - public getLineAndCharacterFromPosition(position: number): LineAndCharacter { + public getOneBasedLineAndCharacterFromPosition(position: number): LineAndCharacter { return getOneBasedLineAndCharacterOfPosition(this, position); } diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 10d00398160..1576003747b 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -37,9 +37,9 @@ module ts { return sourceFile.getLineStarts()[line - 1]; } - export function getStartLinePositionForPosition(position: number, sourceFile: SourceFile): number { + export function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number { var lineStarts = sourceFile.getLineStarts(); - var line = sourceFile.getLineAndCharacterFromPosition(position).line; + var line = sourceFile.getOneBasedLineAndCharacterFromPosition(position).line; return lineStarts[line - 1]; } From afb083ae5a5eeef6ee9b1a9696dca3adb34347e0 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 15:39:49 -0800 Subject: [PATCH 094/162] Make method more clearly indicate that it is one based. --- src/compiler/emitter.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 86a8ca584a2..64328517299 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -133,14 +133,14 @@ module ts { }; } - function getLineOfLocalPosition(currentSourceFile: SourceFile, pos: number) { + function getOneBasedLineOfLocalPosition(currentSourceFile: SourceFile, pos: number) { return getOneBasedLineAndCharacterOfPosition(currentSourceFile, pos).line; } function emitNewLineBeforeLeadingComments(currentSourceFile: SourceFile, writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]) { // If the leading comments start on different line than the start of node, write new line if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && - getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + getOneBasedLineOfLocalPosition(currentSourceFile, node.pos) !== getOneBasedLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { writer.writeLine(); } } @@ -2973,13 +2973,13 @@ module ts { } function isOnSameLine(node1: Node, node2: Node) { - return getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node1.pos)) === - getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); + return getOneBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node1.pos)) === + getOneBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); } function nodeEndIsOnSameLineAsNodeStart(node1: Node, node2: Node) { - return getLineOfLocalPosition(currentSourceFile, node1.end) === - getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); + return getOneBasedLineOfLocalPosition(currentSourceFile, node1.end) === + getOneBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node: CaseOrDefaultClause) { @@ -4470,8 +4470,8 @@ module ts { forEach(leadingComments, comment => { if (lastComment) { - var lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); - var commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); + var lastCommentLine = getOneBasedLineOfLocalPosition(currentSourceFile, lastComment.end); + var commentLine = getOneBasedLineOfLocalPosition(currentSourceFile, comment.pos); if (commentLine >= lastCommentLine + 2) { // There was a blank line between the last comment and this comment. This @@ -4489,8 +4489,8 @@ module ts { // All comments look like they could have been part of the copyright header. Make // sure there is at least one blank line between it and the node. If not, it's not // a copyright header. - var lastCommentLine = getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); - var astLine = getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); + var lastCommentLine = getOneBasedLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); + var astLine = getOneBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); if (astLine >= lastCommentLine + 2) { // Valid detachedComments emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); From b3366ec8b4526bdca1f3b5240e77ba74923a8fb6 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 16:18:53 -0800 Subject: [PATCH 095/162] name more line/char functions more clearly. Use zero based indexing in breakpoints. --- src/compiler/emitter.ts | 4 +-- src/compiler/scanner.ts | 10 ++++---- src/harness/harness.ts | 2 +- src/harness/harnessLanguageService.ts | 2 +- src/harness/typeWriter.ts | 2 +- src/services/breakpoints.ts | 10 ++++---- src/services/formatting/formatting.ts | 26 ++++++++++---------- src/services/formatting/formattingContext.ts | 12 ++++----- src/services/formatting/smartIndenter.ts | 14 +++++------ src/services/services.ts | 19 ++++++++------ src/services/utilities.ts | 2 +- 11 files changed, 54 insertions(+), 49 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 64328517299..165466480a2 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -173,12 +173,12 @@ module ts { var lastLine = getLineStarts(currentSourceFile).length; var firstCommentLineIndent: number; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = currentLine === lastLine ? (comment.end + 1) : getPositionFromOneBasedLineAndCharacter(currentSourceFile, currentLine + 1, /*character*/1); + var nextLineStart = currentLine === lastLine ? (comment.end + 1) : getPositionOfOneBasedLineAndCharacter(currentSourceFile, currentLine + 1, /*character*/1); if (pos !== comment.pos) { // If we are not emitting first line, we need to write the spaces to adjust the alignment if (firstCommentLineIndent === undefined) { - firstCommentLineIndent = calculateIndent(getPositionFromOneBasedLineAndCharacter(currentSourceFile, firstCommentLineAndCharacter.line, /*character*/1), + firstCommentLineIndent = calculateIndent(getPositionOfOneBasedLineAndCharacter(currentSourceFile, firstCommentLineAndCharacter.line, /*character*/1), comment.pos); } diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index a7ff60ebd34..25e1ef63f6f 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -278,15 +278,15 @@ module ts { return result; } - export function getPositionFromZeroBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { - return computePositionFromOneBasedLineAndCharacter(getLineStarts(sourceFile), line + 1, character + 1); + export function getPositionOfZeroBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { + return computePositionOfOneBasedLineAndCharacter(getLineStarts(sourceFile), line + 1, character + 1); } - export function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { - return computePositionFromOneBasedLineAndCharacter(getLineStarts(sourceFile), line, character); + export function getPositionOfOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { + return computePositionOfOneBasedLineAndCharacter(getLineStarts(sourceFile), line, character); } - export function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number { + export function computePositionOfOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number { Debug.assert(line > 0 && line <= lineStarts.length); return lineStarts[line - 1] + character - 1; } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 9e4d49c267d..4a87f953ee1 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -1184,7 +1184,7 @@ module Harness { } export function getMinimalDiagnostic(err: ts.Diagnostic): HarnessDiagnostic { - var errorLineInfo = err.file ? err.file.getOneBasedLineAndCharacterFromPosition(err.start) : { line: 0, character: 0 }; + var errorLineInfo = err.file ? err.file.getOneBasedLineAndCharacterOfPosition(err.start) : { line: 0, character: 0 }; return { fileName: err.file && err.file.fileName, start: err.start, diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index f0d788a1c6b..07f9916d703 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -175,7 +175,7 @@ module Harness.LanguageService { assert.isTrue(line >= 1); assert.isTrue(col >= 1); - return ts.computePositionFromOneBasedLineAndCharacter(script.lineMap, line, col); + return ts.computePositionOfOneBasedLineAndCharacter(script.lineMap, line, col); } /** diff --git a/src/harness/typeWriter.ts b/src/harness/typeWriter.ts index 8747265d218..44532c6a59e 100644 --- a/src/harness/typeWriter.ts +++ b/src/harness/typeWriter.ts @@ -85,7 +85,7 @@ class TypeWriterWalker { private log(node: ts.Node, type: ts.Type): void { var actualPos = ts.skipTrivia(this.currentSourceFile.text, node.pos); - var lineAndCharacter = this.currentSourceFile.getOneBasedLineAndCharacterFromPosition(actualPos); + var lineAndCharacter = this.currentSourceFile.getOneBasedLineAndCharacterOfPosition(actualPos); var sourceText = ts.getTextOfNodeFromSourceText(this.currentSourceFile.text, node); // If we got an unknown type, we temporarily want to fall back to just pretending the name diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 68932e32fad..492cc7866e9 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -14,17 +14,17 @@ module ts.BreakpointResolver { } var tokenAtLocation = getTokenAtPosition(sourceFile, position); - var lineOfPosition = sourceFile.getOneBasedLineAndCharacterFromPosition(position).line; - if (sourceFile.getOneBasedLineAndCharacterFromPosition(tokenAtLocation.getStart()).line > lineOfPosition) { + var lineOfPosition = sourceFile.getZeroBasedLineAndCharacterOfPosition(position).line; + if (sourceFile.getZeroBasedLineAndCharacterOfPosition(tokenAtLocation.getStart()).line > lineOfPosition) { // Get previous token if the token is returned starts on new line - // eg: var x =10; |--- curser is here + // eg: var x =10; |--- cursor is here // var y = 10; // token at position will return var keyword on second line as the token but we would like to use // token on same line if trailing trivia (comments or white spaces on same line) part of the last token on that line tokenAtLocation = findPrecedingToken(tokenAtLocation.pos, sourceFile); // Its a blank line - if (!tokenAtLocation || sourceFile.getOneBasedLineAndCharacterFromPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { + if (!tokenAtLocation || sourceFile.getZeroBasedLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { return undefined; } } @@ -42,7 +42,7 @@ module ts.BreakpointResolver { } function spanInNodeIfStartsOnSameLine(node: Node, otherwiseOnNode?: Node): TextSpan { - if (node && lineOfPosition === sourceFile.getOneBasedLineAndCharacterFromPosition(node.getStart()).line) { + if (node && lineOfPosition === sourceFile.getZeroBasedLineAndCharacterOfPosition(node.getStart()).line) { return spanInNode(node); } return spanInNode(otherwiseOnNode); diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 1d3410c189c..322c36bf7ad 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -67,7 +67,7 @@ module ts.formatting { } export function formatOnEnter(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[] { - var line = sourceFile.getOneBasedLineAndCharacterFromPosition(position).line; + var line = sourceFile.getOneBasedLineAndCharacterOfPosition(position).line; if (line === 1) { return []; } @@ -283,7 +283,7 @@ module ts.formatting { var previousLine = Constants.Unknown; var childKind = SyntaxKind.Unknown; while (n) { - var line = sourceFile.getOneBasedLineAndCharacterFromPosition(n.getStart(sourceFile)).line; + var line = sourceFile.getOneBasedLineAndCharacterOfPosition(n.getStart(sourceFile)).line; if (previousLine !== Constants.Unknown && line !== previousLine) { break; } @@ -327,7 +327,7 @@ module ts.formatting { formattingScanner.advance(); if (formattingScanner.isOnToken()) { - var startLine = sourceFile.getOneBasedLineAndCharacterFromPosition(enclosingNode.getStart(sourceFile)).line; + var startLine = sourceFile.getOneBasedLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line; var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); processNode(enclosingNode, enclosingNode, startLine, initialIndentation, delta); } @@ -357,7 +357,7 @@ module ts.formatting { } } else { - var startLine = sourceFile.getOneBasedLineAndCharacterFromPosition(startPos).line; + var startLine = sourceFile.getOneBasedLineAndCharacterOfPosition(startPos).line; var startLinePosition = getLineStartPositionForPosition(startPos, sourceFile); var column = SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); if (startLine !== parentStartLine || startPos === column) { @@ -521,7 +521,7 @@ module ts.formatting { var childStartPos = child.getStart(sourceFile); - var childStart = sourceFile.getOneBasedLineAndCharacterFromPosition(childStartPos); + var childStart = sourceFile.getOneBasedLineAndCharacterOfPosition(childStartPos); // if child is a list item - try to get its indentation var childIndentationAmount = Constants.Unknown; @@ -594,7 +594,7 @@ module ts.formatting { } else if (tokenInfo.token.kind === listStartToken) { // consume list start token - startLine = sourceFile.getOneBasedLineAndCharacterFromPosition(tokenInfo.token.pos).line; + startLine = sourceFile.getOneBasedLineAndCharacterOfPosition(tokenInfo.token.pos).line; var indentation = computeIndentation(tokenInfo.token, startLine, Constants.Unknown, parent, parentDynamicIndentation, startLine); @@ -641,7 +641,7 @@ module ts.formatting { var lineAdded: boolean; var isTokenInRange = rangeContainsRange(originalRange, currentTokenInfo.token); - var tokenStart = sourceFile.getOneBasedLineAndCharacterFromPosition(currentTokenInfo.token.pos); + var tokenStart = sourceFile.getOneBasedLineAndCharacterOfPosition(currentTokenInfo.token.pos); if (isTokenInRange) { var rangeHasError = rangeContainsError(currentTokenInfo.token); // save prevStartLine since processRange will overwrite this value with current ones @@ -674,7 +674,7 @@ module ts.formatting { continue; } - var triviaStartLine = sourceFile.getOneBasedLineAndCharacterFromPosition(triviaItem.pos).line; + var triviaStartLine = sourceFile.getOneBasedLineAndCharacterOfPosition(triviaItem.pos).line; switch (triviaItem.kind) { case SyntaxKind.MultiLineCommentTrivia: var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); @@ -712,7 +712,7 @@ module ts.formatting { for (var i = 0, len = trivia.length; i < len; ++i) { var triviaItem = trivia[i]; if (isComment(triviaItem.kind) && rangeContainsRange(originalRange, triviaItem)) { - var triviaItemStart = sourceFile.getOneBasedLineAndCharacterFromPosition(triviaItem.pos); + var triviaItemStart = sourceFile.getOneBasedLineAndCharacterOfPosition(triviaItem.pos); processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); } } @@ -729,7 +729,7 @@ module ts.formatting { if (!rangeHasError && !previousRangeHasError) { if (!previousRange) { // trim whitespaces starting from the beginning of the span up to the current line - var originalStart = sourceFile.getOneBasedLineAndCharacterFromPosition(originalRange.pos); + var originalStart = sourceFile.getOneBasedLineAndCharacterOfPosition(originalRange.pos); trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); } else { @@ -807,7 +807,7 @@ module ts.formatting { recordReplace(pos, 0, indentationString); } else { - var tokenStart = sourceFile.getOneBasedLineAndCharacterFromPosition(pos); + var tokenStart = sourceFile.getOneBasedLineAndCharacterOfPosition(pos); if (indentation !== tokenStart.character - 1) { var startLinePosition = getStartPositionOfLine(tokenStart.line, sourceFile); recordReplace(startLinePosition, tokenStart.character - 1, indentationString); @@ -817,8 +817,8 @@ module ts.formatting { function indentMultilineComment(commentRange: TextRange, indentation: number, firstLineIsIndented: boolean) { // split comment in lines - var startLine = sourceFile.getOneBasedLineAndCharacterFromPosition(commentRange.pos).line; - var endLine = sourceFile.getOneBasedLineAndCharacterFromPosition(commentRange.end).line; + var startLine = sourceFile.getOneBasedLineAndCharacterOfPosition(commentRange.pos).line; + var endLine = sourceFile.getOneBasedLineAndCharacterOfPosition(commentRange.end).line; if (startLine === endLine) { if (!firstLineIsIndented) { diff --git a/src/services/formatting/formattingContext.ts b/src/services/formatting/formattingContext.ts index c6680b4a80e..0b9372d86e2 100644 --- a/src/services/formatting/formattingContext.ts +++ b/src/services/formatting/formattingContext.ts @@ -71,8 +71,8 @@ module ts.formatting { public TokensAreOnSameLine(): boolean { if (this.tokensAreOnSameLine === undefined) { - var startLine = this.sourceFile.getOneBasedLineAndCharacterFromPosition(this.currentTokenSpan.pos).line; - var endLine = this.sourceFile.getOneBasedLineAndCharacterFromPosition(this.nextTokenSpan.pos).line; + var startLine = this.sourceFile.getOneBasedLineAndCharacterOfPosition(this.currentTokenSpan.pos).line; + var endLine = this.sourceFile.getOneBasedLineAndCharacterOfPosition(this.nextTokenSpan.pos).line; this.tokensAreOnSameLine = (startLine == endLine); } @@ -96,8 +96,8 @@ module ts.formatting { } private NodeIsOnOneLine(node: Node): boolean { - var startLine = this.sourceFile.getOneBasedLineAndCharacterFromPosition(node.getStart(this.sourceFile)).line; - var endLine = this.sourceFile.getOneBasedLineAndCharacterFromPosition(node.getEnd()).line; + var startLine = this.sourceFile.getOneBasedLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line; + var endLine = this.sourceFile.getOneBasedLineAndCharacterOfPosition(node.getEnd()).line; return startLine == endLine; } @@ -105,8 +105,8 @@ module ts.formatting { var openBrace = findChildOfKind(node, SyntaxKind.OpenBraceToken, this.sourceFile); var closeBrace = findChildOfKind(node, SyntaxKind.CloseBraceToken, this.sourceFile); if (openBrace && closeBrace) { - var startLine = this.sourceFile.getOneBasedLineAndCharacterFromPosition(openBrace.getEnd()).line; - var endLine = this.sourceFile.getOneBasedLineAndCharacterFromPosition(closeBrace.getStart(this.sourceFile)).line; + var startLine = this.sourceFile.getOneBasedLineAndCharacterOfPosition(openBrace.getEnd()).line; + var endLine = this.sourceFile.getOneBasedLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; return startLine === endLine; } return false; diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 629c82ef0a8..35be18910e3 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -24,7 +24,7 @@ module ts.formatting { return 0; } - var lineAtPosition = sourceFile.getOneBasedLineAndCharacterFromPosition(position).line; + var lineAtPosition = sourceFile.getOneBasedLineAndCharacterOfPosition(position).line; if (precedingToken.kind === SyntaxKind.CommaToken && precedingToken.parent.kind !== SyntaxKind.BinaryExpression) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it @@ -74,7 +74,7 @@ module ts.formatting { } export function getIndentationForNode(n: Node, ignoreActualIndentationRange: TextRange, sourceFile: SourceFile, options: FormatCodeOptions): number { - var start = sourceFile.getOneBasedLineAndCharacterFromPosition(n.getStart(sourceFile)); + var start = sourceFile.getOneBasedLineAndCharacterOfPosition(n.getStart(sourceFile)); return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, /*indentationDelta*/ 0, sourceFile, options); } @@ -135,10 +135,10 @@ module ts.formatting { function getParentStart(parent: Node, child: Node, sourceFile: SourceFile): LineAndCharacter { var containingList = getContainingList(child, sourceFile); if (containingList) { - return sourceFile.getOneBasedLineAndCharacterFromPosition(containingList.pos); + return sourceFile.getOneBasedLineAndCharacterOfPosition(containingList.pos); } - return sourceFile.getOneBasedLineAndCharacterFromPosition(parent.getStart(sourceFile)); + return sourceFile.getOneBasedLineAndCharacterOfPosition(parent.getStart(sourceFile)); } /* @@ -204,7 +204,7 @@ module ts.formatting { } function getStartLineAndCharacterForNode(n: Node, sourceFile: SourceFile): LineAndCharacter { - return sourceFile.getOneBasedLineAndCharacterFromPosition(n.getStart(sourceFile)); + return sourceFile.getOneBasedLineAndCharacterOfPosition(n.getStart(sourceFile)); } function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean { @@ -292,7 +292,7 @@ module ts.formatting { continue; } // skip list items that ends on the same line with the current list element - var prevEndLine = sourceFile.getOneBasedLineAndCharacterFromPosition(list[i].end).line; + var prevEndLine = sourceFile.getOneBasedLineAndCharacterOfPosition(list[i].end).line; if (prevEndLine !== lineAndCharacter.line) { return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); } @@ -303,7 +303,7 @@ module ts.formatting { } function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter: LineAndCharacter, sourceFile: SourceFile, options: EditorOptions): number { - var lineStart = sourceFile.getPositionFromOneBasedLineAndCharacter(lineAndCharacter.line, 1); + var lineStart = sourceFile.getPositionOfOneBasedLineAndCharacter(lineAndCharacter.line, 1); return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options); } diff --git a/src/services/services.ts b/src/services/services.ts index 04e846e88e9..33fde9e005e 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -61,9 +61,10 @@ module ts { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getOneBasedLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getZeroBasedLineAndCharacterOfPosition(pos: number): LineAndCharacter; + getOneBasedLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; + getPositionOfOneBasedLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } @@ -612,7 +613,7 @@ module ts { } if (paramHelpStringMargin === undefined) { - paramHelpStringMargin = sourceFile.getOneBasedLineAndCharacterFromPosition(firstLineParamHelpStringPos).character - 1; + paramHelpStringMargin = sourceFile.getOneBasedLineAndCharacterOfPosition(firstLineParamHelpStringPos).character - 1; } // Now consume white spaces max @@ -750,16 +751,20 @@ module ts { return updateSourceFile(this, newText, textChangeRange); } - public getOneBasedLineAndCharacterFromPosition(position: number): LineAndCharacter { - return getOneBasedLineAndCharacterOfPosition(this, position); + public getZeroBasedLineAndCharacterOfPosition(position: number): LineAndCharacter { + return ts.getZeroBasedLineAndCharacterOfPosition(this, position); + } + + public getOneBasedLineAndCharacterOfPosition(position: number): LineAndCharacter { + return ts.getOneBasedLineAndCharacterOfPosition(this, position); } public getLineStarts(): number[] { return getLineStarts(this); } - public getPositionFromOneBasedLineAndCharacter(line: number, character: number): number { - return getPositionFromOneBasedLineAndCharacter(this, line, character); + public getPositionOfOneBasedLineAndCharacter(line: number, character: number): number { + return ts.getPositionOfOneBasedLineAndCharacter(this, line, character); } public getNamedDeclarations() { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 1576003747b..711fc0fde8d 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -39,7 +39,7 @@ module ts { export function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number { var lineStarts = sourceFile.getLineStarts(); - var line = sourceFile.getOneBasedLineAndCharacterFromPosition(position).line; + var line = sourceFile.getOneBasedLineAndCharacterOfPosition(position).line; return lineStarts[line - 1]; } From ab7d36d526aab732b747e931d4adc812e43b2511 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 16:28:26 -0800 Subject: [PATCH 096/162] Move the emitter over to use zero based indexing. --- src/compiler/emitter.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 165466480a2..c12d4dedaef 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -133,14 +133,14 @@ module ts { }; } - function getOneBasedLineOfLocalPosition(currentSourceFile: SourceFile, pos: number) { - return getOneBasedLineAndCharacterOfPosition(currentSourceFile, pos).line; + function getZeroBasedLineOfLocalPosition(currentSourceFile: SourceFile, pos: number) { + return getZeroBasedLineAndCharacterOfPosition(currentSourceFile, pos).line; } function emitNewLineBeforeLeadingComments(currentSourceFile: SourceFile, writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]) { // If the leading comments start on different line than the start of node, write new line if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && - getOneBasedLineOfLocalPosition(currentSourceFile, node.pos) !== getOneBasedLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + getZeroBasedLineOfLocalPosition(currentSourceFile, node.pos) !== getZeroBasedLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { writer.writeLine(); } } @@ -2973,13 +2973,13 @@ module ts { } function isOnSameLine(node1: Node, node2: Node) { - return getOneBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node1.pos)) === - getOneBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); + return getZeroBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node1.pos)) === + getZeroBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); } function nodeEndIsOnSameLineAsNodeStart(node1: Node, node2: Node) { - return getOneBasedLineOfLocalPosition(currentSourceFile, node1.end) === - getOneBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); + return getZeroBasedLineOfLocalPosition(currentSourceFile, node1.end) === + getZeroBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node: CaseOrDefaultClause) { @@ -4470,8 +4470,8 @@ module ts { forEach(leadingComments, comment => { if (lastComment) { - var lastCommentLine = getOneBasedLineOfLocalPosition(currentSourceFile, lastComment.end); - var commentLine = getOneBasedLineOfLocalPosition(currentSourceFile, comment.pos); + var lastCommentLine = getZeroBasedLineOfLocalPosition(currentSourceFile, lastComment.end); + var commentLine = getZeroBasedLineOfLocalPosition(currentSourceFile, comment.pos); if (commentLine >= lastCommentLine + 2) { // There was a blank line between the last comment and this comment. This @@ -4489,9 +4489,9 @@ module ts { // All comments look like they could have been part of the copyright header. Make // sure there is at least one blank line between it and the node. If not, it's not // a copyright header. - var lastCommentLine = getOneBasedLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); - var astLine = getOneBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); - if (astLine >= lastCommentLine + 2) { + var lastCommentLine = getZeroBasedLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); + var nodeLine = getZeroBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); + if (nodeLine >= lastCommentLine + 2) { // Valid detachedComments emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); emitComments(currentSourceFile, writer, detachedComments, /*trailingSeparator*/ true, newLine, writeComment); From 59dc7d3a5bf606e7e2b00786fbc57ea6f6f02319 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Mon, 16 Feb 2015 16:50:40 -0800 Subject: [PATCH 097/162] Address feedback --- src/compiler/checker.ts | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5d840a51264..aab9f49eae6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5505,7 +5505,7 @@ module ts { function isNumericComputedName(name: ComputedPropertyName): boolean { // It seems odd to consider an expression of type Any to result in a numeric name, // but this behavior is consistent with checkIndexedAccess - return isTypeOfKind(checkComputedPropertyName(name), TypeFlags.Any | TypeFlags.NumberLike); + return allConstituentTypesHaveKind(checkComputedPropertyName(name), TypeFlags.Any | TypeFlags.NumberLike); } function isNumericLiteralName(name: string) { @@ -5540,7 +5540,7 @@ module ts { // This will allow types number, string, symbol or any. It will also allow enums, the unknown // type, and any union of these types (like string | number). - if (!isTypeOfKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.ESSymbol)) { + if (!allConstituentTypesHaveKind(links.resolvedType, TypeFlags.Any | TypeFlags.NumberLike | TypeFlags.StringLike | TypeFlags.ESSymbol)) { error(node, Diagnostics.A_computed_property_name_must_be_of_type_string_number_symbol_or_any); } else { @@ -5808,10 +5808,10 @@ module ts { } // Check for compatible indexer types. - if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) { + if (allConstituentTypesHaveKind(indexType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) { // Try to use a number indexer. - if (isTypeOfKind(indexType, TypeFlags.Any | TypeFlags.NumberLike)) { + if (allConstituentTypesHaveKind(indexType, TypeFlags.Any | TypeFlags.NumberLike)) { var numberIndexType = getIndexTypeOfType(objectType, IndexKind.Number); if (numberIndexType) { return numberIndexType; @@ -6819,7 +6819,7 @@ module ts { } function checkArithmeticOperandType(operand: Node, type: Type, diagnostic: DiagnosticMessage): boolean { - if (!isTypeOfKind(type, TypeFlags.Any | TypeFlags.NumberLike)) { + if (!allConstituentTypesHaveKind(type, TypeFlags.Any | TypeFlags.NumberLike)) { error(operand, diagnostic); return false; } @@ -6935,7 +6935,7 @@ module ts { case SyntaxKind.PlusToken: case SyntaxKind.MinusToken: case SyntaxKind.TildeToken: - if (hasSomeTypeOfKind(operandType, TypeFlags.ESSymbol)) { + if (someConstituentTypeHasKind(operandType, TypeFlags.ESSymbol)) { error(node.operand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(node.operator)); } return numberType; @@ -6975,7 +6975,7 @@ module ts { // Just like isTypeOfKind below, except that it returns true if *any* constituent // has this kind. - function hasSomeTypeOfKind(type: Type, kind: TypeFlags): boolean { + function someConstituentTypeHasKind(type: Type, kind: TypeFlags): boolean { if (type.flags & kind) { return true; } @@ -6992,7 +6992,7 @@ module ts { } // Return true if type has the given flags, or is a union type composed of types that all have those flags. - function isTypeOfKind(type: Type, kind: TypeFlags): boolean { + function allConstituentTypesHaveKind(type: Type, kind: TypeFlags): boolean { if (type.flags & kind) { return true; } @@ -7022,7 +7022,7 @@ module ts { // and the right operand to be of type Any or a subtype of the 'Function' interface type. // The result is always of the Boolean primitive type. // NOTE: do not raise error if leftType is unknown as related error was already reported - if (isTypeOfKind(leftType, TypeFlags.Primitive)) { + if (allConstituentTypesHaveKind(leftType, TypeFlags.Primitive)) { error(node.left, Diagnostics.The_left_hand_side_of_an_instanceof_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } // NOTE: do not raise error if right is unknown as related error was already reported @@ -7037,10 +7037,10 @@ module ts { // The in operator requires the left operand to be of type Any, the String primitive type, or the Number primitive type, // and the right operand to be of type Any, an object type, or a type parameter type. // The result is always of the Boolean primitive type. - if (!isTypeOfKind(leftType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) { + if (!allConstituentTypesHaveKind(leftType, TypeFlags.Any | TypeFlags.StringLike | TypeFlags.NumberLike | TypeFlags.ESSymbol)) { error(node.left, Diagnostics.The_left_hand_side_of_an_in_expression_must_be_of_type_any_string_number_or_symbol); } - if (!isTypeOfKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { + if (!allConstituentTypesHaveKind(rightType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { error(node.right, Diagnostics.The_right_hand_side_of_an_in_expression_must_be_of_type_any_an_object_type_or_a_type_parameter); } return booleanType; @@ -7201,13 +7201,13 @@ module ts { if (rightType.flags & (TypeFlags.Undefined | TypeFlags.Null)) rightType = leftType; var resultType: Type; - if (isTypeOfKind(leftType, TypeFlags.NumberLike) && isTypeOfKind(rightType, TypeFlags.NumberLike)) { + if (allConstituentTypesHaveKind(leftType, TypeFlags.NumberLike) && allConstituentTypesHaveKind(rightType, TypeFlags.NumberLike)) { // Operands of an enum type are treated as having the primitive type Number. // If both operands are of the Number primitive type, the result is of the Number primitive type. resultType = numberType; } else { - if (isTypeOfKind(leftType, TypeFlags.StringLike) || isTypeOfKind(rightType, TypeFlags.StringLike)) { + if (allConstituentTypesHaveKind(leftType, TypeFlags.StringLike) || allConstituentTypesHaveKind(rightType, TypeFlags.StringLike)) { // If one or both operands are of the String primitive type, the result is of the String primitive type. resultType = stringType; } @@ -7266,8 +7266,8 @@ module ts { // Return type is true if there was no error, false if there was an error. function checkForDisallowedESSymbolOperand(operator: SyntaxKind): boolean { var offendingSymbolOperand = - hasSomeTypeOfKind(leftType, TypeFlags.ESSymbol) ? node.left : - hasSomeTypeOfKind(rightType, TypeFlags.ESSymbol) ? node.right : + someConstituentTypeHasKind(leftType, TypeFlags.ESSymbol) ? node.left : + someConstituentTypeHasKind(rightType, TypeFlags.ESSymbol) ? node.right : undefined; if (offendingSymbolOperand) { error(offendingSymbolOperand, Diagnostics.The_0_operator_cannot_be_applied_to_type_symbol, tokenToString(operator)); @@ -8640,7 +8640,7 @@ module ts { // and Expr must be an expression of type Any, an object type, or a type parameter type. var varExpr = node.initializer; var exprType = checkExpression(varExpr); - if (!isTypeOfKind(exprType, TypeFlags.Any | TypeFlags.StringLike)) { + if (!allConstituentTypesHaveKind(exprType, TypeFlags.Any | TypeFlags.StringLike)) { error(varExpr, Diagnostics.The_left_hand_side_of_a_for_in_statement_must_be_of_type_string_or_any); } else { @@ -8652,7 +8652,7 @@ module ts { var exprType = checkExpression(node.expression); // unknownType is returned i.e. if node.expression is identifier whose name cannot be resolved // in this case error about missing name is already reported - do not report extra one - if (!isTypeOfKind(exprType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { + if (!allConstituentTypesHaveKind(exprType, TypeFlags.Any | TypeFlags.ObjectType | TypeFlags.TypeParameter)) { error(node.expression, Diagnostics.The_right_hand_side_of_a_for_in_statement_must_be_of_type_any_an_object_type_or_a_type_parameter); } From 8ef4df8acbb0d4ba85669bc19578793d1f6c0cdb Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 17:34:11 -0800 Subject: [PATCH 098/162] Move the emitter over to using zero based indexing. --- src/compiler/emitter.ts | 11 ++++++----- src/compiler/utilities.ts | 10 ++++++++++ src/services/formatting/formatting.ts | 12 ++++++------ src/services/utilities.ts | 5 ----- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index c12d4dedaef..8c4f435affe 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -169,17 +169,18 @@ module ts { function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string){ if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { - var firstCommentLineAndCharacter = getOneBasedLineAndCharacterOfPosition(currentSourceFile, comment.pos); - var lastLine = getLineStarts(currentSourceFile).length; + var firstCommentLineAndCharacter = getZeroBasedLineAndCharacterOfPosition(currentSourceFile, comment.pos); + var lineCount = getLineStarts(currentSourceFile).length; var firstCommentLineIndent: number; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { - var nextLineStart = currentLine === lastLine ? (comment.end + 1) : getPositionOfOneBasedLineAndCharacter(currentSourceFile, currentLine + 1, /*character*/1); + var nextLineStart = (currentLine + 1) === lineCount + ? currentSourceFile.text.length + 1 + : getStartPositionOfZeroBasedLine(currentLine + 1, currentSourceFile); if (pos !== comment.pos) { // If we are not emitting first line, we need to write the spaces to adjust the alignment if (firstCommentLineIndent === undefined) { - firstCommentLineIndent = calculateIndent(getPositionOfOneBasedLineAndCharacter(currentSourceFile, firstCommentLineAndCharacter.line, /*character*/1), - comment.pos); + firstCommentLineIndent = calculateIndent(getStartPositionOfZeroBasedLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); } // These are number of spaces writer is going to write at current indent diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 6323ffd4313..095044c4b8f 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -105,6 +105,16 @@ module ts { return node; } + export function getStartPositionOfZeroBasedLine(line: number, sourceFile: SourceFile): number { + Debug.assert(line >= 0); + return getLineStarts(sourceFile)[line]; + } + + export function getStartPositionOfOneBasedLine(line: number, sourceFile: SourceFile): number { + Debug.assert(line >= 1); + return getLineStarts(sourceFile)[line - 1]; + } + // This is a useful function for debugging purposes. export function nodePosToString(node: Node): string { var file = getSourceFileOfNode(node); diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 322c36bf7ad..b9cc0b24060 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -74,7 +74,7 @@ module ts.formatting { // get the span for the previous\current line var span = { // get start position for the previous line - pos: getStartPositionOfLine(line - 1, sourceFile), + pos: getStartPositionOfOneBasedLine(line - 1, sourceFile), // get end position for the current line (end value is exclusive so add 1 to the result) end: getEndLinePosition(line, sourceFile) + 1 } @@ -809,7 +809,7 @@ module ts.formatting { else { var tokenStart = sourceFile.getOneBasedLineAndCharacterOfPosition(pos); if (indentation !== tokenStart.character - 1) { - var startLinePosition = getStartPositionOfLine(tokenStart.line, sourceFile); + var startLinePosition = getStartPositionOfOneBasedLine(tokenStart.line, sourceFile); recordReplace(startLinePosition, tokenStart.character - 1, indentationString); } } @@ -833,13 +833,13 @@ module ts.formatting { for (var line = startLine; line < endLine; ++line) { var endOfLine = getEndLinePosition(line, sourceFile); parts.push({ pos: startPos, end: endOfLine }); - startPos = getStartPositionOfLine(line + 1, sourceFile); + startPos = getStartPositionOfOneBasedLine(line + 1, sourceFile); } parts.push({ pos: startPos, end: commentRange.end }); } - var startLinePos = getStartPositionOfLine(startLine, sourceFile); + var startLinePos = getStartPositionOfOneBasedLine(startLine, sourceFile); var nonWhitespaceColumnInFirstPart = SmartIndenter.findFirstNonWhitespaceColumn(startLinePos, parts[0].pos, sourceFile, options); @@ -857,7 +857,7 @@ module ts.formatting { // shift all parts on the delta size var delta = indentation - nonWhitespaceColumnInFirstPart; for (var i = startIndex, len = parts.length; i < len; ++i, ++startLine) { - var startLinePos = getStartPositionOfLine(startLine, sourceFile); + var startLinePos = getStartPositionOfOneBasedLine(startLine, sourceFile); var nonWhitespaceColumn = i === 0 ? nonWhitespaceColumnInFirstPart @@ -876,7 +876,7 @@ module ts.formatting { function trimTrailingWhitespacesForLines(line1: number, line2: number, range?: TextRangeWithKind) { for (var line = line1; line < line2; ++line) { - var lineStartPosition = getStartPositionOfLine(line, sourceFile); + var lineStartPosition = getStartPositionOfOneBasedLine(line, sourceFile); var lineEndPosition = getEndLinePosition(line, sourceFile); // do not trim whitespaces in comments diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 711fc0fde8d..41bd63560eb 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -32,11 +32,6 @@ module ts { } } - export function getStartPositionOfLine(line: number, sourceFile: SourceFile): number { - Debug.assert(line >= 1); - return sourceFile.getLineStarts()[line - 1]; - } - export function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number { var lineStarts = sourceFile.getLineStarts(); var line = sourceFile.getOneBasedLineAndCharacterOfPosition(position).line; From 1098e80f4bba6a498cf342deb635492fe6188819 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 17:41:07 -0800 Subject: [PATCH 099/162] Remove one-based helper function. --- src/compiler/emitter.ts | 7 +++++++ src/compiler/scanner.ts | 4 ---- src/compiler/tsc.ts | 6 +++--- src/compiler/utilities.ts | 4 ++-- src/services/services.ts | 5 ++++- 5 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 8c4f435affe..0f2042b0f68 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1733,6 +1733,13 @@ module ts { } } + function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, pos: number) { + var result = getZeroBasedLineAndCharacterOfPosition(sourceFile, pos); + result.line++; + result.character++; + return result; + } + function recordSourceMapSpan(pos: number) { var sourceLinePos = getOneBasedLineAndCharacterOfPosition(currentSourceFile, pos); var emittedLine = writer.getLine(); diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 25e1ef63f6f..c124c55c7da 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -319,10 +319,6 @@ module ts { return computeZeroBasedLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } - export function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter { - return computeOneBasedLineAndCharacterOfPosition(getLineStarts(sourceFile), position); - } - var hasOwnProperty = Object.prototype.hasOwnProperty; export function isWhiteSpace(ch: number): boolean { diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 84d8a25e790..64272b196ff 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -72,7 +72,7 @@ module ts { function countLines(program: Program): number { var count = 0; forEach(program.getSourceFiles(), file => { - count += getOneBasedLineAndCharacterOfPosition(file, file.end).line; + count += getLineStarts(file).length; }); return count; } @@ -86,9 +86,9 @@ module ts { var output = ""; if (diagnostic.file) { - var loc = getOneBasedLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); + var loc = getZeroBasedLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); - output += diagnostic.file.fileName + "(" + loc.line + "," + loc.character + "): "; + output += diagnostic.file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + "): "; } var category = DiagnosticCategory[diagnostic.category].toLowerCase(); diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 095044c4b8f..d543adaa103 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -118,8 +118,8 @@ module ts { // This is a useful function for debugging purposes. export function nodePosToString(node: Node): string { var file = getSourceFileOfNode(node); - var loc = getOneBasedLineAndCharacterOfPosition(file, node.pos); - return file.fileName + "(" + loc.line + "," + loc.character + ")"; + var loc = getZeroBasedLineAndCharacterOfPosition(file, node.pos); + return file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + ")"; } export function getStartPosOfNode(node: Node): number { diff --git a/src/services/services.ts b/src/services/services.ts index 33fde9e005e..05015c60c02 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -756,7 +756,10 @@ module ts { } public getOneBasedLineAndCharacterOfPosition(position: number): LineAndCharacter { - return ts.getOneBasedLineAndCharacterOfPosition(this, position); + var result = ts.getZeroBasedLineAndCharacterOfPosition(this, position); + result.line++; + result.character++; + return result; } public getLineStarts(): number[] { From edbedc7d5d7ca04021fc7f4722e09538497ad9fe Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 17:47:32 -0800 Subject: [PATCH 100/162] Make code more clearly state that it is one based. --- src/compiler/emitter.ts | 14 ++++++-------- src/services/formatting/smartIndenter.ts | 12 ++++++------ 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 0f2042b0f68..2e78b9a2a46 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -1733,15 +1733,13 @@ module ts { } } - function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, pos: number) { - var result = getZeroBasedLineAndCharacterOfPosition(sourceFile, pos); - result.line++; - result.character++; - return result; - } - function recordSourceMapSpan(pos: number) { - var sourceLinePos = getOneBasedLineAndCharacterOfPosition(currentSourceFile, pos); + var sourceLinePos = getZeroBasedLineAndCharacterOfPosition(currentSourceFile, pos); + + // Convert the location to be one-based. + sourceLinePos.line++; + sourceLinePos.character++; + var emittedLine = writer.getLine(); var emittedColumn = writer.getColumn(); diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 35be18910e3..9d81ba50348 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -43,7 +43,7 @@ module ts.formatting { while (current) { if (positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current.kind, previous ? previous.kind : SyntaxKind.Unknown)) { - currentStart = getStartLineAndCharacterForNode(current, sourceFile); + currentStart = getOneBasedStartLineAndCharacterForNode(current, sourceFile); if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { indentationDelta = 0; @@ -196,14 +196,14 @@ module ts.formatting { // class A { // $} - var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; + var nextTokenStartLine = getOneBasedStartLineAndCharacterForNode(nextToken, sourceFile).line; return lineAtPosition === nextTokenStartLine; } return false; } - function getStartLineAndCharacterForNode(n: Node, sourceFile: SourceFile): LineAndCharacter { + function getOneBasedStartLineAndCharacterForNode(n: Node, sourceFile: SourceFile): LineAndCharacter { return sourceFile.getOneBasedLineAndCharacterOfPosition(n.getStart(sourceFile)); } @@ -216,7 +216,7 @@ module ts.formatting { var elseKeyword = findChildOfKind(parent, SyntaxKind.ElseKeyword, sourceFile); Debug.assert(elseKeyword !== undefined); - var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; + var elseKeywordStartLine = getOneBasedStartLineAndCharacterForNode(elseKeyword, sourceFile).line; return elseKeywordStartLine === childStartLine; } @@ -286,7 +286,7 @@ module ts.formatting { // walk toward the start of the list starting from current node and check if the line is the same for all items. // if end line for item [i - 1] differs from the start line for item [i] - find column of the first non-whitespace character on the line of item [i] - var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile); + var lineAndCharacter = getOneBasedStartLineAndCharacterForNode(node, sourceFile); for (var i = index - 1; i >= 0; --i) { if (list[i].kind === SyntaxKind.CommaToken) { continue; @@ -297,7 +297,7 @@ module ts.formatting { return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); } - lineAndCharacter = getStartLineAndCharacterForNode(list[i], sourceFile); + lineAndCharacter = getOneBasedStartLineAndCharacterForNode(list[i], sourceFile); } return -1; } From f4da5d724fb05db03e21c1411299985388ac364f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 18:00:43 -0800 Subject: [PATCH 101/162] Move the smart indenter over to zero based math. --- src/services/formatting/smartIndenter.ts | 27 ++++++++++++------------ src/services/services.ts | 5 +++++ 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 9d81ba50348..1c36df49d47 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -24,7 +24,7 @@ module ts.formatting { return 0; } - var lineAtPosition = sourceFile.getOneBasedLineAndCharacterOfPosition(position).line; + var lineAtPosition = sourceFile.getZeroBasedLineAndCharacterOfPosition(position).line; if (precedingToken.kind === SyntaxKind.CommaToken && precedingToken.parent.kind !== SyntaxKind.BinaryExpression) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it @@ -43,7 +43,7 @@ module ts.formatting { while (current) { if (positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current.kind, previous ? previous.kind : SyntaxKind.Unknown)) { - currentStart = getOneBasedStartLineAndCharacterForNode(current, sourceFile); + currentStart = getZeroBasedStartLineAndCharacterForNode(current, sourceFile); if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { indentationDelta = 0; @@ -74,7 +74,7 @@ module ts.formatting { } export function getIndentationForNode(n: Node, ignoreActualIndentationRange: TextRange, sourceFile: SourceFile, options: FormatCodeOptions): number { - var start = sourceFile.getOneBasedLineAndCharacterOfPosition(n.getStart(sourceFile)); + var start = sourceFile.getZeroBasedLineAndCharacterOfPosition(n.getStart(sourceFile)); return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, /*indentationDelta*/ 0, sourceFile, options); } @@ -135,10 +135,10 @@ module ts.formatting { function getParentStart(parent: Node, child: Node, sourceFile: SourceFile): LineAndCharacter { var containingList = getContainingList(child, sourceFile); if (containingList) { - return sourceFile.getOneBasedLineAndCharacterOfPosition(containingList.pos); + return sourceFile.getZeroBasedLineAndCharacterOfPosition(containingList.pos); } - return sourceFile.getOneBasedLineAndCharacterOfPosition(parent.getStart(sourceFile)); + return sourceFile.getZeroBasedLineAndCharacterOfPosition(parent.getStart(sourceFile)); } /* @@ -196,15 +196,15 @@ module ts.formatting { // class A { // $} - var nextTokenStartLine = getOneBasedStartLineAndCharacterForNode(nextToken, sourceFile).line; + var nextTokenStartLine = getZeroBasedStartLineAndCharacterForNode(nextToken, sourceFile).line; return lineAtPosition === nextTokenStartLine; } return false; } - function getOneBasedStartLineAndCharacterForNode(n: Node, sourceFile: SourceFile): LineAndCharacter { - return sourceFile.getOneBasedLineAndCharacterOfPosition(n.getStart(sourceFile)); + function getZeroBasedStartLineAndCharacterForNode(n: Node, sourceFile: SourceFile): LineAndCharacter { + return sourceFile.getZeroBasedLineAndCharacterOfPosition(n.getStart(sourceFile)); } function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean { @@ -216,7 +216,7 @@ module ts.formatting { var elseKeyword = findChildOfKind(parent, SyntaxKind.ElseKeyword, sourceFile); Debug.assert(elseKeyword !== undefined); - var elseKeywordStartLine = getOneBasedStartLineAndCharacterForNode(elseKeyword, sourceFile).line; + var elseKeywordStartLine = getZeroBasedStartLineAndCharacterForNode(elseKeyword, sourceFile).line; return elseKeywordStartLine === childStartLine; } @@ -279,31 +279,30 @@ module ts.formatting { } } - function deriveActualIndentationFromList(list: Node[], index: number, sourceFile: SourceFile, options: EditorOptions): number { Debug.assert(index >= 0 && index < list.length); var node = list[index]; // walk toward the start of the list starting from current node and check if the line is the same for all items. // if end line for item [i - 1] differs from the start line for item [i] - find column of the first non-whitespace character on the line of item [i] - var lineAndCharacter = getOneBasedStartLineAndCharacterForNode(node, sourceFile); + var lineAndCharacter = getZeroBasedStartLineAndCharacterForNode(node, sourceFile); for (var i = index - 1; i >= 0; --i) { if (list[i].kind === SyntaxKind.CommaToken) { continue; } // skip list items that ends on the same line with the current list element - var prevEndLine = sourceFile.getOneBasedLineAndCharacterOfPosition(list[i].end).line; + var prevEndLine = sourceFile.getZeroBasedLineAndCharacterOfPosition(list[i].end).line; if (prevEndLine !== lineAndCharacter.line) { return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); } - lineAndCharacter = getOneBasedStartLineAndCharacterForNode(list[i], sourceFile); + lineAndCharacter = getZeroBasedStartLineAndCharacterForNode(list[i], sourceFile); } return -1; } function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter: LineAndCharacter, sourceFile: SourceFile, options: EditorOptions): number { - var lineStart = sourceFile.getPositionOfOneBasedLineAndCharacter(lineAndCharacter.line, 1); + var lineStart = sourceFile.getPositionOfZeroBasedLineAndCharacter(lineAndCharacter.line, 0); return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options); } diff --git a/src/services/services.ts b/src/services/services.ts index 05015c60c02..bc745598b8f 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -64,6 +64,7 @@ module ts { getZeroBasedLineAndCharacterOfPosition(pos: number): LineAndCharacter; getOneBasedLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; + getPositionOfZeroBasedLineAndCharacter(line: number, character: number): number; getPositionOfOneBasedLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } @@ -770,6 +771,10 @@ module ts { return ts.getPositionOfOneBasedLineAndCharacter(this, line, character); } + public getPositionOfZeroBasedLineAndCharacter(line: number, character: number): number { + return ts.getPositionOfZeroBasedLineAndCharacter(this, line, character); + } + public getNamedDeclarations() { if (!this.namedDeclarations) { var sourceFile = this; From f06dddcf1e22630745b8ec3accfe3b804fb72626 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 18:05:29 -0800 Subject: [PATCH 102/162] Simplify helper function. --- src/services/utilities.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 41bd63560eb..598519736b9 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -34,8 +34,8 @@ module ts { export function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number { var lineStarts = sourceFile.getLineStarts(); - var line = sourceFile.getOneBasedLineAndCharacterOfPosition(position).line; - return lineStarts[line - 1]; + var line = sourceFile.getZeroBasedLineAndCharacterOfPosition(position).line; + return lineStarts[line]; } export function rangeContainsRange(r1: TextRange, r2: TextRange): boolean { From 572c550a3328a37a1940519e65069ac269c45586 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 18:11:45 -0800 Subject: [PATCH 103/162] Remove usages of computeOneBasedLineAndCharacterOfPosition --- src/compiler/scanner.ts | 11 +++-------- src/harness/fourslash.ts | 4 ++-- src/harness/harnessLanguageService.ts | 6 +----- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index c124c55c7da..66ee7814414 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -296,22 +296,17 @@ module ts { } export function computeZeroBasedLineAndCharacterOfPosition(lineStarts: number[], position: number) { - var oneBased = computeOneBasedLineAndCharacterOfPosition(lineStarts, position); - return { line: oneBased.line - 1, character: oneBased.character -1 }; - } - - export function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number) { var lineNumber = binarySearch(lineStarts, position); if (lineNumber < 0) { // If the actual position was not found, // the binary search returns the negative value of the next line start // e.g. if the line starts at [5, 10, 23, 80] and the position requested was 20 // then the search will return -2 - lineNumber = (~lineNumber) - 1; + lineNumber = ~lineNumber - 1; } return { - line: lineNumber + 1, - character: position - lineStarts[lineNumber] + 1 + line: lineNumber, + character: position - lineStarts[lineNumber] }; } diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 8511d042194..6290eb70235 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -395,8 +395,8 @@ module FourSlash { this.currentCaretPosition = pos; var lineStarts = ts.computeLineStarts(this.getFileContent(this.activeFile.fileName)); - var lineCharPos = ts.computeOneBasedLineAndCharacterOfPosition(lineStarts, pos); - this.scenarioActions.push(''); + var lineCharPos = ts.computeZeroBasedLineAndCharacterOfPosition(lineStarts, pos); + this.scenarioActions.push(''); } public moveCaretRight(count = 1) { diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 07f9916d703..99fd946d398 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -186,11 +186,7 @@ module Harness.LanguageService { var script: ScriptInfo = this.fileNameToScript[fileName]; assert.isNotNull(script); - var result = ts.computeOneBasedLineAndCharacterOfPosition(script.lineMap, position); - - assert.isTrue(result.line >= 1); - assert.isTrue(result.character >= 1); - return { line: result.line - 1, character: result.character - 1 }; + return ts.computeZeroBasedLineAndCharacterOfPosition(script.lineMap, position); } } From 261c8b5bd3a5f4d75a15b4cf8b7e1f691e2768ad Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 18:23:58 -0800 Subject: [PATCH 104/162] Stop using one based math in fourslash. --- src/harness/fourslash.ts | 42 +++++++++++---------------- src/harness/harnessLanguageService.ts | 14 --------- 2 files changed, 17 insertions(+), 39 deletions(-) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 6290eb70235..9f9c84bbc1f 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -2010,39 +2010,31 @@ module FourSlash { // Get the text of the entire line the caret is currently at private getCurrentLineContent() { - // The current caret position (in line/col terms) - var line = this.getCurrentCaretFilePosition().line; - // The line/col of the start of this line - var pos = this.languageServiceAdapterHost.lineColToPosition(this.activeFile.fileName, line, 1); - // The index of the current file + var text = this.getFileContent(this.activeFile.fileName) - // The text from the start of the line to the end of the file - var text = this.getFileContent(this.activeFile.fileName).substring(pos); + var pos = this.currentCaretPosition; + var startPos = pos, endPos = pos; - // Truncate to the first newline - var newlinePos = text.indexOf('\n'); - if (newlinePos === -1) { - return text; - } - else { - if (text.charAt(newlinePos - 1) === '\r') { - newlinePos--; + while (startPos > 0) { + var ch = text.charCodeAt(startPos - 1); + if (ch === ts.CharacterCodes.carriageReturn || ch === ts.CharacterCodes.lineFeed) { + break; } - return text.substr(0, newlinePos); - } - } - private getCurrentCaretFilePosition() { - var result = this.languageServiceAdapterHost.positionToZeroBasedLineAndCharacter(this.activeFile.fileName, this.currentCaretPosition); - if (result.line >= 0) { - result.line++; + startPos--; } - if (result.character >= 0) { - result.character++; + while (endPos < text.length) { + var ch = text.charCodeAt(endPos); + + if (ch === ts.CharacterCodes.carriageReturn || ch === ts.CharacterCodes.lineFeed) { + break; + } + + endPos++; } - return result; + return text.substring(startPos, endPos); } private assertItemInCompletionList(items: ts.CompletionEntry[], name: string, text?: string, documentation?: string, kind?: string) { diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 99fd946d398..8ef89b80c88 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -165,19 +165,6 @@ module Harness.LanguageService { throw new Error("No script with name '" + fileName + "'"); } - /** - * @param line 1 based index - * @param col 1 based index - */ - public lineColToPosition(fileName: string, line: number, col: number): number { - var script: ScriptInfo = this.fileNameToScript[fileName]; - assert.isNotNull(script); - assert.isTrue(line >= 1); - assert.isTrue(col >= 1); - - return ts.computePositionOfOneBasedLineAndCharacter(script.lineMap, line, col); - } - /** * @param line 0 based index * @param col 0 based index @@ -234,7 +221,6 @@ module Harness.LanguageService { addScript(fileName: string, content: string): void { this.nativeHost.addScript(fileName, content); } updateScript(fileName: string, content: string): void { return this.nativeHost.updateScript(fileName, content); } editScript(fileName: string, minChar: number, limChar: number, newText: string): void { this.nativeHost.editScript(fileName, minChar, limChar, newText); } - lineColToPosition(fileName: string, line: number, col: number): number { return this.nativeHost.lineColToPosition(fileName, line, col); } positionToZeroBasedLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { return this.nativeHost.positionToZeroBasedLineAndCharacter(fileName, position); } getCompilationSettings(): string { return JSON.stringify(this.nativeHost.getCompilationSettings()); } From dd90c22406cf352a2b9c25d9a19d7c62471d2b36 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 18:37:38 -0800 Subject: [PATCH 105/162] Use zero based math in hte services layer. --- src/services/services.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/services.ts b/src/services/services.ts index bc745598b8f..0ee0c4f75c3 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -614,7 +614,7 @@ module ts { } if (paramHelpStringMargin === undefined) { - paramHelpStringMargin = sourceFile.getOneBasedLineAndCharacterOfPosition(firstLineParamHelpStringPos).character - 1; + paramHelpStringMargin = sourceFile.getZeroBasedLineAndCharacterOfPosition(firstLineParamHelpStringPos).character; } // Now consume white spaces max From 873e4e3e8ae0beecf3a1cff38202c0beffa79ea3 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 18:57:10 -0800 Subject: [PATCH 106/162] Move formating over to zero based math. --- src/services/formatting/formatting.ts | 44 ++++++++++---------- src/services/formatting/formattingContext.ts | 12 +++--- src/services/utilities.ts | 7 ++-- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index b9cc0b24060..65d35969af5 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -67,14 +67,14 @@ module ts.formatting { } export function formatOnEnter(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[] { - var line = sourceFile.getOneBasedLineAndCharacterOfPosition(position).line; - if (line === 1) { + var line = sourceFile.getZeroBasedLineAndCharacterOfPosition(position).line; + if (line === 0) { return []; } // get the span for the previous\current line var span = { // get start position for the previous line - pos: getStartPositionOfOneBasedLine(line - 1, sourceFile), + pos: getStartPositionOfZeroBasedLine(line - 1, sourceFile), // get end position for the current line (end value is exclusive so add 1 to the result) end: getEndLinePosition(line, sourceFile) + 1 } @@ -283,7 +283,7 @@ module ts.formatting { var previousLine = Constants.Unknown; var childKind = SyntaxKind.Unknown; while (n) { - var line = sourceFile.getOneBasedLineAndCharacterOfPosition(n.getStart(sourceFile)).line; + var line = sourceFile.getZeroBasedLineAndCharacterOfPosition(n.getStart(sourceFile)).line; if (previousLine !== Constants.Unknown && line !== previousLine) { break; } @@ -327,7 +327,7 @@ module ts.formatting { formattingScanner.advance(); if (formattingScanner.isOnToken()) { - var startLine = sourceFile.getOneBasedLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line; + var startLine = sourceFile.getZeroBasedLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line; var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); processNode(enclosingNode, enclosingNode, startLine, initialIndentation, delta); } @@ -357,7 +357,7 @@ module ts.formatting { } } else { - var startLine = sourceFile.getOneBasedLineAndCharacterOfPosition(startPos).line; + var startLine = sourceFile.getZeroBasedLineAndCharacterOfPosition(startPos).line; var startLinePosition = getLineStartPositionForPosition(startPos, sourceFile); var column = SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); if (startLine !== parentStartLine || startPos === column) { @@ -521,7 +521,7 @@ module ts.formatting { var childStartPos = child.getStart(sourceFile); - var childStart = sourceFile.getOneBasedLineAndCharacterOfPosition(childStartPos); + var childStart = sourceFile.getZeroBasedLineAndCharacterOfPosition(childStartPos); // if child is a list item - try to get its indentation var childIndentationAmount = Constants.Unknown; @@ -594,7 +594,7 @@ module ts.formatting { } else if (tokenInfo.token.kind === listStartToken) { // consume list start token - startLine = sourceFile.getOneBasedLineAndCharacterOfPosition(tokenInfo.token.pos).line; + startLine = sourceFile.getZeroBasedLineAndCharacterOfPosition(tokenInfo.token.pos).line; var indentation = computeIndentation(tokenInfo.token, startLine, Constants.Unknown, parent, parentDynamicIndentation, startLine); @@ -641,7 +641,7 @@ module ts.formatting { var lineAdded: boolean; var isTokenInRange = rangeContainsRange(originalRange, currentTokenInfo.token); - var tokenStart = sourceFile.getOneBasedLineAndCharacterOfPosition(currentTokenInfo.token.pos); + var tokenStart = sourceFile.getZeroBasedLineAndCharacterOfPosition(currentTokenInfo.token.pos); if (isTokenInRange) { var rangeHasError = rangeContainsError(currentTokenInfo.token); // save prevStartLine since processRange will overwrite this value with current ones @@ -674,7 +674,7 @@ module ts.formatting { continue; } - var triviaStartLine = sourceFile.getOneBasedLineAndCharacterOfPosition(triviaItem.pos).line; + var triviaStartLine = sourceFile.getZeroBasedLineAndCharacterOfPosition(triviaItem.pos).line; switch (triviaItem.kind) { case SyntaxKind.MultiLineCommentTrivia: var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); @@ -712,7 +712,7 @@ module ts.formatting { for (var i = 0, len = trivia.length; i < len; ++i) { var triviaItem = trivia[i]; if (isComment(triviaItem.kind) && rangeContainsRange(originalRange, triviaItem)) { - var triviaItemStart = sourceFile.getOneBasedLineAndCharacterOfPosition(triviaItem.pos); + var triviaItemStart = sourceFile.getZeroBasedLineAndCharacterOfPosition(triviaItem.pos); processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); } } @@ -729,7 +729,7 @@ module ts.formatting { if (!rangeHasError && !previousRangeHasError) { if (!previousRange) { // trim whitespaces starting from the beginning of the span up to the current line - var originalStart = sourceFile.getOneBasedLineAndCharacterOfPosition(originalRange.pos); + var originalStart = sourceFile.getZeroBasedLineAndCharacterOfPosition(originalRange.pos); trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); } else { @@ -807,18 +807,18 @@ module ts.formatting { recordReplace(pos, 0, indentationString); } else { - var tokenStart = sourceFile.getOneBasedLineAndCharacterOfPosition(pos); - if (indentation !== tokenStart.character - 1) { - var startLinePosition = getStartPositionOfOneBasedLine(tokenStart.line, sourceFile); - recordReplace(startLinePosition, tokenStart.character - 1, indentationString); + var tokenStart = sourceFile.getZeroBasedLineAndCharacterOfPosition(pos); + if (indentation !== tokenStart.character) { + var startLinePosition = getStartPositionOfZeroBasedLine(tokenStart.line, sourceFile); + recordReplace(startLinePosition, tokenStart.character, indentationString); } } } function indentMultilineComment(commentRange: TextRange, indentation: number, firstLineIsIndented: boolean) { // split comment in lines - var startLine = sourceFile.getOneBasedLineAndCharacterOfPosition(commentRange.pos).line; - var endLine = sourceFile.getOneBasedLineAndCharacterOfPosition(commentRange.end).line; + var startLine = sourceFile.getZeroBasedLineAndCharacterOfPosition(commentRange.pos).line; + var endLine = sourceFile.getZeroBasedLineAndCharacterOfPosition(commentRange.end).line; if (startLine === endLine) { if (!firstLineIsIndented) { @@ -833,13 +833,13 @@ module ts.formatting { for (var line = startLine; line < endLine; ++line) { var endOfLine = getEndLinePosition(line, sourceFile); parts.push({ pos: startPos, end: endOfLine }); - startPos = getStartPositionOfOneBasedLine(line + 1, sourceFile); + startPos = getStartPositionOfZeroBasedLine(line + 1, sourceFile); } parts.push({ pos: startPos, end: commentRange.end }); } - var startLinePos = getStartPositionOfOneBasedLine(startLine, sourceFile); + var startLinePos = getStartPositionOfZeroBasedLine(startLine, sourceFile); var nonWhitespaceColumnInFirstPart = SmartIndenter.findFirstNonWhitespaceColumn(startLinePos, parts[0].pos, sourceFile, options); @@ -857,7 +857,7 @@ module ts.formatting { // shift all parts on the delta size var delta = indentation - nonWhitespaceColumnInFirstPart; for (var i = startIndex, len = parts.length; i < len; ++i, ++startLine) { - var startLinePos = getStartPositionOfOneBasedLine(startLine, sourceFile); + var startLinePos = getStartPositionOfZeroBasedLine(startLine, sourceFile); var nonWhitespaceColumn = i === 0 ? nonWhitespaceColumnInFirstPart @@ -876,7 +876,7 @@ module ts.formatting { function trimTrailingWhitespacesForLines(line1: number, line2: number, range?: TextRangeWithKind) { for (var line = line1; line < line2; ++line) { - var lineStartPosition = getStartPositionOfOneBasedLine(line, sourceFile); + var lineStartPosition = getStartPositionOfZeroBasedLine(line, sourceFile); var lineEndPosition = getEndLinePosition(line, sourceFile); // do not trim whitespaces in comments diff --git a/src/services/formatting/formattingContext.ts b/src/services/formatting/formattingContext.ts index 0b9372d86e2..5297f9e6658 100644 --- a/src/services/formatting/formattingContext.ts +++ b/src/services/formatting/formattingContext.ts @@ -71,8 +71,8 @@ module ts.formatting { public TokensAreOnSameLine(): boolean { if (this.tokensAreOnSameLine === undefined) { - var startLine = this.sourceFile.getOneBasedLineAndCharacterOfPosition(this.currentTokenSpan.pos).line; - var endLine = this.sourceFile.getOneBasedLineAndCharacterOfPosition(this.nextTokenSpan.pos).line; + var startLine = this.sourceFile.getZeroBasedLineAndCharacterOfPosition(this.currentTokenSpan.pos).line; + var endLine = this.sourceFile.getZeroBasedLineAndCharacterOfPosition(this.nextTokenSpan.pos).line; this.tokensAreOnSameLine = (startLine == endLine); } @@ -96,8 +96,8 @@ module ts.formatting { } private NodeIsOnOneLine(node: Node): boolean { - var startLine = this.sourceFile.getOneBasedLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line; - var endLine = this.sourceFile.getOneBasedLineAndCharacterOfPosition(node.getEnd()).line; + var startLine = this.sourceFile.getZeroBasedLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line; + var endLine = this.sourceFile.getZeroBasedLineAndCharacterOfPosition(node.getEnd()).line; return startLine == endLine; } @@ -105,8 +105,8 @@ module ts.formatting { var openBrace = findChildOfKind(node, SyntaxKind.OpenBraceToken, this.sourceFile); var closeBrace = findChildOfKind(node, SyntaxKind.CloseBraceToken, this.sourceFile); if (openBrace && closeBrace) { - var startLine = this.sourceFile.getOneBasedLineAndCharacterOfPosition(openBrace.getEnd()).line; - var endLine = this.sourceFile.getOneBasedLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; + var startLine = this.sourceFile.getZeroBasedLineAndCharacterOfPosition(openBrace.getEnd()).line; + var endLine = this.sourceFile.getZeroBasedLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; return startLine === endLine; } return false; diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 598519736b9..72fee5260a4 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -6,12 +6,11 @@ module ts { } export function getEndLinePosition(line: number, sourceFile: SourceFile): number { - Debug.assert(line >= 1); + Debug.assert(line >= 0); var lineStarts = sourceFile.getLineStarts(); - // lines returned by SourceFile.getLineAndCharacterForPosition are 1-based - var lineIndex = line - 1; - if (lineIndex === lineStarts.length - 1) { + var lineIndex = line; + if (lineIndex + 1 === lineStarts.length) { // last line - return EOF return sourceFile.text.length - 1; } From e723d4cee07f50a3b9443cb111eaf3b46f668f3e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 19:01:32 -0800 Subject: [PATCH 107/162] Use the zero based methods in the harness. --- src/harness/harness.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 4a87f953ee1..b2c19f2f51d 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -1184,13 +1184,13 @@ module Harness { } export function getMinimalDiagnostic(err: ts.Diagnostic): HarnessDiagnostic { - var errorLineInfo = err.file ? err.file.getOneBasedLineAndCharacterOfPosition(err.start) : { line: 0, character: 0 }; + var errorLineInfo = err.file ? err.file.getZeroBasedLineAndCharacterOfPosition(err.start) : { line: -1, character: -1 }; return { fileName: err.file && err.file.fileName, start: err.start, end: err.start + err.length, - line: errorLineInfo.line, - character: errorLineInfo.character, + line: errorLineInfo.line + 1, + character: errorLineInfo.character + 1, message: ts.flattenDiagnosticMessageText(err.messageText, ts.sys.newLine), category: ts.DiagnosticCategory[err.category].toLowerCase(), code: err.code From 041b6460040dbc3a05686bce3acf58e3699f8a8f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 19:06:47 -0800 Subject: [PATCH 108/162] Move typewriter over to using zero based math. --- src/harness/typeWriter.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/harness/typeWriter.ts b/src/harness/typeWriter.ts index 44532c6a59e..30ff313ca67 100644 --- a/src/harness/typeWriter.ts +++ b/src/harness/typeWriter.ts @@ -85,15 +85,17 @@ class TypeWriterWalker { private log(node: ts.Node, type: ts.Type): void { var actualPos = ts.skipTrivia(this.currentSourceFile.text, node.pos); - var lineAndCharacter = this.currentSourceFile.getOneBasedLineAndCharacterOfPosition(actualPos); + var lineAndCharacter = this.currentSourceFile.getZeroBasedLineAndCharacterOfPosition(actualPos); var sourceText = ts.getTextOfNodeFromSourceText(this.currentSourceFile.text, node); // If we got an unknown type, we temporarily want to fall back to just pretending the name // (source text) of the node is the type. This is to align with the old typeWriter to make // baseline comparisons easier. In the long term, we will want to just call typeToString this.results.push({ - line: lineAndCharacter.line - 1, - column: lineAndCharacter.character, + line: lineAndCharacter.line, + // todo(cyrusn): Not sure why column is one-based for type-writer. But I'm preserving + // that behavior to prevent having a lot of baselines to fix up. + column: lineAndCharacter.character + 1, syntaxKind: node.kind, sourceText: sourceText, type: this.checker.typeToString(type, node.parent, ts.TypeFormatFlags.NoTruncation | ts.TypeFormatFlags.WriteOwnNameForAnyLike) From 8ba918073062ceab284a495378f6ec1340d3de70 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 19:16:16 -0800 Subject: [PATCH 109/162] Remove the one based APIs. --- src/compiler/scanner.ts | 12 ++++-------- src/compiler/utilities.ts | 5 ----- src/services/services.ts | 13 ------------- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 66ee7814414..186c2a5ee79 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -279,16 +279,12 @@ module ts { } export function getPositionOfZeroBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { - return computePositionOfOneBasedLineAndCharacter(getLineStarts(sourceFile), line + 1, character + 1); + return computePositionOfZeroBasedLineAndCharacter(getLineStarts(sourceFile), line, character); } - export function getPositionOfOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { - return computePositionOfOneBasedLineAndCharacter(getLineStarts(sourceFile), line, character); - } - - export function computePositionOfOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number { - Debug.assert(line > 0 && line <= lineStarts.length); - return lineStarts[line - 1] + character - 1; + export function computePositionOfZeroBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number { + Debug.assert(line >= 0 && line < lineStarts.length); + return lineStarts[line] + character; } export function getLineStarts(sourceFile: SourceFile): number[] { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index d543adaa103..da00bba6a31 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -110,11 +110,6 @@ module ts { return getLineStarts(sourceFile)[line]; } - export function getStartPositionOfOneBasedLine(line: number, sourceFile: SourceFile): number { - Debug.assert(line >= 1); - return getLineStarts(sourceFile)[line - 1]; - } - // This is a useful function for debugging purposes. export function nodePosToString(node: Node): string { var file = getSourceFileOfNode(node); diff --git a/src/services/services.ts b/src/services/services.ts index 0ee0c4f75c3..7f1e52e4962 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -62,10 +62,8 @@ module ts { nameTable: Map; getNamedDeclarations(): Declaration[]; getZeroBasedLineAndCharacterOfPosition(pos: number): LineAndCharacter; - getOneBasedLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; getPositionOfZeroBasedLineAndCharacter(line: number, character: number): number; - getPositionOfOneBasedLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } @@ -756,21 +754,10 @@ module ts { return ts.getZeroBasedLineAndCharacterOfPosition(this, position); } - public getOneBasedLineAndCharacterOfPosition(position: number): LineAndCharacter { - var result = ts.getZeroBasedLineAndCharacterOfPosition(this, position); - result.line++; - result.character++; - return result; - } - public getLineStarts(): number[] { return getLineStarts(this); } - public getPositionOfOneBasedLineAndCharacter(line: number, character: number): number { - return ts.getPositionOfOneBasedLineAndCharacter(this, line, character); - } - public getPositionOfZeroBasedLineAndCharacter(line: number, character: number): number { return ts.getPositionOfZeroBasedLineAndCharacter(this, line, character); } From 124a77cc3a28e4851dad1f60dda933d9db982054 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 19:35:45 -0800 Subject: [PATCH 110/162] Remove 'ZeroBased' from all APIs, now that all APIs are zero based. --- src/compiler/emitter.ts | 30 ++++++++-------- src/compiler/scanner.ts | 12 +++---- src/compiler/tsc.ts | 2 +- src/compiler/utilities.ts | 4 +-- src/harness/fourslash.ts | 4 +-- src/harness/harness.ts | 2 +- src/harness/harnessLanguageService.ts | 6 ++-- src/harness/typeWriter.ts | 2 +- src/services/breakpoints.ts | 8 ++--- src/services/formatting/formatting.ts | 38 ++++++++++---------- src/services/formatting/formattingContext.ts | 12 +++---- src/services/formatting/smartIndenter.ts | 26 +++++++------- src/services/services.ts | 14 ++++---- src/services/utilities.ts | 2 +- 14 files changed, 81 insertions(+), 81 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 2e78b9a2a46..6fafe9c65fb 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -133,14 +133,14 @@ module ts { }; } - function getZeroBasedLineOfLocalPosition(currentSourceFile: SourceFile, pos: number) { - return getZeroBasedLineAndCharacterOfPosition(currentSourceFile, pos).line; + function getBasedLineOfLocalPosition(currentSourceFile: SourceFile, pos: number) { + return getLineAndCharacterOfPosition(currentSourceFile, pos).line; } function emitNewLineBeforeLeadingComments(currentSourceFile: SourceFile, writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]) { // If the leading comments start on different line than the start of node, write new line if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && - getZeroBasedLineOfLocalPosition(currentSourceFile, node.pos) !== getZeroBasedLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + getBasedLineOfLocalPosition(currentSourceFile, node.pos) !== getBasedLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { writer.writeLine(); } } @@ -169,18 +169,18 @@ module ts { function writeCommentRange(currentSourceFile: SourceFile, writer: EmitTextWriter, comment: CommentRange, newLine: string){ if (currentSourceFile.text.charCodeAt(comment.pos + 1) === CharacterCodes.asterisk) { - var firstCommentLineAndCharacter = getZeroBasedLineAndCharacterOfPosition(currentSourceFile, comment.pos); + var firstCommentLineAndCharacter = getLineAndCharacterOfPosition(currentSourceFile, comment.pos); var lineCount = getLineStarts(currentSourceFile).length; var firstCommentLineIndent: number; for (var pos = comment.pos, currentLine = firstCommentLineAndCharacter.line; pos < comment.end; currentLine++) { var nextLineStart = (currentLine + 1) === lineCount ? currentSourceFile.text.length + 1 - : getStartPositionOfZeroBasedLine(currentLine + 1, currentSourceFile); + : getStartPositionOfLine(currentLine + 1, currentSourceFile); if (pos !== comment.pos) { // If we are not emitting first line, we need to write the spaces to adjust the alignment if (firstCommentLineIndent === undefined) { - firstCommentLineIndent = calculateIndent(getStartPositionOfZeroBasedLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); + firstCommentLineIndent = calculateIndent(getStartPositionOfLine(firstCommentLineAndCharacter.line, currentSourceFile), comment.pos); } // These are number of spaces writer is going to write at current indent @@ -1734,7 +1734,7 @@ module ts { } function recordSourceMapSpan(pos: number) { - var sourceLinePos = getZeroBasedLineAndCharacterOfPosition(currentSourceFile, pos); + var sourceLinePos = getLineAndCharacterOfPosition(currentSourceFile, pos); // Convert the location to be one-based. sourceLinePos.line++; @@ -2979,13 +2979,13 @@ module ts { } function isOnSameLine(node1: Node, node2: Node) { - return getZeroBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node1.pos)) === - getZeroBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); + return getBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node1.pos)) === + getBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); } function nodeEndIsOnSameLineAsNodeStart(node1: Node, node2: Node) { - return getZeroBasedLineOfLocalPosition(currentSourceFile, node1.end) === - getZeroBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); + return getBasedLineOfLocalPosition(currentSourceFile, node1.end) === + getBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node: CaseOrDefaultClause) { @@ -4476,8 +4476,8 @@ module ts { forEach(leadingComments, comment => { if (lastComment) { - var lastCommentLine = getZeroBasedLineOfLocalPosition(currentSourceFile, lastComment.end); - var commentLine = getZeroBasedLineOfLocalPosition(currentSourceFile, comment.pos); + var lastCommentLine = getBasedLineOfLocalPosition(currentSourceFile, lastComment.end); + var commentLine = getBasedLineOfLocalPosition(currentSourceFile, comment.pos); if (commentLine >= lastCommentLine + 2) { // There was a blank line between the last comment and this comment. This @@ -4495,8 +4495,8 @@ module ts { // All comments look like they could have been part of the copyright header. Make // sure there is at least one blank line between it and the node. If not, it's not // a copyright header. - var lastCommentLine = getZeroBasedLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); - var nodeLine = getZeroBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); + var lastCommentLine = getBasedLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); + var nodeLine = getBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); if (nodeLine >= lastCommentLine + 2) { // Valid detachedComments emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 186c2a5ee79..7eddbb962fc 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -278,11 +278,11 @@ module ts { return result; } - export function getPositionOfZeroBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { - return computePositionOfZeroBasedLineAndCharacter(getLineStarts(sourceFile), line, character); + export function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number { + return computePositionOfLineAndCharacter(getLineStarts(sourceFile), line, character); } - export function computePositionOfZeroBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number { + export function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number { Debug.assert(line >= 0 && line < lineStarts.length); return lineStarts[line] + character; } @@ -291,7 +291,7 @@ module ts { return sourceFile.lineMap || (sourceFile.lineMap = computeLineStarts(sourceFile.text)); } - export function computeZeroBasedLineAndCharacterOfPosition(lineStarts: number[], position: number) { + export function computeLineAndCharacterOfPosition(lineStarts: number[], position: number) { var lineNumber = binarySearch(lineStarts, position); if (lineNumber < 0) { // If the actual position was not found, @@ -306,8 +306,8 @@ module ts { }; } - export function getZeroBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter { - return computeZeroBasedLineAndCharacterOfPosition(getLineStarts(sourceFile), position); + export function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter { + return computeLineAndCharacterOfPosition(getLineStarts(sourceFile), position); } var hasOwnProperty = Object.prototype.hasOwnProperty; diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 64272b196ff..68e85d3f71d 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -86,7 +86,7 @@ module ts { var output = ""; if (diagnostic.file) { - var loc = getZeroBasedLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); + var loc = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); output += diagnostic.file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + "): "; } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index da00bba6a31..6b336544eba 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -105,7 +105,7 @@ module ts { return node; } - export function getStartPositionOfZeroBasedLine(line: number, sourceFile: SourceFile): number { + export function getStartPositionOfLine(line: number, sourceFile: SourceFile): number { Debug.assert(line >= 0); return getLineStarts(sourceFile)[line]; } @@ -113,7 +113,7 @@ module ts { // This is a useful function for debugging purposes. export function nodePosToString(node: Node): string { var file = getSourceFileOfNode(node); - var loc = getZeroBasedLineAndCharacterOfPosition(file, node.pos); + var loc = getLineAndCharacterOfPosition(file, node.pos); return file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + ")"; } diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 9f9c84bbc1f..e40a367074d 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -395,7 +395,7 @@ module FourSlash { this.currentCaretPosition = pos; var lineStarts = ts.computeLineStarts(this.getFileContent(this.activeFile.fileName)); - var lineCharPos = ts.computeZeroBasedLineAndCharacterOfPosition(lineStarts, pos); + var lineCharPos = ts.computeLineAndCharacterOfPosition(lineStarts, pos); this.scenarioActions.push(''); } @@ -2112,7 +2112,7 @@ module FourSlash { } private getLineColStringAtPosition(position: number) { - var pos = this.languageServiceAdapterHost.positionToZeroBasedLineAndCharacter(this.activeFile.fileName, position); + var pos = this.languageServiceAdapterHost.positionToLineAndCharacter(this.activeFile.fileName, position); return 'line ' + (pos.line + 1) + ', col ' + pos.character; } diff --git a/src/harness/harness.ts b/src/harness/harness.ts index b2c19f2f51d..8658aea0a63 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -1184,7 +1184,7 @@ module Harness { } export function getMinimalDiagnostic(err: ts.Diagnostic): HarnessDiagnostic { - var errorLineInfo = err.file ? err.file.getZeroBasedLineAndCharacterOfPosition(err.start) : { line: -1, character: -1 }; + var errorLineInfo = err.file ? err.file.getLineAndCharacterOfPosition(err.start) : { line: -1, character: -1 }; return { fileName: err.file && err.file.fileName, start: err.start, diff --git a/src/harness/harnessLanguageService.ts b/src/harness/harnessLanguageService.ts index 8ef89b80c88..e8f16825468 100644 --- a/src/harness/harnessLanguageService.ts +++ b/src/harness/harnessLanguageService.ts @@ -169,11 +169,11 @@ module Harness.LanguageService { * @param line 0 based index * @param col 0 based index */ - public positionToZeroBasedLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { + public positionToLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { var script: ScriptInfo = this.fileNameToScript[fileName]; assert.isNotNull(script); - return ts.computeZeroBasedLineAndCharacterOfPosition(script.lineMap, position); + return ts.computeLineAndCharacterOfPosition(script.lineMap, position); } } @@ -221,7 +221,7 @@ module Harness.LanguageService { addScript(fileName: string, content: string): void { this.nativeHost.addScript(fileName, content); } updateScript(fileName: string, content: string): void { return this.nativeHost.updateScript(fileName, content); } editScript(fileName: string, minChar: number, limChar: number, newText: string): void { this.nativeHost.editScript(fileName, minChar, limChar, newText); } - positionToZeroBasedLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { return this.nativeHost.positionToZeroBasedLineAndCharacter(fileName, position); } + positionToLineAndCharacter(fileName: string, position: number): ts.LineAndCharacter { return this.nativeHost.positionToLineAndCharacter(fileName, position); } getCompilationSettings(): string { return JSON.stringify(this.nativeHost.getCompilationSettings()); } getCancellationToken(): ts.CancellationToken { return this.nativeHost.getCancellationToken(); } diff --git a/src/harness/typeWriter.ts b/src/harness/typeWriter.ts index 30ff313ca67..54cdc27e3b3 100644 --- a/src/harness/typeWriter.ts +++ b/src/harness/typeWriter.ts @@ -85,7 +85,7 @@ class TypeWriterWalker { private log(node: ts.Node, type: ts.Type): void { var actualPos = ts.skipTrivia(this.currentSourceFile.text, node.pos); - var lineAndCharacter = this.currentSourceFile.getZeroBasedLineAndCharacterOfPosition(actualPos); + var lineAndCharacter = this.currentSourceFile.getLineAndCharacterOfPosition(actualPos); var sourceText = ts.getTextOfNodeFromSourceText(this.currentSourceFile.text, node); // If we got an unknown type, we temporarily want to fall back to just pretending the name diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 492cc7866e9..1367d1affcd 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -14,8 +14,8 @@ module ts.BreakpointResolver { } var tokenAtLocation = getTokenAtPosition(sourceFile, position); - var lineOfPosition = sourceFile.getZeroBasedLineAndCharacterOfPosition(position).line; - if (sourceFile.getZeroBasedLineAndCharacterOfPosition(tokenAtLocation.getStart()).line > lineOfPosition) { + var lineOfPosition = sourceFile.getLineAndCharacterOfPosition(position).line; + if (sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getStart()).line > lineOfPosition) { // Get previous token if the token is returned starts on new line // eg: var x =10; |--- cursor is here // var y = 10; @@ -24,7 +24,7 @@ module ts.BreakpointResolver { tokenAtLocation = findPrecedingToken(tokenAtLocation.pos, sourceFile); // Its a blank line - if (!tokenAtLocation || sourceFile.getZeroBasedLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { + if (!tokenAtLocation || sourceFile.getLineAndCharacterOfPosition(tokenAtLocation.getEnd()).line !== lineOfPosition) { return undefined; } } @@ -42,7 +42,7 @@ module ts.BreakpointResolver { } function spanInNodeIfStartsOnSameLine(node: Node, otherwiseOnNode?: Node): TextSpan { - if (node && lineOfPosition === sourceFile.getZeroBasedLineAndCharacterOfPosition(node.getStart()).line) { + if (node && lineOfPosition === sourceFile.getLineAndCharacterOfPosition(node.getStart()).line) { return spanInNode(node); } return spanInNode(otherwiseOnNode); diff --git a/src/services/formatting/formatting.ts b/src/services/formatting/formatting.ts index 65d35969af5..180ff0c9e95 100644 --- a/src/services/formatting/formatting.ts +++ b/src/services/formatting/formatting.ts @@ -67,14 +67,14 @@ module ts.formatting { } export function formatOnEnter(position: number, sourceFile: SourceFile, rulesProvider: RulesProvider, options: FormatCodeOptions): TextChange[] { - var line = sourceFile.getZeroBasedLineAndCharacterOfPosition(position).line; + var line = sourceFile.getLineAndCharacterOfPosition(position).line; if (line === 0) { return []; } // get the span for the previous\current line var span = { // get start position for the previous line - pos: getStartPositionOfZeroBasedLine(line - 1, sourceFile), + pos: getStartPositionOfLine(line - 1, sourceFile), // get end position for the current line (end value is exclusive so add 1 to the result) end: getEndLinePosition(line, sourceFile) + 1 } @@ -283,7 +283,7 @@ module ts.formatting { var previousLine = Constants.Unknown; var childKind = SyntaxKind.Unknown; while (n) { - var line = sourceFile.getZeroBasedLineAndCharacterOfPosition(n.getStart(sourceFile)).line; + var line = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)).line; if (previousLine !== Constants.Unknown && line !== previousLine) { break; } @@ -327,7 +327,7 @@ module ts.formatting { formattingScanner.advance(); if (formattingScanner.isOnToken()) { - var startLine = sourceFile.getZeroBasedLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line; + var startLine = sourceFile.getLineAndCharacterOfPosition(enclosingNode.getStart(sourceFile)).line; var delta = getOwnOrInheritedDelta(enclosingNode, options, sourceFile); processNode(enclosingNode, enclosingNode, startLine, initialIndentation, delta); } @@ -357,7 +357,7 @@ module ts.formatting { } } else { - var startLine = sourceFile.getZeroBasedLineAndCharacterOfPosition(startPos).line; + var startLine = sourceFile.getLineAndCharacterOfPosition(startPos).line; var startLinePosition = getLineStartPositionForPosition(startPos, sourceFile); var column = SmartIndenter.findFirstNonWhitespaceColumn(startLinePosition, startPos, sourceFile, options); if (startLine !== parentStartLine || startPos === column) { @@ -521,7 +521,7 @@ module ts.formatting { var childStartPos = child.getStart(sourceFile); - var childStart = sourceFile.getZeroBasedLineAndCharacterOfPosition(childStartPos); + var childStart = sourceFile.getLineAndCharacterOfPosition(childStartPos); // if child is a list item - try to get its indentation var childIndentationAmount = Constants.Unknown; @@ -594,7 +594,7 @@ module ts.formatting { } else if (tokenInfo.token.kind === listStartToken) { // consume list start token - startLine = sourceFile.getZeroBasedLineAndCharacterOfPosition(tokenInfo.token.pos).line; + startLine = sourceFile.getLineAndCharacterOfPosition(tokenInfo.token.pos).line; var indentation = computeIndentation(tokenInfo.token, startLine, Constants.Unknown, parent, parentDynamicIndentation, startLine); @@ -641,7 +641,7 @@ module ts.formatting { var lineAdded: boolean; var isTokenInRange = rangeContainsRange(originalRange, currentTokenInfo.token); - var tokenStart = sourceFile.getZeroBasedLineAndCharacterOfPosition(currentTokenInfo.token.pos); + var tokenStart = sourceFile.getLineAndCharacterOfPosition(currentTokenInfo.token.pos); if (isTokenInRange) { var rangeHasError = rangeContainsError(currentTokenInfo.token); // save prevStartLine since processRange will overwrite this value with current ones @@ -674,7 +674,7 @@ module ts.formatting { continue; } - var triviaStartLine = sourceFile.getZeroBasedLineAndCharacterOfPosition(triviaItem.pos).line; + var triviaStartLine = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos).line; switch (triviaItem.kind) { case SyntaxKind.MultiLineCommentTrivia: var commentIndentation = dynamicIndentation.getIndentationForComment(currentTokenInfo.token.kind); @@ -712,7 +712,7 @@ module ts.formatting { for (var i = 0, len = trivia.length; i < len; ++i) { var triviaItem = trivia[i]; if (isComment(triviaItem.kind) && rangeContainsRange(originalRange, triviaItem)) { - var triviaItemStart = sourceFile.getZeroBasedLineAndCharacterOfPosition(triviaItem.pos); + var triviaItemStart = sourceFile.getLineAndCharacterOfPosition(triviaItem.pos); processRange(triviaItem, triviaItemStart, parent, contextNode, dynamicIndentation); } } @@ -729,7 +729,7 @@ module ts.formatting { if (!rangeHasError && !previousRangeHasError) { if (!previousRange) { // trim whitespaces starting from the beginning of the span up to the current line - var originalStart = sourceFile.getZeroBasedLineAndCharacterOfPosition(originalRange.pos); + var originalStart = sourceFile.getLineAndCharacterOfPosition(originalRange.pos); trimTrailingWhitespacesForLines(originalStart.line, rangeStart.line); } else { @@ -807,9 +807,9 @@ module ts.formatting { recordReplace(pos, 0, indentationString); } else { - var tokenStart = sourceFile.getZeroBasedLineAndCharacterOfPosition(pos); + var tokenStart = sourceFile.getLineAndCharacterOfPosition(pos); if (indentation !== tokenStart.character) { - var startLinePosition = getStartPositionOfZeroBasedLine(tokenStart.line, sourceFile); + var startLinePosition = getStartPositionOfLine(tokenStart.line, sourceFile); recordReplace(startLinePosition, tokenStart.character, indentationString); } } @@ -817,8 +817,8 @@ module ts.formatting { function indentMultilineComment(commentRange: TextRange, indentation: number, firstLineIsIndented: boolean) { // split comment in lines - var startLine = sourceFile.getZeroBasedLineAndCharacterOfPosition(commentRange.pos).line; - var endLine = sourceFile.getZeroBasedLineAndCharacterOfPosition(commentRange.end).line; + var startLine = sourceFile.getLineAndCharacterOfPosition(commentRange.pos).line; + var endLine = sourceFile.getLineAndCharacterOfPosition(commentRange.end).line; if (startLine === endLine) { if (!firstLineIsIndented) { @@ -833,13 +833,13 @@ module ts.formatting { for (var line = startLine; line < endLine; ++line) { var endOfLine = getEndLinePosition(line, sourceFile); parts.push({ pos: startPos, end: endOfLine }); - startPos = getStartPositionOfZeroBasedLine(line + 1, sourceFile); + startPos = getStartPositionOfLine(line + 1, sourceFile); } parts.push({ pos: startPos, end: commentRange.end }); } - var startLinePos = getStartPositionOfZeroBasedLine(startLine, sourceFile); + var startLinePos = getStartPositionOfLine(startLine, sourceFile); var nonWhitespaceColumnInFirstPart = SmartIndenter.findFirstNonWhitespaceColumn(startLinePos, parts[0].pos, sourceFile, options); @@ -857,7 +857,7 @@ module ts.formatting { // shift all parts on the delta size var delta = indentation - nonWhitespaceColumnInFirstPart; for (var i = startIndex, len = parts.length; i < len; ++i, ++startLine) { - var startLinePos = getStartPositionOfZeroBasedLine(startLine, sourceFile); + var startLinePos = getStartPositionOfLine(startLine, sourceFile); var nonWhitespaceColumn = i === 0 ? nonWhitespaceColumnInFirstPart @@ -876,7 +876,7 @@ module ts.formatting { function trimTrailingWhitespacesForLines(line1: number, line2: number, range?: TextRangeWithKind) { for (var line = line1; line < line2; ++line) { - var lineStartPosition = getStartPositionOfZeroBasedLine(line, sourceFile); + var lineStartPosition = getStartPositionOfLine(line, sourceFile); var lineEndPosition = getEndLinePosition(line, sourceFile); // do not trim whitespaces in comments diff --git a/src/services/formatting/formattingContext.ts b/src/services/formatting/formattingContext.ts index 5297f9e6658..b7573526f78 100644 --- a/src/services/formatting/formattingContext.ts +++ b/src/services/formatting/formattingContext.ts @@ -71,8 +71,8 @@ module ts.formatting { public TokensAreOnSameLine(): boolean { if (this.tokensAreOnSameLine === undefined) { - var startLine = this.sourceFile.getZeroBasedLineAndCharacterOfPosition(this.currentTokenSpan.pos).line; - var endLine = this.sourceFile.getZeroBasedLineAndCharacterOfPosition(this.nextTokenSpan.pos).line; + var startLine = this.sourceFile.getLineAndCharacterOfPosition(this.currentTokenSpan.pos).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(this.nextTokenSpan.pos).line; this.tokensAreOnSameLine = (startLine == endLine); } @@ -96,8 +96,8 @@ module ts.formatting { } private NodeIsOnOneLine(node: Node): boolean { - var startLine = this.sourceFile.getZeroBasedLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line; - var endLine = this.sourceFile.getZeroBasedLineAndCharacterOfPosition(node.getEnd()).line; + var startLine = this.sourceFile.getLineAndCharacterOfPosition(node.getStart(this.sourceFile)).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(node.getEnd()).line; return startLine == endLine; } @@ -105,8 +105,8 @@ module ts.formatting { var openBrace = findChildOfKind(node, SyntaxKind.OpenBraceToken, this.sourceFile); var closeBrace = findChildOfKind(node, SyntaxKind.CloseBraceToken, this.sourceFile); if (openBrace && closeBrace) { - var startLine = this.sourceFile.getZeroBasedLineAndCharacterOfPosition(openBrace.getEnd()).line; - var endLine = this.sourceFile.getZeroBasedLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; + var startLine = this.sourceFile.getLineAndCharacterOfPosition(openBrace.getEnd()).line; + var endLine = this.sourceFile.getLineAndCharacterOfPosition(closeBrace.getStart(this.sourceFile)).line; return startLine === endLine; } return false; diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 1c36df49d47..30d53b00370 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -24,7 +24,7 @@ module ts.formatting { return 0; } - var lineAtPosition = sourceFile.getZeroBasedLineAndCharacterOfPosition(position).line; + var lineAtPosition = sourceFile.getLineAndCharacterOfPosition(position).line; if (precedingToken.kind === SyntaxKind.CommaToken && precedingToken.parent.kind !== SyntaxKind.BinaryExpression) { // previous token is comma that separates items in list - find the previous item and try to derive indentation from it @@ -43,7 +43,7 @@ module ts.formatting { while (current) { if (positionBelongsToNode(current, position, sourceFile) && shouldIndentChildNode(current.kind, previous ? previous.kind : SyntaxKind.Unknown)) { - currentStart = getZeroBasedStartLineAndCharacterForNode(current, sourceFile); + currentStart = getStartLineAndCharacterForNode(current, sourceFile); if (nextTokenIsCurlyBraceOnSameLineAsCursor(precedingToken, current, lineAtPosition, sourceFile)) { indentationDelta = 0; @@ -74,7 +74,7 @@ module ts.formatting { } export function getIndentationForNode(n: Node, ignoreActualIndentationRange: TextRange, sourceFile: SourceFile, options: FormatCodeOptions): number { - var start = sourceFile.getZeroBasedLineAndCharacterOfPosition(n.getStart(sourceFile)); + var start = sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); return getIndentationForNodeWorker(n, start, ignoreActualIndentationRange, /*indentationDelta*/ 0, sourceFile, options); } @@ -135,10 +135,10 @@ module ts.formatting { function getParentStart(parent: Node, child: Node, sourceFile: SourceFile): LineAndCharacter { var containingList = getContainingList(child, sourceFile); if (containingList) { - return sourceFile.getZeroBasedLineAndCharacterOfPosition(containingList.pos); + return sourceFile.getLineAndCharacterOfPosition(containingList.pos); } - return sourceFile.getZeroBasedLineAndCharacterOfPosition(parent.getStart(sourceFile)); + return sourceFile.getLineAndCharacterOfPosition(parent.getStart(sourceFile)); } /* @@ -196,15 +196,15 @@ module ts.formatting { // class A { // $} - var nextTokenStartLine = getZeroBasedStartLineAndCharacterForNode(nextToken, sourceFile).line; + var nextTokenStartLine = getStartLineAndCharacterForNode(nextToken, sourceFile).line; return lineAtPosition === nextTokenStartLine; } return false; } - function getZeroBasedStartLineAndCharacterForNode(n: Node, sourceFile: SourceFile): LineAndCharacter { - return sourceFile.getZeroBasedLineAndCharacterOfPosition(n.getStart(sourceFile)); + function getStartLineAndCharacterForNode(n: Node, sourceFile: SourceFile): LineAndCharacter { + return sourceFile.getLineAndCharacterOfPosition(n.getStart(sourceFile)); } function positionBelongsToNode(candidate: Node, position: number, sourceFile: SourceFile): boolean { @@ -216,7 +216,7 @@ module ts.formatting { var elseKeyword = findChildOfKind(parent, SyntaxKind.ElseKeyword, sourceFile); Debug.assert(elseKeyword !== undefined); - var elseKeywordStartLine = getZeroBasedStartLineAndCharacterForNode(elseKeyword, sourceFile).line; + var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line; return elseKeywordStartLine === childStartLine; } @@ -285,24 +285,24 @@ module ts.formatting { // walk toward the start of the list starting from current node and check if the line is the same for all items. // if end line for item [i - 1] differs from the start line for item [i] - find column of the first non-whitespace character on the line of item [i] - var lineAndCharacter = getZeroBasedStartLineAndCharacterForNode(node, sourceFile); + var lineAndCharacter = getStartLineAndCharacterForNode(node, sourceFile); for (var i = index - 1; i >= 0; --i) { if (list[i].kind === SyntaxKind.CommaToken) { continue; } // skip list items that ends on the same line with the current list element - var prevEndLine = sourceFile.getZeroBasedLineAndCharacterOfPosition(list[i].end).line; + var prevEndLine = sourceFile.getLineAndCharacterOfPosition(list[i].end).line; if (prevEndLine !== lineAndCharacter.line) { return findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter, sourceFile, options); } - lineAndCharacter = getZeroBasedStartLineAndCharacterForNode(list[i], sourceFile); + lineAndCharacter = getStartLineAndCharacterForNode(list[i], sourceFile); } return -1; } function findColumnForFirstNonWhitespaceCharacterInLine(lineAndCharacter: LineAndCharacter, sourceFile: SourceFile, options: EditorOptions): number { - var lineStart = sourceFile.getPositionOfZeroBasedLineAndCharacter(lineAndCharacter.line, 0); + var lineStart = sourceFile.getPositionOfLineAndCharacter(lineAndCharacter.line, 0); return findFirstNonWhitespaceColumn(lineStart, lineStart + lineAndCharacter.character, sourceFile, options); } diff --git a/src/services/services.ts b/src/services/services.ts index 7f1e52e4962..b286507fe3c 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -61,9 +61,9 @@ module ts { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getZeroBasedLineAndCharacterOfPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionOfZeroBasedLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } @@ -612,7 +612,7 @@ module ts { } if (paramHelpStringMargin === undefined) { - paramHelpStringMargin = sourceFile.getZeroBasedLineAndCharacterOfPosition(firstLineParamHelpStringPos).character; + paramHelpStringMargin = sourceFile.getLineAndCharacterOfPosition(firstLineParamHelpStringPos).character; } // Now consume white spaces max @@ -750,16 +750,16 @@ module ts { return updateSourceFile(this, newText, textChangeRange); } - public getZeroBasedLineAndCharacterOfPosition(position: number): LineAndCharacter { - return ts.getZeroBasedLineAndCharacterOfPosition(this, position); + public getLineAndCharacterOfPosition(position: number): LineAndCharacter { + return ts.getLineAndCharacterOfPosition(this, position); } public getLineStarts(): number[] { return getLineStarts(this); } - public getPositionOfZeroBasedLineAndCharacter(line: number, character: number): number { - return ts.getPositionOfZeroBasedLineAndCharacter(this, line, character); + public getPositionOfLineAndCharacter(line: number, character: number): number { + return ts.getPositionOfLineAndCharacter(this, line, character); } public getNamedDeclarations() { diff --git a/src/services/utilities.ts b/src/services/utilities.ts index 72fee5260a4..13156523045 100644 --- a/src/services/utilities.ts +++ b/src/services/utilities.ts @@ -33,7 +33,7 @@ module ts { export function getLineStartPositionForPosition(position: number, sourceFile: SourceFile): number { var lineStarts = sourceFile.getLineStarts(); - var line = sourceFile.getZeroBasedLineAndCharacterOfPosition(position).line; + var line = sourceFile.getLineAndCharacterOfPosition(position).line; return lineStarts[line]; } From a83534a72ce059e262db18ecedc7ff69beff7539 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 19:55:32 -0800 Subject: [PATCH 111/162] Fix up API samples. --- .../baselines/reference/APISample_compile.js | 20 ++++---- .../reference/APISample_compile.types | 42 ++++++++-------- tests/baselines/reference/APISample_linter.js | 20 ++++---- .../reference/APISample_linter.types | 38 ++++++++------- .../reference/APISample_transform.js | 16 +++---- .../reference/APISample_transform.types | 48 ++++++++++--------- .../baselines/reference/APISample_watcher.js | 20 ++++---- .../reference/APISample_watcher.types | 42 ++++++++-------- tests/cases/compiler/APISample_compile.ts | 4 +- tests/cases/compiler/APISample_linter.ts | 4 +- tests/cases/compiler/APISample_transform.ts | 2 +- tests/cases/compiler/APISample_watcher.ts | 4 +- 12 files changed, 134 insertions(+), 126 deletions(-) diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 83951d237a3..e43be49261b 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -21,8 +21,8 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); allDiagnostics.forEach(diagnostic => { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }); var exitCode = emitResult.emitSkipped ? 1 : 0; @@ -1384,14 +1384,14 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; - function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): { + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; character: number; }; - function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; function isWhiteSpace(ch: number): boolean; function isLineBreak(ch: number): boolean; function isOctalDigit(ch: number): boolean; @@ -1469,9 +1469,9 @@ declare module "typescript" { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -1946,8 +1946,8 @@ function compile(fileNames, options) { var emitResult = program.emit(); var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); allDiagnostics.forEach(function (diagnostic) { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(diagnostic.file.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(diagnostic.file.fileName + " (" + (lineChar.line + 1) + "," + (lineChar.character + 1) + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)); }); var exitCode = emitResult.emitSkipped ? 1 : 0; console.log("Process exiting with code '" + exitCode + "'."); diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 18b6f84c702..a6e0fe6fc45 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -56,27 +56,27 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void >diagnostics : ts.Diagnostic[] allDiagnostics.forEach(diagnostic => { ->allDiagnostics.forEach(diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }) : void +>allDiagnostics.forEach(diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }) : void >allDiagnostics.forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void >allDiagnostics : ts.Diagnostic[] >forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void ->diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); } : (diagnostic: ts.Diagnostic) => void +>diagnostic => { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); } : (diagnostic: ts.Diagnostic) => void >diagnostic : ts.Diagnostic - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); >lineChar : ts.LineAndCharacter ->diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start) : ts.LineAndCharacter ->diagnostic.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >diagnostic.file : ts.SourceFile >diagnostic : ts.Diagnostic >file : ts.SourceFile ->getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >diagnostic.start : number >diagnostic : ts.Diagnostic >start : number - console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); ->console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`) : any + console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); +>console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`) : any >console.log : any >console : any >log : any @@ -85,9 +85,11 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void >diagnostic : ts.Diagnostic >file : ts.SourceFile >fileName : string +>lineChar.line + 1 : number >lineChar.line : number >lineChar : ts.LineAndCharacter >line : number +>lineChar.character + 1 : number >lineChar.character : number >lineChar : ts.LineAndCharacter >character : number @@ -4368,15 +4370,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromOneBasedLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromOneBasedLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -4386,8 +4388,8 @@ declare module "typescript" { >sourceFile : SourceFile >SourceFile : SourceFile - function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): { ->computeOneBasedLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { +>computeLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } >lineStarts : number[] >position : number @@ -4398,8 +4400,8 @@ declare module "typescript" { >character : number }; - function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; ->getOneBasedLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter >sourceFile : SourceFile >SourceFile : SourceFile >position : number @@ -4735,16 +4737,16 @@ declare module "typescript" { >getNamedDeclarations : () => Declaration[] >Declaration : Declaration - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; ->getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter >pos : number >LineAndCharacter : LineAndCharacter getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; ->getPositionFromOneBasedLineAndCharacter : (line: number, character: number) => number + getPositionOfLineAndCharacter(line: number, character: number): number; +>getPositionOfLineAndCharacter : (line: number, character: number) => number >line : number >character : number diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 0b090bebd7f..be5b7e2235d 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -51,8 +51,8 @@ export function delint(sourceFile: ts.SourceFile) { } function report(node: ts.Node, message: string) { - var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); - console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) + var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); + console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) } } @@ -1415,14 +1415,14 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; - function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): { + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; character: number; }; - function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; function isWhiteSpace(ch: number): boolean; function isLineBreak(ch: number): boolean; function isOctalDigit(ch: number): boolean; @@ -1500,9 +1500,9 @@ declare module "typescript" { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -2003,8 +2003,8 @@ function delint(sourceFile) { ts.forEachChild(node, delintNode); } function report(node, message) { - var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); - console.log(sourceFile.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + message); + var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); + console.log(sourceFile.fileName + " (" + (lineChar.line + 1) + "," + (lineChar.character + 1) + "): " + message); } } exports.delint = delint; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 5e25227836b..3e834101f92 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -224,28 +224,30 @@ export function delint(sourceFile: ts.SourceFile) { >Node : ts.Node >message : string - var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); + var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); >lineChar : ts.LineAndCharacter ->sourceFile.getLineAndCharacterFromPosition(node.getStart()) : ts.LineAndCharacter ->sourceFile.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>sourceFile.getLineAndCharacterOfPosition(node.getStart()) : ts.LineAndCharacter +>sourceFile.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >sourceFile : ts.SourceFile ->getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >node.getStart() : number >node.getStart : (sourceFile?: ts.SourceFile) => number >node : ts.Node >getStart : (sourceFile?: ts.SourceFile) => number - console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) ->console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) : any + console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) +>console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) : any >console.log : any >console : any >log : any >sourceFile.fileName : string >sourceFile : ts.SourceFile >fileName : string +>lineChar.line + 1 : number >lineChar.line : number >lineChar : ts.LineAndCharacter >line : number +>lineChar.character + 1 : number >lineChar.character : number >lineChar : ts.LineAndCharacter >character : number @@ -4512,15 +4514,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromOneBasedLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromOneBasedLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -4530,8 +4532,8 @@ declare module "typescript" { >sourceFile : SourceFile >SourceFile : SourceFile - function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): { ->computeOneBasedLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { +>computeLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } >lineStarts : number[] >position : number @@ -4542,8 +4544,8 @@ declare module "typescript" { >character : number }; - function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; ->getOneBasedLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter >sourceFile : SourceFile >SourceFile : SourceFile >position : number @@ -4879,16 +4881,16 @@ declare module "typescript" { >getNamedDeclarations : () => Declaration[] >Declaration : Declaration - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; ->getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter >pos : number >LineAndCharacter : LineAndCharacter getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; ->getPositionFromOneBasedLineAndCharacter : (line: number, character: number) => number + getPositionOfLineAndCharacter(line: number, character: number): number; +>getPositionOfLineAndCharacter : (line: number, character: number) => number >line : number >character : number diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 4e933d72b3e..2fe2e46e4c6 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -54,7 +54,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { return { outputs: outputs, errors: errors.map(function (e) { - return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) }; @@ -1416,14 +1416,14 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; - function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): { + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; character: number; }; - function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; function isWhiteSpace(ch: number): boolean; function isLineBreak(ch: number): boolean; function isOctalDigit(ch: number): boolean; @@ -1501,9 +1501,9 @@ declare module "typescript" { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -2005,7 +2005,7 @@ function transform(contents, compilerOptions) { return { outputs: outputs, errors: errors.map(function (e) { - return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); + return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) }; } diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 5d39868e610..9b0d01d3959 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -177,7 +177,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { >diagnostics : ts.Diagnostic[] return { ->{ outputs: outputs, errors: errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) } : { outputs: any[]; errors: string[]; } +>{ outputs: outputs, errors: errors.map(function (e) { return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) } : { outputs: any[]; errors: string[]; } outputs: outputs, >outputs : any[] @@ -185,30 +185,32 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { errors: errors.map(function (e) { >errors : string[] ->errors.map(function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) : string[] +>errors.map(function (e) { return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) : string[] >errors.map : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => U, thisArg?: any) => U[] >errors : ts.Diagnostic[] >map : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => U, thisArg?: any) => U[] ->function (e) { return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); } : (e: ts.Diagnostic) => string +>function (e) { return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); } : (e: ts.Diagnostic) => string >e : ts.Diagnostic - return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " ->e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL) : string ->e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " : string ->e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line : string + return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " +>e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL) : string +>e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " : string +>e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) : string >e.file.fileName + "(" : string >e.file.fileName : string >e.file : ts.SourceFile >e : ts.Diagnostic >file : ts.SourceFile >fileName : string ->e.file.getLineAndCharacterFromPosition(e.start).line : number ->e.file.getLineAndCharacterFromPosition(e.start) : ts.LineAndCharacter ->e.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>(e.file.getLineAndCharacterOfPosition(e.start).line + 1) : number +>e.file.getLineAndCharacterOfPosition(e.start).line + 1 : number +>e.file.getLineAndCharacterOfPosition(e.start).line : number +>e.file.getLineAndCharacterOfPosition(e.start) : ts.LineAndCharacter +>e.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >e.file : ts.SourceFile >e : ts.Diagnostic >file : ts.SourceFile ->getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >e.start : number >e : ts.Diagnostic >start : number @@ -4464,15 +4466,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromOneBasedLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromOneBasedLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -4482,8 +4484,8 @@ declare module "typescript" { >sourceFile : SourceFile >SourceFile : SourceFile - function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): { ->computeOneBasedLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { +>computeLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } >lineStarts : number[] >position : number @@ -4494,8 +4496,8 @@ declare module "typescript" { >character : number }; - function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; ->getOneBasedLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter >sourceFile : SourceFile >SourceFile : SourceFile >position : number @@ -4831,16 +4833,16 @@ declare module "typescript" { >getNamedDeclarations : () => Declaration[] >Declaration : Declaration - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; ->getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter >pos : number >LineAndCharacter : LineAndCharacter getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; ->getPositionFromOneBasedLineAndCharacter : (line: number, character: number) => number + getPositionOfLineAndCharacter(line: number, character: number): number; +>getPositionOfLineAndCharacter : (line: number, character: number) => number >line : number >character : number diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 0ab43d3f64f..2f2a66ea329 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -87,8 +87,8 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); @@ -1453,14 +1453,14 @@ declare module "typescript" { } function tokenToString(t: SyntaxKind): string; function computeLineStarts(text: string): number[]; - function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; - function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number; + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; function getLineStarts(sourceFile: SourceFile): number[]; - function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): { + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { line: number; character: number; }; - function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; function isWhiteSpace(ch: number): boolean; function isLineBreak(ch: number): boolean; function isOctalDigit(ch: number): boolean; @@ -1538,9 +1538,9 @@ declare module "typescript" { scriptSnapshot: IScriptSnapshot; nameTable: Map; getNamedDeclarations(): Declaration[]; - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; getLineStarts(): number[]; - getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; + getPositionOfLineAndCharacter(line: number, character: number): number; update(newText: string, textChangeRange: TextChangeRange): SourceFile; } /** @@ -2065,8 +2065,8 @@ function watch(rootFileNames, options) { var allDiagnostics = services.getCompilerOptionsDiagnostics().concat(services.getSyntacticDiagnostics(fileName)).concat(services.getSemanticDiagnostics(fileName)); allDiagnostics.forEach(function (diagnostic) { if (diagnostic.file) { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(" Error " + diagnostic.file.fileName + " (" + lineChar.line + "," + lineChar.character + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(" Error " + diagnostic.file.fileName + " (" + (lineChar.line + 1) + "," + (lineChar.character + 1) + "): " + ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")); } else { console.log(" Error: " + diagnostic.messageText); diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 824ca033f2b..e42ab4c6bc5 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -317,11 +317,11 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { >fileName : string allDiagnostics.forEach(diagnostic => { ->allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } }) : void +>allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } }) : void >allDiagnostics.forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void >allDiagnostics : ts.Diagnostic[] >forEach : (callbackfn: (value: ts.Diagnostic, index: number, array: ts.Diagnostic[]) => void, thisArg?: any) => void ->diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } } : (diagnostic: ts.Diagnostic) => void +>diagnostic => { if (diagnostic.file) { var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); } } : (diagnostic: ts.Diagnostic) => void >diagnostic : ts.Diagnostic if (diagnostic.file) { @@ -329,20 +329,20 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { >diagnostic : ts.Diagnostic >file : ts.SourceFile - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); >lineChar : ts.LineAndCharacter ->diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start) : ts.LineAndCharacter ->diagnostic.file.getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start) : ts.LineAndCharacter +>diagnostic.file.getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >diagnostic.file : ts.SourceFile >diagnostic : ts.Diagnostic >file : ts.SourceFile ->getLineAndCharacterFromPosition : (pos: number) => ts.LineAndCharacter +>getLineAndCharacterOfPosition : (pos: number) => ts.LineAndCharacter >diagnostic.start : number >diagnostic : ts.Diagnostic >start : number - console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); ->console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`) : any + console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); +>console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`) : any >console.log : any >console : any >log : any @@ -351,9 +351,11 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { >diagnostic : ts.Diagnostic >file : ts.SourceFile >fileName : string +>lineChar.line + 1 : number >lineChar.line : number >lineChar : ts.LineAndCharacter >line : number +>lineChar.character + 1 : number >lineChar.character : number >lineChar : ts.LineAndCharacter >character : number @@ -4637,15 +4639,15 @@ declare module "typescript" { >computeLineStarts : (text: string) => number[] >text : string - function getPositionFromOneBasedLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; ->getPositionFromOneBasedLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number + function getPositionOfLineAndCharacter(sourceFile: SourceFile, line: number, character: number): number; +>getPositionOfLineAndCharacter : (sourceFile: SourceFile, line: number, character: number) => number >sourceFile : SourceFile >SourceFile : SourceFile >line : number >character : number - function computePositionFromOneBasedLineAndCharacter(lineStarts: number[], line: number, character: number): number; ->computePositionFromOneBasedLineAndCharacter : (lineStarts: number[], line: number, character: number) => number + function computePositionOfLineAndCharacter(lineStarts: number[], line: number, character: number): number; +>computePositionOfLineAndCharacter : (lineStarts: number[], line: number, character: number) => number >lineStarts : number[] >line : number >character : number @@ -4655,8 +4657,8 @@ declare module "typescript" { >sourceFile : SourceFile >SourceFile : SourceFile - function computeOneBasedLineAndCharacterOfPosition(lineStarts: number[], position: number): { ->computeOneBasedLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } + function computeLineAndCharacterOfPosition(lineStarts: number[], position: number): { +>computeLineAndCharacterOfPosition : (lineStarts: number[], position: number) => { line: number; character: number; } >lineStarts : number[] >position : number @@ -4667,8 +4669,8 @@ declare module "typescript" { >character : number }; - function getOneBasedLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; ->getOneBasedLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter + function getLineAndCharacterOfPosition(sourceFile: SourceFile, position: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (sourceFile: SourceFile, position: number) => LineAndCharacter >sourceFile : SourceFile >SourceFile : SourceFile >position : number @@ -5004,16 +5006,16 @@ declare module "typescript" { >getNamedDeclarations : () => Declaration[] >Declaration : Declaration - getLineAndCharacterFromPosition(pos: number): LineAndCharacter; ->getLineAndCharacterFromPosition : (pos: number) => LineAndCharacter + getLineAndCharacterOfPosition(pos: number): LineAndCharacter; +>getLineAndCharacterOfPosition : (pos: number) => LineAndCharacter >pos : number >LineAndCharacter : LineAndCharacter getLineStarts(): number[]; >getLineStarts : () => number[] - getPositionFromOneBasedLineAndCharacter(line: number, character: number): number; ->getPositionFromOneBasedLineAndCharacter : (line: number, character: number) => number + getPositionOfLineAndCharacter(line: number, character: number): number; +>getPositionOfLineAndCharacter : (line: number, character: number) => number >line : number >character : number diff --git a/tests/cases/compiler/APISample_compile.ts b/tests/cases/compiler/APISample_compile.ts index 50ec02ab6f3..f1703835380 100644 --- a/tests/cases/compiler/APISample_compile.ts +++ b/tests/cases/compiler/APISample_compile.ts @@ -21,8 +21,8 @@ export function compile(fileNames: string[], options: ts.CompilerOptions): void var allDiagnostics = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics); allDiagnostics.forEach(diagnostic => { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(`${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(`${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, os.EOL)}`); }); var exitCode = emitResult.emitSkipped ? 1 : 0; diff --git a/tests/cases/compiler/APISample_linter.ts b/tests/cases/compiler/APISample_linter.ts index c95d6273d4e..30c57b6e451 100644 --- a/tests/cases/compiler/APISample_linter.ts +++ b/tests/cases/compiler/APISample_linter.ts @@ -51,8 +51,8 @@ export function delint(sourceFile: ts.SourceFile) { } function report(node: ts.Node, message: string) { - var lineChar = sourceFile.getLineAndCharacterFromPosition(node.getStart()); - console.log(`${sourceFile.fileName} (${lineChar.line},${lineChar.character}): ${message}`) + var lineChar = sourceFile.getLineAndCharacterOfPosition(node.getStart()); + console.log(`${sourceFile.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${message}`) } } diff --git a/tests/cases/compiler/APISample_transform.ts b/tests/cases/compiler/APISample_transform.ts index e9d9a46d286..438b9520010 100644 --- a/tests/cases/compiler/APISample_transform.ts +++ b/tests/cases/compiler/APISample_transform.ts @@ -54,7 +54,7 @@ function transform(contents: string, compilerOptions: ts.CompilerOptions = {}) { return { outputs: outputs, errors: errors.map(function (e) { - return e.file.fileName + "(" + e.file.getLineAndCharacterFromPosition(e.start).line + "): " + return e.file.fileName + "(" + (e.file.getLineAndCharacterOfPosition(e.start).line + 1) + "): " + ts.flattenDiagnosticMessageText(e.messageText, os.EOL); }) }; diff --git a/tests/cases/compiler/APISample_watcher.ts b/tests/cases/compiler/APISample_watcher.ts index 212f83b3935..3b1c83419bf 100644 --- a/tests/cases/compiler/APISample_watcher.ts +++ b/tests/cases/compiler/APISample_watcher.ts @@ -87,8 +87,8 @@ function watch(rootFileNames: string[], options: ts.CompilerOptions) { allDiagnostics.forEach(diagnostic => { if (diagnostic.file) { - var lineChar = diagnostic.file.getLineAndCharacterFromPosition(diagnostic.start); - console.log(` Error ${diagnostic.file.fileName} (${lineChar.line},${lineChar.character}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); + var lineChar = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start); + console.log(` Error ${diagnostic.file.fileName} (${lineChar.line + 1},${lineChar.character + 1}): ${ts.flattenDiagnosticMessageText(diagnostic.messageText, "\n")}`); } else { console.log(` Error: ${diagnostic.messageText}`); From cdc1b90e42226428c9d6134799c281a50876ab5d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 16 Feb 2015 20:10:07 -0800 Subject: [PATCH 112/162] Fix function name. --- src/compiler/emitter.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 6fafe9c65fb..b847e0a06bb 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -133,14 +133,14 @@ module ts { }; } - function getBasedLineOfLocalPosition(currentSourceFile: SourceFile, pos: number) { + function getLineOfLocalPosition(currentSourceFile: SourceFile, pos: number) { return getLineAndCharacterOfPosition(currentSourceFile, pos).line; } function emitNewLineBeforeLeadingComments(currentSourceFile: SourceFile, writer: EmitTextWriter, node: TextRange, leadingComments: CommentRange[]) { // If the leading comments start on different line than the start of node, write new line if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && - getBasedLineOfLocalPosition(currentSourceFile, node.pos) !== getBasedLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { + getLineOfLocalPosition(currentSourceFile, node.pos) !== getLineOfLocalPosition(currentSourceFile, leadingComments[0].pos)) { writer.writeLine(); } } @@ -2979,13 +2979,13 @@ module ts { } function isOnSameLine(node1: Node, node2: Node) { - return getBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node1.pos)) === - getBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node1.pos)) === + getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); } function nodeEndIsOnSameLineAsNodeStart(node1: Node, node2: Node) { - return getBasedLineOfLocalPosition(currentSourceFile, node1.end) === - getBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); + return getLineOfLocalPosition(currentSourceFile, node1.end) === + getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node2.pos)); } function emitCaseOrDefaultClause(node: CaseOrDefaultClause) { @@ -4476,8 +4476,8 @@ module ts { forEach(leadingComments, comment => { if (lastComment) { - var lastCommentLine = getBasedLineOfLocalPosition(currentSourceFile, lastComment.end); - var commentLine = getBasedLineOfLocalPosition(currentSourceFile, comment.pos); + var lastCommentLine = getLineOfLocalPosition(currentSourceFile, lastComment.end); + var commentLine = getLineOfLocalPosition(currentSourceFile, comment.pos); if (commentLine >= lastCommentLine + 2) { // There was a blank line between the last comment and this comment. This @@ -4495,8 +4495,8 @@ module ts { // All comments look like they could have been part of the copyright header. Make // sure there is at least one blank line between it and the node. If not, it's not // a copyright header. - var lastCommentLine = getBasedLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); - var nodeLine = getBasedLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); + var lastCommentLine = getLineOfLocalPosition(currentSourceFile, detachedComments[detachedComments.length - 1].end); + var nodeLine = getLineOfLocalPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); if (nodeLine >= lastCommentLine + 2) { // Valid detachedComments emitNewLineBeforeLeadingComments(currentSourceFile, writer, node, leadingComments); From d2712dd793db7032b11e5ef71c1f4a4ee06131b2 Mon Sep 17 00:00:00 2001 From: steveluc Date: Mon, 16 Feb 2015 23:43:05 -0800 Subject: [PATCH 113/162] Removed file mapping compression technique due to brittleness of approach. As necessary, will substitute grouping or paging approaches. --- src/server/client.ts | 24 ++++-------------------- src/server/protocol.d.ts | 40 ++++------------------------------------ src/server/session.ts | 30 +++++++----------------------- 3 files changed, 15 insertions(+), 79 deletions(-) diff --git a/src/server/client.ts b/src/server/client.ts index 22b346aa3ec..a3b32be31ed 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -69,22 +69,6 @@ module ts.server { }; } - private decodeEncodedFileId(fileId: ts.server.protocol.EncodedFile): string { - var fileName: string; - if (typeof fileId === "object") { - fileName = (fileId).file; - this.fileMapping[(fileId).id] = fileName; - } - else if (typeof fileId === "number") { - fileName = ts.lookUp(this.fileMapping, fileId.toString()); - Debug.assert(!!fileName, "Did not find filename in previous fileID mappings."); - } - else { - Debug.fail("Got unexpedted fileId type."); - } - return fileName; - } - private processRequest(command: string, arguments?: any): T { var request: ts.server.protocol.Request = { seq: this.sequence++, @@ -232,7 +216,7 @@ module ts.server { var response = this.processResponse(request); return response.body.map(entry => { - var fileName = this.decodeEncodedFileId(entry.file); + var fileName = entry.file; var start = this.lineColToPosition(fileName, entry.start); var end = this.lineColToPosition(fileName, entry.end); @@ -299,7 +283,7 @@ module ts.server { var response = this.processResponse(request); return response.body.map(entry => { - var fileName = this.decodeEncodedFileId(entry.file); + var fileName = entry.file; var start = this.lineColToPosition(fileName, entry.start); var end = this.lineColToPosition(fileName, entry.end); return { @@ -325,7 +309,7 @@ module ts.server { var response = this.processResponse(request); return response.body.refs.map(entry => { - var fileName = this.decodeEncodedFileId(entry.file); + var fileName = entry.file; var start = this.lineColToPosition(fileName, entry.start); var end = this.lineColToPosition(fileName, entry.end); return { @@ -378,7 +362,7 @@ module ts.server { findInStrings: findInStrings, findInComments: findInComments, locations: response.body.locs.map((entry) => { - var fileName = this.decodeEncodedFileId(entry.file); + var fileName = entry.file; var start = this.lineColToPosition(fileName, entry.start); var end = this.lineColToPosition(fileName, entry.end); return { diff --git a/src/server/protocol.d.ts b/src/server/protocol.d.ts index e3433e24690..06974b58cb3 100644 --- a/src/server/protocol.d.ts +++ b/src/server/protocol.d.ts @@ -153,11 +153,9 @@ declare module ts.server.protocol { */ export interface CodeSpan extends TextSpan { /** - * File containing the definition; the value of this - * field will always be a string, number of a mapping between - * a string and a number. + * File containing text span. */ - file: EncodedFile; + file: string; } /** @@ -675,11 +673,9 @@ declare module ts.server.protocol { kindModifiers?: string; /** - * The file in which the symbol is found; the value of this - * field will always be a string, number of a mapping between - * a string and a number. + * The file in which the symbol is found. */ - file: EncodedFile; + file: string; /** * The location within file at which the symbol is found. @@ -736,34 +732,6 @@ declare module ts.server.protocol { arguments: ChangeRequestArgs; } - /** - * If an object of this type is returned in place of a string as - * the value of a file field in a response message, add the - * mapping id => file to the client's cache of file id mappings, - * and interpret the value as if it was the string in the 'file' - * field. - */ - export interface IdFile { - /** - * Id to assign to file. - */ - id: number; - - /** - * File name that will correspond to id. - */ - file: string; - } - - /** - * The type of an encoded file name. If of type number, the value - * is a file id. If of type IdFile, the value is interpreted as - * 'file' and in addition the mapping 'id' to 'file' is - * established. If of type string, the value is simply the file - * name. - */ - export type EncodedFile = number | IdFile | string; - /** * Response to "brace" request. */ diff --git a/src/server/session.ts b/src/server/session.ts index e88932dcb77..812d2fc6c15 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -5,10 +5,6 @@ /// module ts.server { - var paddedLength = 8; - - var typeNames = ["interface", "class", "enum", "module", "alias", "type"]; - var spaceCache = [" ", " ", " ", " "]; interface StackTraceError extends Error { @@ -27,7 +23,7 @@ module ts.server { } interface FileStart { - file: ts.server.protocol.EncodedFile; + file: string; start: ILineInfo; } @@ -204,18 +200,6 @@ module ts.server { this.send(res); } - encodeFileName(fileName: string): ts.server.protocol.EncodedFile { - var id = ts.lookUp(this.fileHash, fileName); - if (!id) { - id = this.nextFileId++; - this.fileHash[fileName] = id; - return { id: id, file: fileName }; - } - else { - return id; - } - } - output(body: any, commandName: string, requestSequence = 0, errorMessage?: string) { this.response(body, commandName, requestSequence, errorMessage); } @@ -224,7 +208,7 @@ module ts.server { var diags = project.compilerService.languageService.getSemanticDiagnostics(file); if (diags) { var bakedDiags = diags.map((diag) => formatDiag(file, project, diag)); - this.event({ file: this.encodeFileName(file), diagnostics: bakedDiags }, "semanticDiag"); + this.event({ file: file, diagnostics: bakedDiags }, "semanticDiag"); } } @@ -232,7 +216,7 @@ module ts.server { var diags = project.compilerService.languageService.getSyntacticDiagnostics(file); if (diags) { var bakedDiags = diags.map((diag) => formatDiag(file, project, diag)); - this.event({ file: this.encodeFileName(file), diagnostics: bakedDiags }, "syntaxDiag"); + this.event({ file: file, diagnostics: bakedDiags }, "syntaxDiag"); } } @@ -293,7 +277,7 @@ module ts.server { } return definitions.map(def => ({ - file: this.encodeFileName(def.fileName), + file: def.fileName, start: compilerService.host.positionToLineCol(def.fileName, def.textSpan.start), end: compilerService.host.positionToLineCol(def.fileName, ts.textSpanEnd(def.textSpan)) })); @@ -326,7 +310,7 @@ module ts.server { } var bakedRenameLocs = renameLocations.map(location => ({ - file: this.encodeFileName(location.fileName), + file: location.fileName, start: compilerService.host.positionToLineCol(location.fileName, location.textSpan.start), end: compilerService.host.positionToLineCol(location.fileName, ts.textSpanEnd(location.textSpan)), })); @@ -366,7 +350,7 @@ module ts.server { var snap = compilerService.host.getScriptSnapshot(ref.fileName); var lineText = snap.getText(refLineSpan.start, ts.textSpanEnd(refLineSpan)).replace(/\r|\n/g, ""); return { - file: this.encodeFileName(ref.fileName), + file: ref.fileName, start: start, lineText: lineText, end: compilerService.host.positionToLineCol(ref.fileName, ts.textSpanEnd(ref.textSpan)), @@ -633,7 +617,7 @@ module ts.server { var bakedItem: ts.server.protocol.NavtoItem = { name: navItem.name, kind: navItem.kind, - file: this.encodeFileName(navItem.fileName), + file: navItem.fileName, start: start, end: end, }; From cadd57c10fe8036661427c9bf4fa1c22c85658c3 Mon Sep 17 00:00:00 2001 From: steveluc Date: Tue, 17 Feb 2015 02:02:59 -0800 Subject: [PATCH 114/162] Change rename response to return the rename info + nested location information: one array of location information per file. Add interface definition for rename response body. --- src/server/client.ts | 23 ++++++++++-------- src/server/protocol.d.ts | 36 ++++++++++++++++++---------- src/server/session.ts | 51 +++++++++++++++++++++++++++++----------- 3 files changed, 74 insertions(+), 36 deletions(-) diff --git a/src/server/client.ts b/src/server/client.ts index a3b32be31ed..e12a9fecd3e 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -348,7 +348,18 @@ module ts.server { var request = this.processRequest(CommandNames.Rename, args); var response = this.processResponse(request); - + var locations: RenameLocation[] = []; + response.body.locs.map((entry: ts.server.protocol.SpanGroup) => { + var fileName = entry.file; + entry.locs.map((loc: ts.server.protocol.TextSpan) => { + var start = this.lineColToPosition(fileName, loc.start); + var end = this.lineColToPosition(fileName, loc.end); + locations.push({ + textSpan: ts.createTextSpanFromBounds(start, end), + fileName: fileName + }); + }); + }); return this.lastRenameEntry = { canRename: response.body.info.canRename, displayName: response.body.info.displayName, @@ -361,15 +372,7 @@ module ts.server { position: position, findInStrings: findInStrings, findInComments: findInComments, - locations: response.body.locs.map((entry) => { - var fileName = entry.file; - var start = this.lineColToPosition(fileName, entry.start); - var end = this.lineColToPosition(fileName, entry.end); - return { - textSpan: ts.createTextSpanFromBounds(start, end), - fileName: fileName - }; - }) + locations: locations }; } diff --git a/src/server/protocol.d.ts b/src/server/protocol.d.ts index 06974b58cb3..3fdded3aa6a 100644 --- a/src/server/protocol.d.ts +++ b/src/server/protocol.d.ts @@ -247,7 +247,7 @@ declare module ts.server.protocol { /** * Error message if item can not be renamed. */ - localizedErrorMessage: string; + localizedErrorMessage?: string; /** * Display name of the item to be renamed. @@ -270,21 +270,33 @@ declare module ts.server.protocol { kindModifiers: string; } + /** + * A group of text spans, all in 'file'. + */ + export interface SpanGroup { + /** The file to which the spans apply */ + file: string; + /** The text spans in this group */ + locs: TextSpan[]; + } + + export interface RenameResponseBody { + /** + * Information about the item to be renamed. + */ + info: RenameInfo; + + /** + * An array of span groups (one per file) that refer to the item to be renamed. + */ + locs: SpanGroup[]; + } + /** * Rename response message. */ export interface RenameResponse extends Response { - body?: { - /** - * Information about the item to be renamed. - */ - info: RenameInfo; - - /** - * An array of code locations that refer to the item to be renamed. - */ - locs: CodeSpan[]; - } + body?: RenameResponseBody; } /** diff --git a/src/server/session.ts b/src/server/session.ts index 812d2fc6c15..67811c76412 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -18,7 +18,7 @@ module ts.server { strBuilder += " "; } spaceCache[n] = strBuilder; - } + } return spaceCache[n]; } @@ -54,6 +54,7 @@ module ts.server { } function sortNavItems(items: ts.NavigateToItem[]) { + return items.sort((a, b) => { if (a.matchKind < b.matchKind) { return -1; @@ -77,17 +78,6 @@ module ts.server { }) } - interface FileRange { - file?: string; - start: ILineInfo; - end: ILineInfo; - } - - interface FileRanges { - file: string; - locs: FileRange[]; - } - function formatDiag(fileName: string, project: Project, diag: ts.Diagnostic) { return { start: project.compilerService.host.positionToLineCol(fileName, diag.start), @@ -283,7 +273,7 @@ module ts.server { })); } - getRenameLocations(line: number, col: number, fileName: string, findInComments: boolean, findInStrings: boolean): { info: RenameInfo; locs: ts.server.protocol.CodeSpan[] } { + getRenameLocations(line: number, col: number, fileName: string,findInComments: boolean, findInStrings: boolean): ts.server.protocol.RenameResponseBody { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -313,7 +303,40 @@ module ts.server { file: location.fileName, start: compilerService.host.positionToLineCol(location.fileName, location.textSpan.start), end: compilerService.host.positionToLineCol(location.fileName, ts.textSpanEnd(location.textSpan)), - })); + })).sort((a, b) => { + if (a.file < b.file) { + return -1; + } + else if (a.file > b.file) { + return 1; + } + else { + // reverse sort assuming no overlap + if (a.start.line < b.start.line) { + return 1; + } + else if (a.start.line > b.start.line) { + return -1; + } + else { + return b.start.col - a.start.col; + } + } + }).reduce((accum: ts.server.protocol.SpanGroup[], cur: ts.server.protocol.CodeSpan) => { + var curFileAccum: ts.server.protocol.SpanGroup; + if (accum.length > 0) { + curFileAccum = accum[accum.length - 1]; + if (curFileAccum.file != cur.file) { + curFileAccum = undefined; + } + } + if (!curFileAccum) { + curFileAccum = { file: cur.file, locs: [] }; + accum.push(curFileAccum); + } + curFileAccum.locs.push({ start: cur.start, end: cur.end }); + return accum; + }, []); return { info: renameInfo, locs: bakedRenameLocs }; } From 975f10c6a1bff1c1b71e8cac52ea81b4814615c0 Mon Sep 17 00:00:00 2001 From: Jason Ramsay Date: Tue, 17 Feb 2015 14:44:45 -0800 Subject: [PATCH 115/162] Adding getCanonicalFileName to ensure case-sensitive systems do not have issues --- src/services/services.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/services.ts b/src/services/services.ts index 94ad9d60b6c..a69a3b4154c 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -5522,7 +5522,7 @@ module ts { if (defaultLibFileName) { for (var i = 0; i < declarations.length; i++) { var sourceFile = declarations[i].getSourceFile(); - if (sourceFile && ts.normalizePath(sourceFile.fileName) === ts.normalizePath(defaultLibFileName)) { + if (sourceFile && getCanonicalFileName(ts.normalizePath(sourceFile.fileName)) === getCanonicalFileName(ts.normalizePath(defaultLibFileName))) { return getRenameInfoError(getLocaleSpecificMessage(Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library.key)); } } From 3868fb5a6b26ab132a20edb85665d0c422eed0c2 Mon Sep 17 00:00:00 2001 From: steveluc Date: Wed, 18 Feb 2015 00:14:52 -0800 Subject: [PATCH 116/162] Removed deleteLen from change request; added endLine, endCol that mark the end of the deleted Range (inclusive). DeleteLen was not always accurate because editors normalize \r\n to \n in some cases, affecting the length of ranges. In Diagnostic response items, changed len field to end to address the same range length issue. Flattened MessageDiagnosticChains in diagnostic message text, since clients expect string there. Renamed ts.server.protocol to simply protocol in session.ts and client.ts since module name prefix is clear. Based on protocol feedback: Changed LineCol to Location. Changed CodeLocation interface name prefix to FileLocation. Changed DiagEvent to DiagnosticEvent. Removed anonymous types. --- src/server/client.ts | 92 +++++++++++++++-------------- src/server/protocol.d.ts | 124 +++++++++++++++++++-------------------- src/server/session.ts | 95 +++++++++++++++--------------- 3 files changed, 153 insertions(+), 158 deletions(-) diff --git a/src/server/client.ts b/src/server/client.ts index e12a9fecd3e..d51777c2e99 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -47,11 +47,11 @@ module ts.server { return lineMap; } - private lineColToPosition(fileName: string, lineCol: ts.server.protocol.LineCol): number { + private lineColToPosition(fileName: string, lineCol: protocol.Location): number { return ts.computePositionFromLineAndCharacter(this.getLineMap(fileName), lineCol.line, lineCol.col); } - private positionToOneBasedLineCol(fileName: string, position: number): ts.server.protocol.LineCol { + private positionToOneBasedLineCol(fileName: string, position: number): protocol.Location { var lineCol = ts.computeLineAndCharacterOfPosition(this.getLineMap(fileName), position); return { line: lineCol.line, @@ -59,7 +59,7 @@ module ts.server { }; } - private convertCodeEditsToTextChange(fileName: string, codeEdit: ts.server.protocol.CodeEdit): ts.TextChange { + private convertCodeEditsToTextChange(fileName: string, codeEdit: protocol.CodeEdit): ts.TextChange { var start = this.lineColToPosition(fileName, codeEdit.start); var end = this.lineColToPosition(fileName, codeEdit.end); @@ -69,8 +69,8 @@ module ts.server { }; } - private processRequest(command: string, arguments?: any): T { - var request: ts.server.protocol.Request = { + private processRequest(command: string, arguments?: any): T { + var request: protocol.Request = { seq: this.sequence++, type: "request", command: command, @@ -82,7 +82,7 @@ module ts.server { return request; } - private processResponse(request: ts.server.protocol.Request): T { + private processResponse(request: protocol.Request): T { var lastMessage = this.messages.shift(); Debug.assert(!!lastMessage, "Did not recieve any responses."); @@ -122,12 +122,12 @@ module ts.server { } openFile(fileName: string): void { - var args: ts.server.protocol.FileRequestArgs = { file: fileName }; + var args: protocol.FileRequestArgs = { file: fileName }; this.processRequest(CommandNames.Open, args); } closeFile(fileName: string): void { - var args: ts.server.protocol.FileRequestArgs = { file: fileName }; + var args: protocol.FileRequestArgs = { file: fileName }; this.processRequest(CommandNames.Close, args); } @@ -136,12 +136,14 @@ module ts.server { this.lineMaps[fileName] = undefined; var lineCol = this.positionToOneBasedLineCol(fileName, start); - var args: ts.server.protocol.ChangeRequestArgs = { + var endLineCol = this.positionToOneBasedLineCol(fileName, end); + + var args: protocol.ChangeRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, - insertLen: end - start, - deleteLen: end - start, + endLine: endLineCol.line, + endCol: endLineCol.col, insertString: newText }; @@ -150,14 +152,14 @@ module ts.server { getQuickInfoAtPosition(fileName: string, position: number): QuickInfo { var lineCol = this.positionToOneBasedLineCol(fileName, position); - var args: ts.server.protocol.CodeLocationRequestArgs = { + var args: protocol.FileLocationRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col }; - var request = this.processRequest(CommandNames.Quickinfo, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.Quickinfo, args); + var response = this.processResponse(request); var start = this.lineColToPosition(fileName, response.body.start); var end = this.lineColToPosition(fileName, response.body.end); @@ -173,15 +175,15 @@ module ts.server { getCompletionsAtPosition(fileName: string, position: number): CompletionInfo { var lineCol = this.positionToOneBasedLineCol(fileName, position); - var args: ts.server.protocol.CompletionsRequestArgs = { + var args: protocol.CompletionsRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, prefix: undefined }; - var request = this.processRequest(CommandNames.Completions, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.Completions, args); + var response = this.processResponse(request); return this.lastCompletionEntry = { isMemberCompletion: false, @@ -207,13 +209,13 @@ module ts.server { } getNavigateToItems(searchTerm: string): NavigateToItem[] { - var args: ts.server.protocol.NavtoRequestArgs = { + var args: protocol.NavtoRequestArgs = { searchTerm, file: this.host.getScriptFileNames()[0] }; - var request = this.processRequest(CommandNames.Navto, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.Navto, args); + var response = this.processResponse(request); return response.body.map(entry => { var fileName = entry.file; @@ -236,7 +238,7 @@ module ts.server { getFormattingEditsForRange(fileName: string, start: number, end: number, options: ts.FormatCodeOptions): ts.TextChange[] { var startLineCol = this.positionToOneBasedLineCol(fileName, start); var endLineCol = this.positionToOneBasedLineCol(fileName, end); - var args: ts.server.protocol.FormatRequestArgs = { + var args: protocol.FormatRequestArgs = { file: fileName, line: startLineCol.line, col: startLineCol.col, @@ -245,8 +247,8 @@ module ts.server { }; // TODO: handle FormatCodeOptions - var request = this.processRequest(CommandNames.Format, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.Format, args); + var response = this.processResponse(request); return response.body.map(entry=> this.convertCodeEditsToTextChange(fileName, entry)); } @@ -257,7 +259,7 @@ module ts.server { getFormattingEditsAfterKeystroke(fileName: string, position: number, key: string, options: FormatCodeOptions): ts.TextChange[] { var lineCol = this.positionToOneBasedLineCol(fileName, position); - var args: ts.server.protocol.FormatOnKeyRequestArgs = { + var args: protocol.FormatOnKeyRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, @@ -265,22 +267,22 @@ module ts.server { }; // TODO: handle FormatCodeOptions - var request = this.processRequest(CommandNames.Formatonkey, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.Formatonkey, args); + var response = this.processResponse(request); return response.body.map(entry=> this.convertCodeEditsToTextChange(fileName, entry)); } getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[] { var lineCol = this.positionToOneBasedLineCol(fileName, position); - var args: ts.server.protocol.CodeLocationRequestArgs = { + var args: protocol.FileLocationRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, }; - var request = this.processRequest(CommandNames.Definition, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.Definition, args); + var response = this.processResponse(request); return response.body.map(entry => { var fileName = entry.file; @@ -299,14 +301,14 @@ module ts.server { getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[] { var lineCol = this.positionToOneBasedLineCol(fileName, position); - var args: ts.server.protocol.CodeLocationRequestArgs = { + var args: protocol.FileLocationRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, }; - var request = this.processRequest(CommandNames.References, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.References, args); + var response = this.processResponse(request); return response.body.refs.map(entry => { var fileName = entry.file; @@ -338,7 +340,7 @@ module ts.server { getRenameInfo(fileName: string, position: number, findInStrings?: boolean, findInComments?: boolean): RenameInfo { var lineCol = this.positionToOneBasedLineCol(fileName, position); - var args: ts.server.protocol.RenameRequestArgs = { + var args: protocol.RenameRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, @@ -346,12 +348,12 @@ module ts.server { findInComments }; - var request = this.processRequest(CommandNames.Rename, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.Rename, args); + var response = this.processResponse(request); var locations: RenameLocation[] = []; - response.body.locs.map((entry: ts.server.protocol.SpanGroup) => { + response.body.locs.map((entry: protocol.SpanGroup) => { var fileName = entry.file; - entry.locs.map((loc: ts.server.protocol.TextSpan) => { + entry.locs.map((loc: protocol.TextSpan) => { var start = this.lineColToPosition(fileName, loc.start); var end = this.lineColToPosition(fileName, loc.end); locations.push({ @@ -388,7 +390,7 @@ module ts.server { return this.lastRenameEntry.locations; } - decodeNavigationBarItems(items: ts.server.protocol.NavigationBarItem[], fileName: string): NavigationBarItem[] { + decodeNavigationBarItems(items: protocol.NavigationBarItem[], fileName: string): NavigationBarItem[] { if (!items) { return []; } @@ -406,12 +408,12 @@ module ts.server { } getNavigationBarItems(fileName: string): NavigationBarItem[] { - var args: ts.server.protocol.FileRequestArgs = { + var args: protocol.FileRequestArgs = { file: fileName }; - var request = this.processRequest(CommandNames.NavBar, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.NavBar, args); + var response = this.processResponse(request); return this.decodeNavigationBarItems(response.body, fileName); } @@ -437,19 +439,19 @@ module ts.server { } getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[] { - throw new Error("Not Implemented Yet."); + throw new Error("Not Implemented Yet."); } getBraceMatchingAtPosition(fileName: string, position: number): TextSpan[] { var lineCol = this.positionToOneBasedLineCol(fileName, position); - var args: ts.server.protocol.CodeLocationRequestArgs = { + var args: protocol.FileLocationRequestArgs = { file: fileName, line: lineCol.line, col: lineCol.col, }; - var request = this.processRequest(CommandNames.Brace, args); - var response = this.processResponse(request); + var request = this.processRequest(CommandNames.Brace, args); + var response = this.processResponse(request); return response.body.map(entry => { var start = this.lineColToPosition(fileName, entry.start); diff --git a/src/server/protocol.d.ts b/src/server/protocol.d.ts index 3fdded3aa6a..a446f0176ae 100644 --- a/src/server/protocol.d.ts +++ b/src/server/protocol.d.ts @@ -95,10 +95,10 @@ declare module ts.server.protocol { } /** - * Instances of this interface specify a code location: + * Instances of this interface specify a location in a source file: * (file, line, col), where line and column are 1-based. */ - export interface CodeLocationRequestArgs extends FileRequestArgs { + export interface FileLocationRequestArgs extends FileRequestArgs { /** * The line number for the request (1-based). */ @@ -111,24 +111,24 @@ declare module ts.server.protocol { } /** - * A request whose arguments specify a code location (file, line, col). + * A request whose arguments specify a file location (file, line, col). */ - export interface CodeLocationRequest extends FileRequest { - arguments: CodeLocationRequestArgs; + export interface FileLocationRequest extends FileRequest { + arguments: FileLocationRequestArgs; } /** * Go to definition request; value of command field is - * "definition". Return response giving the code locations that + * "definition". Return response giving the file locations that * define the symbol found in file at location line, col. */ - export interface DefinitionRequest extends CodeLocationRequest { + export interface DefinitionRequest extends FileLocationRequest { } /** - * Object containing line and column (one-based) of code location. + * Location in source code expressed as (one-based) line and column. */ - export interface LineCol { + export interface Location { line: number; col: number; } @@ -140,18 +140,18 @@ declare module ts.server.protocol { /** * First character of the definition. */ - start: LineCol; + start: Location; /** * One character past last character of the definition. */ - end: LineCol; + end: Location; } /** * Object found in response messages defining a span of text in a specific source file. */ - export interface CodeSpan extends TextSpan { + export interface FileSpan extends TextSpan { /** * File containing text span. */ @@ -162,18 +162,18 @@ declare module ts.server.protocol { * Definition response message. Gives text range for definition. */ export interface DefinitionResponse extends Response { - body?: CodeSpan[]; + body?: FileSpan[]; } /** * Find references request; value of command field is - * "references". Return response giving the code locations that + * "references". Return response giving the file locations that * reference the symbol found in file at location line, col. */ - export interface ReferencesRequest extends CodeLocationRequest { + export interface ReferencesRequest extends FileLocationRequest { } - export interface ReferencesResponseItem extends CodeSpan { + export interface ReferencesResponseItem extends FileSpan { /** Text of line containing the reference. Including this * with the response avoids latency of editor loading files * to show text of reference line (the server already has @@ -192,7 +192,7 @@ declare module ts.server.protocol { */ export interface ReferencesResponseBody { /** - * The code locations referencing the symbol. + * The file locations referencing the symbol. */ refs: ReferencesResponseItem[]; @@ -219,7 +219,7 @@ declare module ts.server.protocol { body?: ReferencesResponseBody; } - export interface RenameRequestArgs extends CodeLocationRequestArgs { + export interface RenameRequestArgs extends FileLocationRequestArgs { findInComments?: boolean; findInStrings?: boolean; } @@ -227,11 +227,11 @@ declare module ts.server.protocol { /** * Rename request; value of command field is "rename". Return - * response giving the code locations that reference the symbol + * response giving the file locations that reference the symbol * found in file at location line, col. Also return full display * name of the symbol so that client can print it unambiguously. */ - export interface RenameRequest extends CodeLocationRequest { + export interface RenameRequest extends FileLocationRequest { arguments: RenameRequestArgs; } @@ -326,7 +326,7 @@ declare module ts.server.protocol { * documentation string for the symbol found in file at location * line, col. */ - export interface QuickInfoRequest extends CodeLocationRequest { + export interface QuickInfoRequest extends FileLocationRequest { } /** @@ -344,14 +344,14 @@ declare module ts.server.protocol { kindModifiers: string; /** - * Starting code location of symbol. + * Starting file location of symbol. */ - start: LineCol; + start: Location; /** * One past last character of symbol. */ - end: LineCol; + end: Location; /** * Type and kind of symbol. @@ -374,7 +374,7 @@ declare module ts.server.protocol { /** * Arguments for format messages. */ - export interface FormatRequestArgs extends CodeLocationRequestArgs { + export interface FormatRequestArgs extends FileLocationRequestArgs { /** * Last line of range for which to format text in file. */ @@ -393,7 +393,7 @@ declare module ts.server.protocol { * instructions in reverse to file will result in correctly * reformatted text. */ - export interface FormatRequest extends CodeLocationRequest { + export interface FormatRequest extends FileLocationRequest { arguments: FormatRequestArgs; } @@ -408,12 +408,12 @@ declare module ts.server.protocol { /** * First character of the text span to edit. */ - start: LineCol; + start: Location; /** * One character past last character of the text span to edit. */ - end: LineCol; + end: Location; /** * Replace the span defined above with this string (may be @@ -432,7 +432,7 @@ declare module ts.server.protocol { /** * Arguments for format on key messages. */ - export interface FormatOnKeyRequestArgs extends CodeLocationRequestArgs { + export interface FormatOnKeyRequestArgs extends FileLocationRequestArgs { /** * Key pressed (';', '\n', or '}'). */ @@ -447,14 +447,14 @@ declare module ts.server.protocol { * edit instructions in reverse to file will result in correctly * reformatted text. */ - export interface FormatOnKeyRequest extends CodeLocationRequest { + export interface FormatOnKeyRequest extends FileLocationRequest { arguments: FormatOnKeyRequestArgs; } /** * Arguments for completions messages. */ - export interface CompletionsRequestArgs extends CodeLocationRequestArgs { + export interface CompletionsRequestArgs extends FileLocationRequestArgs { /** * Optional prefix to apply to possible completions. */ @@ -467,7 +467,7 @@ declare module ts.server.protocol { * be the empty string), return the possible completions that * begin with prefix. */ - export interface CompletionsRequest extends CodeLocationRequest { + export interface CompletionsRequest extends FileLocationRequest { arguments: CompletionsRequestArgs; } @@ -552,18 +552,18 @@ declare module ts.server.protocol { } /** - * Item of diagnostic information found in a DiagEvent message. + * Item of diagnostic information found in a DiagnosticEvent message. */ export interface Diagnostic { /** - * Starting code location at which text appies. + * Starting file location at which text appies. */ - start: LineCol; + start: Location; /** - * Length of code location at which text applies. + * The last file location at which the text applies. */ - len: number; + end: Location; /** * Text of diagnostic message. @@ -571,24 +571,26 @@ declare module ts.server.protocol { text: string; } + export interface DiagnosticEventBody { + /** + * The file for which diagnostic information is reported. + */ + file: string; + + /** + * An array of diagnostic information items. + */ + diagnostics: Diagnostic[]; + } + /** * Event message for "syntaxDiag" and "semanticDiag" event types. * These events provide syntactic and semantic errors for a file. */ - export interface DiagEvent extends Event { - body?: { - /** - * The file for which diagnostic information is reported. - */ - file: string; - - /** - * An array of diagnostic information items. - */ - diagnostics: Diagnostic[]; - }; + export interface DiagnosticEvent extends Event { + body?: DiagnosticEventBody; } - + /** * Arguments for reload request. */ @@ -652,7 +654,7 @@ declare module ts.server.protocol { /** * Navto request message; value of command field is "navto". - * Return list of objects giving code locations and symbols that + * Return list of objects giving file locations and symbols that * match the search term given in argument 'searchTerm'. The * context for the search is given by the named file. */ @@ -692,12 +694,12 @@ declare module ts.server.protocol { /** * The location within file at which the symbol is found. */ - start: LineCol; + start: Location; /** * One past the last character of the symbol. */ - end: LineCol; + end: Location; /** * Name of symbol's container symbol (if any); for example, @@ -722,15 +724,9 @@ declare module ts.server.protocol { /** * Arguments for change request message. */ - export interface ChangeRequestArgs extends CodeLocationRequestArgs { + export interface ChangeRequestArgs extends FormatRequestArgs { /** - * Length of span deleted at location (file, line, col); nothing deleted - * if this field is zero or undefined. - */ - deleteLen?: number; - - /** - * Optional string to insert at location (file, line col). + * Optional string to insert at location (file, line, col). */ insertString?: string; } @@ -740,7 +736,7 @@ declare module ts.server.protocol { * Update the server's view of the file named by argument 'file'. * Server does not currently send a response to a change request. */ - export interface ChangeRequest extends CodeLocationRequest { + export interface ChangeRequest extends FileLocationRequest { arguments: ChangeRequestArgs; } @@ -753,10 +749,10 @@ declare module ts.server.protocol { /** * Brace matching request; value of command field is "brace". - * Return response giving the code locations of matching braces + * Return response giving the file locations of matching braces * found in file at location line, col. */ - export interface BraceRequest extends CodeLocationRequest { + export interface BraceRequest extends FileLocationRequest { } /** diff --git a/src/server/session.ts b/src/server/session.ts index 67811c76412..1a0a8d98a90 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -81,8 +81,8 @@ module ts.server { function formatDiag(fileName: string, project: Project, diag: ts.Diagnostic) { return { start: project.compilerService.host.positionToLineCol(fileName, diag.start), - len: diag.length, - text: diag.messageText, + end: project.compilerService.host.positionToLineCol(fileName, diag.start+diag.length), + text: ts.flattenDiagnosticMessageText(diag.messageText, "\n") }; } @@ -174,7 +174,7 @@ module ts.server { } response(info: any, cmdName: string, reqSeq = 0, errorMsg?: string) { - var res: ts.server.protocol.Response = { + var res: protocol.Response = { seq: 0, type: "response", command: cmdName, @@ -251,7 +251,7 @@ module ts.server { } } - getDefinition(line: number, col: number, fileName: string): ts.server.protocol.CodeSpan[] { + getDefinition(line: number, col: number, fileName: string): protocol.FileSpan[] { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -273,7 +273,7 @@ module ts.server { })); } - getRenameLocations(line: number, col: number, fileName: string,findInComments: boolean, findInStrings: boolean): ts.server.protocol.RenameResponseBody { + getRenameLocations(line: number, col: number, fileName: string,findInComments: boolean, findInStrings: boolean): protocol.RenameResponseBody { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -299,7 +299,7 @@ module ts.server { throw Errors.NoContent; } - var bakedRenameLocs = renameLocations.map(location => ({ + var bakedRenameLocs = renameLocations.map(location => ({ file: location.fileName, start: compilerService.host.positionToLineCol(location.fileName, location.textSpan.start), end: compilerService.host.positionToLineCol(location.fileName, ts.textSpanEnd(location.textSpan)), @@ -322,8 +322,8 @@ module ts.server { return b.start.col - a.start.col; } } - }).reduce((accum: ts.server.protocol.SpanGroup[], cur: ts.server.protocol.CodeSpan) => { - var curFileAccum: ts.server.protocol.SpanGroup; + }).reduce((accum: protocol.SpanGroup[], cur: protocol.FileSpan) => { + var curFileAccum: protocol.SpanGroup; if (accum.length > 0) { curFileAccum = accum[accum.length - 1]; if (curFileAccum.file != cur.file) { @@ -341,7 +341,7 @@ module ts.server { return { info: renameInfo, locs: bakedRenameLocs }; } - getReferences(line: number, col: number, fileName: string): ts.server.protocol.ReferencesResponseBody { + getReferences(line: number, col: number, fileName: string): protocol.ReferencesResponseBody { // TODO: get all projects for this file; report refs for all projects deleting duplicates // can avoid duplicates by eliminating same ref file from subsequent projects var file = ts.normalizePath(fileName); @@ -367,7 +367,7 @@ module ts.server { var nameSpan = nameInfo.textSpan; var nameColStart = compilerService.host.positionToLineCol(file, nameSpan.start).col; var nameText = compilerService.host.getScriptSnapshot(file).getText(nameSpan.start, ts.textSpanEnd(nameSpan)); - var bakedRefs: ts.server.protocol.ReferencesResponseItem[] = references.map((ref) => { + var bakedRefs: protocol.ReferencesResponseItem[] = references.map((ref) => { var start = compilerService.host.positionToLineCol(ref.fileName, ref.textSpan.start); var refLineSpan = compilerService.host.lineToTextSpan(ref.fileName, start.line - 1); var snap = compilerService.host.getScriptSnapshot(ref.fileName); @@ -393,7 +393,7 @@ module ts.server { this.projectService.openClientFile(file); } - getQuickInfo(line: number, col: number, fileName: string): ts.server.protocol.QuickInfoResponseBody { + getQuickInfo(line: number, col: number, fileName: string): protocol.QuickInfoResponseBody { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -419,7 +419,7 @@ module ts.server { }; } - getFormattingEditsForRange(line: number, col: number, endLine: number, endCol: number, fileName: string): ts.server.protocol.CodeEdit[] { + getFormattingEditsForRange(line: number, col: number, endLine: number, endCol: number, fileName: string): protocol.CodeEdit[] { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -445,7 +445,7 @@ module ts.server { }); } - getFormattingEditsAfterKeystroke(line: number, col: number, key: string, fileName: string): ts.server.protocol.CodeEdit[] { + getFormattingEditsAfterKeystroke(line: number, col: number, key: string, fileName: string): protocol.CodeEdit[] { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); @@ -456,7 +456,7 @@ module ts.server { var compilerService = project.compilerService; var position = compilerService.host.lineColToPosition(file, line, col); var edits = compilerService.languageService.getFormattingEditsAfterKeystroke(file, position, key, - compilerService.formatCodeOptions); + compilerService.formatCodeOptions); if ((key == "\n") && ((!edits) || (edits.length == 0) || allEditsBeforePos(edits, position))) { // TODO: get these options from host var editorOptions: ts.EditorOptions = { @@ -487,7 +487,7 @@ module ts.server { }); } - getCompletions(line: number, col: number, prefix: string, fileName: string): ts.server.protocol.CompletionItem[] { + getCompletions(line: number, col: number, prefix: string, fileName: string): protocol.CompletionItem[] { if (!prefix) { prefix = ""; } @@ -541,18 +541,15 @@ module ts.server { } } - change(line: number, col: number, deleteLen: number, insertString: string, fileName: string) { + change(line: number, col: number, endLine: number, endCol: number, insertString: string, fileName: string) { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (project) { var compilerService = project.compilerService; - var pos = compilerService.host.lineColToPosition(file, line, col); - if (pos >= 0) { - var end = pos; - if (deleteLen) { - end += deleteLen; - } - compilerService.host.editScript(file, pos, end, insertString); + var start = compilerService.host.lineColToPosition(file, line, col); + var end = compilerService.host.lineColToPosition(file, endLine, endCol); + if (start >= 0) { + compilerService.host.editScript(file, start, end, insertString); this.changeSeq++; } } @@ -586,7 +583,7 @@ module ts.server { this.projectService.closeClientFile(file); } - decorateNavigationBarItem(project: Project, fileName: string, items: ts.NavigationBarItem[]): ts.server.protocol.NavigationBarItem[] { + decorateNavigationBarItem(project: Project, fileName: string, items: ts.NavigationBarItem[]): protocol.NavigationBarItem[] { if (!items) { return undefined; } @@ -605,7 +602,7 @@ module ts.server { })); } - getNavigationBarItems(fileName: string): ts.server.protocol.NavigationBarItem[] { + getNavigationBarItems(fileName: string): protocol.NavigationBarItem[] { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -621,7 +618,7 @@ module ts.server { return this.decorateNavigationBarItem(project, fileName, items); } - getNavigateToItems(searchTerm: string, fileName: string): ts.server.protocol.NavtoItem[] { + getNavigateToItems(searchTerm: string, fileName: string): protocol.NavtoItem[] { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); if (!project) { @@ -637,7 +634,7 @@ module ts.server { return navItems.map((navItem) => { var start = compilerService.host.positionToLineCol(navItem.fileName, navItem.textSpan.start); var end = compilerService.host.positionToLineCol(navItem.fileName, ts.textSpanEnd(navItem.textSpan)); - var bakedItem: ts.server.protocol.NavtoItem = { + var bakedItem: protocol.NavtoItem = { name: navItem.name, kind: navItem.kind, file: navItem.fileName, @@ -660,7 +657,7 @@ module ts.server { }); } - getBraceMatching(line: number, col: number, fileName: string): ts.server.protocol.TextSpan[] { + getBraceMatching(line: number, col: number, fileName: string): protocol.TextSpan[] { var file = ts.normalizePath(fileName); var project = this.projectService.getProjectForFile(file); @@ -684,87 +681,87 @@ module ts.server { onMessage(message: string) { try { - var request = JSON.parse(message); + var request = JSON.parse(message); var response: any; switch (request.command) { - case CommandNames.Definition: { - var defArgs = request.arguments; + case CommandNames.Definition: { + var defArgs = request.arguments; response = this.getDefinition(defArgs.line, defArgs.col, defArgs.file); break; } - case CommandNames.References: { - var refArgs = request.arguments; + case CommandNames.References: { + var refArgs = request.arguments; response = this.getReferences(refArgs.line, refArgs.col, refArgs.file); break; } case CommandNames.Rename: { - var renameArgs = request.arguments; + var renameArgs = request.arguments; response = this.getRenameLocations(renameArgs.line, renameArgs.col, renameArgs.file, renameArgs.findInComments, renameArgs.findInStrings); break; } case CommandNames.Open: { - var openArgs = request.arguments; + var openArgs = request.arguments; this.openClientFile(openArgs.file); break; } case CommandNames.Quickinfo: { - var quickinfoArgs = request.arguments; + var quickinfoArgs = request.arguments; response = this.getQuickInfo(quickinfoArgs.line, quickinfoArgs.col, quickinfoArgs.file); break; } case CommandNames.Format: { - var formatArgs = request.arguments; + var formatArgs = request.arguments; response = this.getFormattingEditsForRange(formatArgs.line, formatArgs.col, formatArgs.endLine, formatArgs.endCol, formatArgs.file); break; } case CommandNames.Formatonkey: { - var formatOnKeyArgs = request.arguments; + var formatOnKeyArgs = request.arguments; response = this.getFormattingEditsAfterKeystroke(formatOnKeyArgs.line, formatOnKeyArgs.col, formatOnKeyArgs.key, formatOnKeyArgs.file); break; } case CommandNames.Completions: { - var completionsArgs = request.arguments; + var completionsArgs = request.arguments; response = this.getCompletions(request.arguments.line, request.arguments.col, completionsArgs.prefix, request.arguments.file); break; } case CommandNames.Geterr: { - var geterrArgs = request.arguments; + var geterrArgs = request.arguments; response = this.getDiagnostics(geterrArgs.delay, geterrArgs.files); break; } case CommandNames.Change: { - var changeArgs = request.arguments; - this.change(changeArgs.line, changeArgs.col, changeArgs.deleteLen, changeArgs.insertString, - changeArgs.file); + var changeArgs = request.arguments; + this.change(changeArgs.line, changeArgs.col, changeArgs.endLine, changeArgs.endCol, + changeArgs.insertString, changeArgs.file); break; } case CommandNames.Reload: { - var reloadArgs = request.arguments; + var reloadArgs = request.arguments; this.reload(reloadArgs.file, reloadArgs.tmpfile, request.seq); break; } case CommandNames.Saveto: { - var savetoArgs = request.arguments; + var savetoArgs = request.arguments; this.saveToTmp(savetoArgs.file, savetoArgs.tmpfile); break; } case CommandNames.Close: { - var closeArgs = request.arguments; + var closeArgs = request.arguments; this.closeClientFile(closeArgs.file); break; } case CommandNames.Navto: { - var navtoArgs = request.arguments; + var navtoArgs = request.arguments; response = this.getNavigateToItems(navtoArgs.searchTerm, navtoArgs.file); break; } case CommandNames.Brace: { - var braceArguments = request.arguments; + var braceArguments = request.arguments; response = this.getBraceMatching(braceArguments.line, braceArguments.col, braceArguments.file); break; } case CommandNames.NavBar: { - var navBarArgs = request.arguments; + var navBarArgs = request.arguments; response = this.getNavigationBarItems(navBarArgs.file); break; } From 1dfd1b470ea9b65d707700e50db818fde1a3cca9 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 5 Feb 2015 16:19:04 -0800 Subject: [PATCH 117/162] initial version of parsing 'for-of' Conflicts: src/compiler/diagnosticInformationMap.generated.ts src/compiler/diagnosticMessages.json --- src/compiler/checker.ts | 15 +++++++++ .../diagnosticInformationMap.generated.ts | 1 + src/compiler/diagnosticMessages.json | 6 +++- src/compiler/emitter.ts | 13 ++++++-- src/compiler/parser.ts | 32 +++++++++++++------ src/compiler/scanner.ts | 1 + src/compiler/types.ts | 10 ++++-- 7 files changed, 62 insertions(+), 16 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index b9f8857cb23..caf07cbf4dc 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8447,6 +8447,13 @@ module ts { checkSourceElement(node.statement); } + function checkForOfStatement(node: ForOfStatement) { + // TODO: not yet implemented + if (!checkGrammarForStatementInAmbientContext(node)) { + checkGrammarForOfStatement(node); + } + } + function checkForInStatement(node: ForInStatement) { // Grammar checking if (!checkGrammarForStatementInAmbientContext(node)) { @@ -9450,6 +9457,8 @@ module ts { return checkForStatement(node); case SyntaxKind.ForInStatement: return checkForInStatement(node); + case SyntaxKind.ForOfStatement: + return checkForOfStatement(node); case SyntaxKind.ContinueStatement: case SyntaxKind.BreakStatement: return checkBreakOrContinueStatement(node); @@ -10755,6 +10764,12 @@ module ts { } } + function checkGrammarForOfStatement(forOfStatement: ForOfStatement): boolean { + if (languageVersion < ScriptTarget.ES6) { + return grammarErrorOnFirstToken(forOfStatement, Diagnostics.For_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); + } + } + function checkGrammarAccessor(accessor: MethodDeclaration): boolean { var kind = accessor.kind; if (languageVersion < ScriptTarget.ES5) { diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 2c64f8ff4b0..a661f53ddfc 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -313,6 +313,7 @@ module ts { Property_0_does_not_exist_on_const_enum_1: { code: 2475, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2476, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2477, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, + For_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: DiagnosticCategory.Error, key: "For-of statements are only available when targeting ECMAScript 6 or higher" }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 8299e9f7733..d59d4fe0d8e 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1244,6 +1244,10 @@ "category": "Error", "code": 2477 }, + "For-of statements are only available when targeting ECMAScript 6 or higher": { + "category": "Error", + "code": 2482 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", @@ -1520,7 +1524,7 @@ "Exported type alias '{0}' has or is using private name '{1}'.": { "category": "Error", "code": 4081 - }, + }, "The current host does not support the '{0}' option.": { "category": "Error", "code": 5001 diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 6a2338268e8..8aa2fb72df3 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2911,7 +2911,7 @@ module ts { emitEmbeddedStatement(node.statement); } - function emitForInStatement(node: ForInStatement) { + function emitForInOrForOfStatement(node: ForInStatement | ForOfStatement) { var endPos = emitToken(SyntaxKind.ForKeyword, node.pos); write(" "); endPos = emitToken(SyntaxKind.OpenParenToken, endPos); @@ -2932,7 +2932,13 @@ module ts { else { emit(node.initializer); } - write(" in "); + + if (node.kind === SyntaxKind.ForInStatement) { + write(" in "); + } + else { + write(" of "); + } emit(node.expression); emitToken(SyntaxKind.CloseParenToken, node.expression.end); emitEmbeddedStatement(node.statement); @@ -4351,8 +4357,9 @@ module ts { return emitWhileStatement(node); case SyntaxKind.ForStatement: return emitForStatement(node); + case SyntaxKind.ForOfStatement: case SyntaxKind.ForInStatement: - return emitForInStatement(node); + return emitForInOrForOfStatement(node); case SyntaxKind.ContinueStatement: case SyntaxKind.BreakStatement: return emitBreakOrContinueStatement(node); diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 630418dc485..a90a4a9ab62 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1599,7 +1599,7 @@ module ts { // in the case where we're parsing the variable declarator of a 'for-in' statement, we // are done if we see an 'in' keyword in front of us. - if (token === SyntaxKind.InKeyword) { + if (isInOrOfKeyword(token)) { return true; } @@ -3159,6 +3159,10 @@ module ts { return parseBinaryExpressionRest(precedence, leftOperand); } + function isInOrOfKeyword(t: SyntaxKind) { + return t === SyntaxKind.InKeyword || t === SyntaxKind.OfKeyword; + } + function parseBinaryExpressionRest(precedence: number, leftOperand: Expression): Expression { while (true) { // We either have a binary operator here, or we're finished. We call @@ -3788,7 +3792,7 @@ module ts { return finishNode(node); } - function parseForOrForInStatement(): Statement { + function parseForOrForInOrForOfStatement(): Statement { var pos = getNodePos(); parseExpected(SyntaxKind.ForKeyword); parseExpected(SyntaxKind.OpenParenToken); @@ -3802,15 +3806,21 @@ module ts { initializer = disallowInAnd(parseExpression); } } - var forOrForInStatement: IterationStatement; + var forOrForInOrForOfStatement: IterationStatement; if (parseOptional(SyntaxKind.InKeyword)) { var forInStatement = createNode(SyntaxKind.ForInStatement, pos); forInStatement.initializer = initializer; forInStatement.expression = allowInAnd(parseExpression); parseExpected(SyntaxKind.CloseParenToken); - forOrForInStatement = forInStatement; + forOrForInOrForOfStatement = forInStatement; } - else { + else if (parseOptional(SyntaxKind.OfKeyword)) { + var forOfStatement = createNode(SyntaxKind.ForOfStatement, pos); + forOfStatement.initializer = initializer; + forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher); + parseExpected(SyntaxKind.CloseParenToken); + forOrForInOrForOfStatement = forOfStatement; + } else { var forStatement = createNode(SyntaxKind.ForStatement, pos); forStatement.initializer = initializer; parseExpected(SyntaxKind.SemicolonToken); @@ -3822,12 +3832,12 @@ module ts { forStatement.iterator = allowInAnd(parseExpression); } parseExpected(SyntaxKind.CloseParenToken); - forOrForInStatement = forStatement; + forOrForInOrForOfStatement = forStatement; } - forOrForInStatement.statement = parseStatement(); + forOrForInOrForOfStatement.statement = parseStatement(); - return finishNode(forOrForInStatement); + return finishNode(forOrForInOrForOfStatement); } function parseBreakOrContinueStatement(kind: SyntaxKind): BreakOrContinueStatement { @@ -4073,7 +4083,7 @@ module ts { case SyntaxKind.WhileKeyword: return parseWhileStatement(); case SyntaxKind.ForKeyword: - return parseForOrForInStatement(); + return parseForOrForInOrForOfStatement(); case SyntaxKind.ContinueKeyword: return parseBreakOrContinueStatement(SyntaxKind.ContinueStatement); case SyntaxKind.BreakKeyword: @@ -4215,7 +4225,9 @@ module ts { var node = createNode(SyntaxKind.VariableDeclaration); node.name = parseIdentifierOrPattern(); node.type = parseTypeAnnotation(); - node.initializer = parseInitializer(/*inParameter*/ false); + if (!isInOrOfKeyword(token)) { + node.initializer = parseInitializer(/*inParameter*/ false); + } return finishNode(node); } diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index fbbd69bbd69..7700d2389a0 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -93,6 +93,7 @@ module ts { "while": SyntaxKind.WhileKeyword, "with": SyntaxKind.WithKeyword, "yield": SyntaxKind.YieldKeyword, + "of": SyntaxKind.OfKeyword, "{": SyntaxKind.OpenBraceToken, "}": SyntaxKind.CloseBraceToken, "(": SyntaxKind.OpenParenToken, diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 12c5af21e12..04b44a5c1c0 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -141,7 +141,7 @@ module ts { SetKeyword, StringKeyword, TypeKeyword, - + OfKeyword, // Parse tree nodes // Names @@ -210,6 +210,7 @@ module ts { WhileStatement, ForStatement, ForInStatement, + ForOfStatement, ContinueStatement, BreakStatement, ReturnStatement, @@ -259,7 +260,7 @@ module ts { FirstReservedWord = BreakKeyword, LastReservedWord = WithKeyword, FirstKeyword = BreakKeyword, - LastKeyword = TypeKeyword, + LastKeyword = OfKeyword, FirstFutureReservedWord = ImplementsKeyword, LastFutureReservedWord = YieldKeyword, FirstTypeNode = TypeReference, @@ -752,6 +753,11 @@ module ts { expression: Expression; } + export interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } + export interface BreakOrContinueStatement extends Statement { label?: Identifier; } From 7947590ee5ad1bdb4b98ff708ae7659031c87df6 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 5 Feb 2015 16:29:59 -0800 Subject: [PATCH 118/162] added ForOfStatement to forEachChild --- src/compiler/parser.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index a90a4a9ab62..64f9560999b 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -191,6 +191,10 @@ module ts { return visitNode(cbNode, (node).initializer) || visitNode(cbNode, (node).expression) || visitNode(cbNode, (node).statement); + case SyntaxKind.ForOfStatement: + return visitNode(cbNode, (node).initializer) || + visitNode(cbNode, (node).expression) || + visitNode(cbNode, (node).statement); case SyntaxKind.ContinueStatement: case SyntaxKind.BreakStatement: return visitNode(cbNode, (node).label); From 2c4244d749fb591f4c6eb15dba86045e229ec92b Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Mon, 16 Feb 2015 16:33:07 -0800 Subject: [PATCH 119/162] Accept API baseline changes --- .../baselines/reference/APISample_compile.js | 192 ++++++++-------- .../reference/APISample_compile.types | 205 +++++++++-------- tests/baselines/reference/APISample_linter.js | 210 +++++++++--------- .../reference/APISample_linter.types | 205 +++++++++-------- .../reference/APISample_transform.js | 192 ++++++++-------- .../reference/APISample_transform.types | 205 +++++++++-------- .../baselines/reference/APISample_watcher.js | 192 ++++++++-------- .../reference/APISample_watcher.types | 205 +++++++++-------- 8 files changed, 853 insertions(+), 753 deletions(-) diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index b91a706aa45..3a291f8375c 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -180,105 +180,107 @@ declare module "typescript" { SetKeyword = 118, StringKeyword = 119, TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + OfKeyword = 121, + QualifiedName = 122, + ComputedPropertyName = 123, + TypeParameter = 124, + Parameter = 125, + PropertySignature = 126, + PropertyDeclaration = 127, + MethodSignature = 128, + MethodDeclaration = 129, + Constructor = 130, + GetAccessor = 131, + SetAccessor = 132, + CallSignature = 133, + ConstructSignature = 134, + IndexSignature = 135, + TypeReference = 136, + FunctionType = 137, + ConstructorType = 138, + TypeQuery = 139, + TypeLiteral = 140, + ArrayType = 141, + TupleType = 142, + UnionType = 143, + ParenthesizedType = 144, + ObjectBindingPattern = 145, + ArrayBindingPattern = 146, + BindingElement = 147, + ArrayLiteralExpression = 148, + ObjectLiteralExpression = 149, + PropertyAccessExpression = 150, + ElementAccessExpression = 151, + CallExpression = 152, + NewExpression = 153, + TaggedTemplateExpression = 154, + TypeAssertionExpression = 155, + ParenthesizedExpression = 156, + FunctionExpression = 157, + ArrowFunction = 158, + DeleteExpression = 159, + TypeOfExpression = 160, + VoidExpression = 161, + PrefixUnaryExpression = 162, + PostfixUnaryExpression = 163, + BinaryExpression = 164, + ConditionalExpression = 165, + TemplateExpression = 166, + YieldExpression = 167, + SpreadElementExpression = 168, + OmittedExpression = 169, + TemplateSpan = 170, + Block = 171, + VariableStatement = 172, + EmptyStatement = 173, + ExpressionStatement = 174, + IfStatement = 175, + DoStatement = 176, + WhileStatement = 177, + ForStatement = 178, + ForInStatement = 179, + ForOfStatement = 180, + ContinueStatement = 181, + BreakStatement = 182, + ReturnStatement = 183, + WithStatement = 184, + SwitchStatement = 185, + LabeledStatement = 186, + ThrowStatement = 187, + TryStatement = 188, + DebuggerStatement = 189, + VariableDeclaration = 190, + VariableDeclarationList = 191, + FunctionDeclaration = 192, + ClassDeclaration = 193, + InterfaceDeclaration = 194, + TypeAliasDeclaration = 195, + EnumDeclaration = 196, + ModuleDeclaration = 197, + ModuleBlock = 198, + ImportDeclaration = 199, + ExportAssignment = 200, + ExternalModuleReference = 201, + CaseClause = 202, + DefaultClause = 203, + HeritageClause = 204, + CatchClause = 205, + PropertyAssignment = 206, + ShorthandPropertyAssignment = 207, + EnumMember = 208, + SourceFile = 209, + SyntaxList = 210, + Count = 211, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 121, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 136, + LastTypeNode = 144, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, @@ -291,7 +293,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 122, } const enum NodeFlags { Export = 1, @@ -622,6 +624,10 @@ declare module "typescript" { initializer: VariableDeclarationList | Expression; expression: Expression; } + interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } interface BreakOrContinueStatement extends Statement { label?: Identifier; } diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index ae53c666807..70b9451af81 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -556,271 +556,277 @@ declare module "typescript" { TypeKeyword = 120, >TypeKeyword : SyntaxKind - QualifiedName = 121, + OfKeyword = 121, +>OfKeyword : SyntaxKind + + QualifiedName = 122, >QualifiedName : SyntaxKind - ComputedPropertyName = 122, + ComputedPropertyName = 123, >ComputedPropertyName : SyntaxKind - TypeParameter = 123, + TypeParameter = 124, >TypeParameter : SyntaxKind - Parameter = 124, + Parameter = 125, >Parameter : SyntaxKind - PropertySignature = 125, + PropertySignature = 126, >PropertySignature : SyntaxKind - PropertyDeclaration = 126, + PropertyDeclaration = 127, >PropertyDeclaration : SyntaxKind - MethodSignature = 127, + MethodSignature = 128, >MethodSignature : SyntaxKind - MethodDeclaration = 128, + MethodDeclaration = 129, >MethodDeclaration : SyntaxKind - Constructor = 129, + Constructor = 130, >Constructor : SyntaxKind - GetAccessor = 130, + GetAccessor = 131, >GetAccessor : SyntaxKind - SetAccessor = 131, + SetAccessor = 132, >SetAccessor : SyntaxKind - CallSignature = 132, + CallSignature = 133, >CallSignature : SyntaxKind - ConstructSignature = 133, + ConstructSignature = 134, >ConstructSignature : SyntaxKind - IndexSignature = 134, + IndexSignature = 135, >IndexSignature : SyntaxKind - TypeReference = 135, + TypeReference = 136, >TypeReference : SyntaxKind - FunctionType = 136, + FunctionType = 137, >FunctionType : SyntaxKind - ConstructorType = 137, + ConstructorType = 138, >ConstructorType : SyntaxKind - TypeQuery = 138, + TypeQuery = 139, >TypeQuery : SyntaxKind - TypeLiteral = 139, + TypeLiteral = 140, >TypeLiteral : SyntaxKind - ArrayType = 140, + ArrayType = 141, >ArrayType : SyntaxKind - TupleType = 141, + TupleType = 142, >TupleType : SyntaxKind - UnionType = 142, + UnionType = 143, >UnionType : SyntaxKind - ParenthesizedType = 143, + ParenthesizedType = 144, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 144, + ObjectBindingPattern = 145, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 145, + ArrayBindingPattern = 146, >ArrayBindingPattern : SyntaxKind - BindingElement = 146, + BindingElement = 147, >BindingElement : SyntaxKind - ArrayLiteralExpression = 147, + ArrayLiteralExpression = 148, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 148, + ObjectLiteralExpression = 149, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 149, + PropertyAccessExpression = 150, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 150, + ElementAccessExpression = 151, >ElementAccessExpression : SyntaxKind - CallExpression = 151, + CallExpression = 152, >CallExpression : SyntaxKind - NewExpression = 152, + NewExpression = 153, >NewExpression : SyntaxKind - TaggedTemplateExpression = 153, + TaggedTemplateExpression = 154, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 154, + TypeAssertionExpression = 155, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 155, + ParenthesizedExpression = 156, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 156, + FunctionExpression = 157, >FunctionExpression : SyntaxKind - ArrowFunction = 157, + ArrowFunction = 158, >ArrowFunction : SyntaxKind - DeleteExpression = 158, + DeleteExpression = 159, >DeleteExpression : SyntaxKind - TypeOfExpression = 159, + TypeOfExpression = 160, >TypeOfExpression : SyntaxKind - VoidExpression = 160, + VoidExpression = 161, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 161, + PrefixUnaryExpression = 162, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 162, + PostfixUnaryExpression = 163, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 163, + BinaryExpression = 164, >BinaryExpression : SyntaxKind - ConditionalExpression = 164, + ConditionalExpression = 165, >ConditionalExpression : SyntaxKind - TemplateExpression = 165, + TemplateExpression = 166, >TemplateExpression : SyntaxKind - YieldExpression = 166, + YieldExpression = 167, >YieldExpression : SyntaxKind - SpreadElementExpression = 167, + SpreadElementExpression = 168, >SpreadElementExpression : SyntaxKind - OmittedExpression = 168, + OmittedExpression = 169, >OmittedExpression : SyntaxKind - TemplateSpan = 169, + TemplateSpan = 170, >TemplateSpan : SyntaxKind - Block = 170, + Block = 171, >Block : SyntaxKind - VariableStatement = 171, + VariableStatement = 172, >VariableStatement : SyntaxKind - EmptyStatement = 172, + EmptyStatement = 173, >EmptyStatement : SyntaxKind - ExpressionStatement = 173, + ExpressionStatement = 174, >ExpressionStatement : SyntaxKind - IfStatement = 174, + IfStatement = 175, >IfStatement : SyntaxKind - DoStatement = 175, + DoStatement = 176, >DoStatement : SyntaxKind - WhileStatement = 176, + WhileStatement = 177, >WhileStatement : SyntaxKind - ForStatement = 177, + ForStatement = 178, >ForStatement : SyntaxKind - ForInStatement = 178, + ForInStatement = 179, >ForInStatement : SyntaxKind - ContinueStatement = 179, + ForOfStatement = 180, +>ForOfStatement : SyntaxKind + + ContinueStatement = 181, >ContinueStatement : SyntaxKind - BreakStatement = 180, + BreakStatement = 182, >BreakStatement : SyntaxKind - ReturnStatement = 181, + ReturnStatement = 183, >ReturnStatement : SyntaxKind - WithStatement = 182, + WithStatement = 184, >WithStatement : SyntaxKind - SwitchStatement = 183, + SwitchStatement = 185, >SwitchStatement : SyntaxKind - LabeledStatement = 184, + LabeledStatement = 186, >LabeledStatement : SyntaxKind - ThrowStatement = 185, + ThrowStatement = 187, >ThrowStatement : SyntaxKind - TryStatement = 186, + TryStatement = 188, >TryStatement : SyntaxKind - DebuggerStatement = 187, + DebuggerStatement = 189, >DebuggerStatement : SyntaxKind - VariableDeclaration = 188, + VariableDeclaration = 190, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 189, + VariableDeclarationList = 191, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 190, + FunctionDeclaration = 192, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 191, + ClassDeclaration = 193, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 192, + InterfaceDeclaration = 194, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 193, + TypeAliasDeclaration = 195, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 194, + EnumDeclaration = 196, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 195, + ModuleDeclaration = 197, >ModuleDeclaration : SyntaxKind - ModuleBlock = 196, + ModuleBlock = 198, >ModuleBlock : SyntaxKind - ImportDeclaration = 197, + ImportDeclaration = 199, >ImportDeclaration : SyntaxKind - ExportAssignment = 198, + ExportAssignment = 200, >ExportAssignment : SyntaxKind - ExternalModuleReference = 199, + ExternalModuleReference = 201, >ExternalModuleReference : SyntaxKind - CaseClause = 200, + CaseClause = 202, >CaseClause : SyntaxKind - DefaultClause = 201, + DefaultClause = 203, >DefaultClause : SyntaxKind - HeritageClause = 202, + HeritageClause = 204, >HeritageClause : SyntaxKind - CatchClause = 203, + CatchClause = 205, >CatchClause : SyntaxKind - PropertyAssignment = 204, + PropertyAssignment = 206, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 205, + ShorthandPropertyAssignment = 207, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 206, + EnumMember = 208, >EnumMember : SyntaxKind - SourceFile = 207, + SourceFile = 209, >SourceFile : SyntaxKind - SyntaxList = 208, + SyntaxList = 210, >SyntaxList : SyntaxKind - Count = 209, + Count = 211, >Count : SyntaxKind FirstAssignment = 52, @@ -838,7 +844,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 120, + LastKeyword = 121, >LastKeyword : SyntaxKind FirstFutureReservedWord = 101, @@ -847,10 +853,10 @@ declare module "typescript" { LastFutureReservedWord = 109, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 135, + FirstTypeNode = 136, >FirstTypeNode : SyntaxKind - LastTypeNode = 143, + LastTypeNode = 144, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -889,7 +895,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 121, + FirstNode = 122, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -1870,6 +1876,19 @@ declare module "typescript" { expression: Expression; >expression : Expression +>Expression : Expression + } + interface ForOfStatement extends IterationStatement { +>ForOfStatement : ForOfStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression >Expression : Expression } interface BreakOrContinueStatement extends Statement { diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 68c13edb7db..f1c5c0fe99e 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -211,105 +211,107 @@ declare module "typescript" { SetKeyword = 118, StringKeyword = 119, TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + OfKeyword = 121, + QualifiedName = 122, + ComputedPropertyName = 123, + TypeParameter = 124, + Parameter = 125, + PropertySignature = 126, + PropertyDeclaration = 127, + MethodSignature = 128, + MethodDeclaration = 129, + Constructor = 130, + GetAccessor = 131, + SetAccessor = 132, + CallSignature = 133, + ConstructSignature = 134, + IndexSignature = 135, + TypeReference = 136, + FunctionType = 137, + ConstructorType = 138, + TypeQuery = 139, + TypeLiteral = 140, + ArrayType = 141, + TupleType = 142, + UnionType = 143, + ParenthesizedType = 144, + ObjectBindingPattern = 145, + ArrayBindingPattern = 146, + BindingElement = 147, + ArrayLiteralExpression = 148, + ObjectLiteralExpression = 149, + PropertyAccessExpression = 150, + ElementAccessExpression = 151, + CallExpression = 152, + NewExpression = 153, + TaggedTemplateExpression = 154, + TypeAssertionExpression = 155, + ParenthesizedExpression = 156, + FunctionExpression = 157, + ArrowFunction = 158, + DeleteExpression = 159, + TypeOfExpression = 160, + VoidExpression = 161, + PrefixUnaryExpression = 162, + PostfixUnaryExpression = 163, + BinaryExpression = 164, + ConditionalExpression = 165, + TemplateExpression = 166, + YieldExpression = 167, + SpreadElementExpression = 168, + OmittedExpression = 169, + TemplateSpan = 170, + Block = 171, + VariableStatement = 172, + EmptyStatement = 173, + ExpressionStatement = 174, + IfStatement = 175, + DoStatement = 176, + WhileStatement = 177, + ForStatement = 178, + ForInStatement = 179, + ForOfStatement = 180, + ContinueStatement = 181, + BreakStatement = 182, + ReturnStatement = 183, + WithStatement = 184, + SwitchStatement = 185, + LabeledStatement = 186, + ThrowStatement = 187, + TryStatement = 188, + DebuggerStatement = 189, + VariableDeclaration = 190, + VariableDeclarationList = 191, + FunctionDeclaration = 192, + ClassDeclaration = 193, + InterfaceDeclaration = 194, + TypeAliasDeclaration = 195, + EnumDeclaration = 196, + ModuleDeclaration = 197, + ModuleBlock = 198, + ImportDeclaration = 199, + ExportAssignment = 200, + ExternalModuleReference = 201, + CaseClause = 202, + DefaultClause = 203, + HeritageClause = 204, + CatchClause = 205, + PropertyAssignment = 206, + ShorthandPropertyAssignment = 207, + EnumMember = 208, + SourceFile = 209, + SyntaxList = 210, + Count = 211, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 121, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 136, + LastTypeNode = 144, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, @@ -322,7 +324,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 122, } const enum NodeFlags { Export = 1, @@ -653,6 +655,10 @@ declare module "typescript" { initializer: VariableDeclarationList | Expression; expression: Expression; } + interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } interface BreakOrContinueStatement extends Statement { label?: Identifier; } @@ -1976,24 +1982,24 @@ function delint(sourceFile) { delintNode(sourceFile); function delintNode(node) { switch (node.kind) { - case 177 /* ForStatement */: - case 178 /* ForInStatement */: - case 176 /* WhileStatement */: - case 175 /* DoStatement */: - if (node.statement.kind !== 170 /* Block */) { + case 178 /* ForStatement */: + case 179 /* ForInStatement */: + case 177 /* WhileStatement */: + case 176 /* DoStatement */: + if (node.statement.kind !== 171 /* Block */) { report(node, "A looping statement's contents should be wrapped in a block body."); } break; - case 174 /* IfStatement */: + case 175 /* IfStatement */: var ifStatement = node; - if (ifStatement.thenStatement.kind !== 170 /* Block */) { + if (ifStatement.thenStatement.kind !== 171 /* Block */) { report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body."); } - if (ifStatement.elseStatement && ifStatement.elseStatement.kind !== 170 /* Block */ && ifStatement.elseStatement.kind !== 174 /* IfStatement */) { + if (ifStatement.elseStatement && ifStatement.elseStatement.kind !== 171 /* Block */ && ifStatement.elseStatement.kind !== 175 /* IfStatement */) { report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body."); } break; - case 163 /* BinaryExpression */: + case 164 /* BinaryExpression */: var op = node.operator; if (op === 28 /* EqualsEqualsToken */ || op === 29 /* ExclamationEqualsToken */) { report(node, "Use '===' and '!=='."); diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 0c153e7b1dc..87ff77cb26b 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -700,271 +700,277 @@ declare module "typescript" { TypeKeyword = 120, >TypeKeyword : SyntaxKind - QualifiedName = 121, + OfKeyword = 121, +>OfKeyword : SyntaxKind + + QualifiedName = 122, >QualifiedName : SyntaxKind - ComputedPropertyName = 122, + ComputedPropertyName = 123, >ComputedPropertyName : SyntaxKind - TypeParameter = 123, + TypeParameter = 124, >TypeParameter : SyntaxKind - Parameter = 124, + Parameter = 125, >Parameter : SyntaxKind - PropertySignature = 125, + PropertySignature = 126, >PropertySignature : SyntaxKind - PropertyDeclaration = 126, + PropertyDeclaration = 127, >PropertyDeclaration : SyntaxKind - MethodSignature = 127, + MethodSignature = 128, >MethodSignature : SyntaxKind - MethodDeclaration = 128, + MethodDeclaration = 129, >MethodDeclaration : SyntaxKind - Constructor = 129, + Constructor = 130, >Constructor : SyntaxKind - GetAccessor = 130, + GetAccessor = 131, >GetAccessor : SyntaxKind - SetAccessor = 131, + SetAccessor = 132, >SetAccessor : SyntaxKind - CallSignature = 132, + CallSignature = 133, >CallSignature : SyntaxKind - ConstructSignature = 133, + ConstructSignature = 134, >ConstructSignature : SyntaxKind - IndexSignature = 134, + IndexSignature = 135, >IndexSignature : SyntaxKind - TypeReference = 135, + TypeReference = 136, >TypeReference : SyntaxKind - FunctionType = 136, + FunctionType = 137, >FunctionType : SyntaxKind - ConstructorType = 137, + ConstructorType = 138, >ConstructorType : SyntaxKind - TypeQuery = 138, + TypeQuery = 139, >TypeQuery : SyntaxKind - TypeLiteral = 139, + TypeLiteral = 140, >TypeLiteral : SyntaxKind - ArrayType = 140, + ArrayType = 141, >ArrayType : SyntaxKind - TupleType = 141, + TupleType = 142, >TupleType : SyntaxKind - UnionType = 142, + UnionType = 143, >UnionType : SyntaxKind - ParenthesizedType = 143, + ParenthesizedType = 144, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 144, + ObjectBindingPattern = 145, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 145, + ArrayBindingPattern = 146, >ArrayBindingPattern : SyntaxKind - BindingElement = 146, + BindingElement = 147, >BindingElement : SyntaxKind - ArrayLiteralExpression = 147, + ArrayLiteralExpression = 148, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 148, + ObjectLiteralExpression = 149, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 149, + PropertyAccessExpression = 150, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 150, + ElementAccessExpression = 151, >ElementAccessExpression : SyntaxKind - CallExpression = 151, + CallExpression = 152, >CallExpression : SyntaxKind - NewExpression = 152, + NewExpression = 153, >NewExpression : SyntaxKind - TaggedTemplateExpression = 153, + TaggedTemplateExpression = 154, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 154, + TypeAssertionExpression = 155, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 155, + ParenthesizedExpression = 156, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 156, + FunctionExpression = 157, >FunctionExpression : SyntaxKind - ArrowFunction = 157, + ArrowFunction = 158, >ArrowFunction : SyntaxKind - DeleteExpression = 158, + DeleteExpression = 159, >DeleteExpression : SyntaxKind - TypeOfExpression = 159, + TypeOfExpression = 160, >TypeOfExpression : SyntaxKind - VoidExpression = 160, + VoidExpression = 161, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 161, + PrefixUnaryExpression = 162, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 162, + PostfixUnaryExpression = 163, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 163, + BinaryExpression = 164, >BinaryExpression : SyntaxKind - ConditionalExpression = 164, + ConditionalExpression = 165, >ConditionalExpression : SyntaxKind - TemplateExpression = 165, + TemplateExpression = 166, >TemplateExpression : SyntaxKind - YieldExpression = 166, + YieldExpression = 167, >YieldExpression : SyntaxKind - SpreadElementExpression = 167, + SpreadElementExpression = 168, >SpreadElementExpression : SyntaxKind - OmittedExpression = 168, + OmittedExpression = 169, >OmittedExpression : SyntaxKind - TemplateSpan = 169, + TemplateSpan = 170, >TemplateSpan : SyntaxKind - Block = 170, + Block = 171, >Block : SyntaxKind - VariableStatement = 171, + VariableStatement = 172, >VariableStatement : SyntaxKind - EmptyStatement = 172, + EmptyStatement = 173, >EmptyStatement : SyntaxKind - ExpressionStatement = 173, + ExpressionStatement = 174, >ExpressionStatement : SyntaxKind - IfStatement = 174, + IfStatement = 175, >IfStatement : SyntaxKind - DoStatement = 175, + DoStatement = 176, >DoStatement : SyntaxKind - WhileStatement = 176, + WhileStatement = 177, >WhileStatement : SyntaxKind - ForStatement = 177, + ForStatement = 178, >ForStatement : SyntaxKind - ForInStatement = 178, + ForInStatement = 179, >ForInStatement : SyntaxKind - ContinueStatement = 179, + ForOfStatement = 180, +>ForOfStatement : SyntaxKind + + ContinueStatement = 181, >ContinueStatement : SyntaxKind - BreakStatement = 180, + BreakStatement = 182, >BreakStatement : SyntaxKind - ReturnStatement = 181, + ReturnStatement = 183, >ReturnStatement : SyntaxKind - WithStatement = 182, + WithStatement = 184, >WithStatement : SyntaxKind - SwitchStatement = 183, + SwitchStatement = 185, >SwitchStatement : SyntaxKind - LabeledStatement = 184, + LabeledStatement = 186, >LabeledStatement : SyntaxKind - ThrowStatement = 185, + ThrowStatement = 187, >ThrowStatement : SyntaxKind - TryStatement = 186, + TryStatement = 188, >TryStatement : SyntaxKind - DebuggerStatement = 187, + DebuggerStatement = 189, >DebuggerStatement : SyntaxKind - VariableDeclaration = 188, + VariableDeclaration = 190, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 189, + VariableDeclarationList = 191, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 190, + FunctionDeclaration = 192, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 191, + ClassDeclaration = 193, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 192, + InterfaceDeclaration = 194, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 193, + TypeAliasDeclaration = 195, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 194, + EnumDeclaration = 196, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 195, + ModuleDeclaration = 197, >ModuleDeclaration : SyntaxKind - ModuleBlock = 196, + ModuleBlock = 198, >ModuleBlock : SyntaxKind - ImportDeclaration = 197, + ImportDeclaration = 199, >ImportDeclaration : SyntaxKind - ExportAssignment = 198, + ExportAssignment = 200, >ExportAssignment : SyntaxKind - ExternalModuleReference = 199, + ExternalModuleReference = 201, >ExternalModuleReference : SyntaxKind - CaseClause = 200, + CaseClause = 202, >CaseClause : SyntaxKind - DefaultClause = 201, + DefaultClause = 203, >DefaultClause : SyntaxKind - HeritageClause = 202, + HeritageClause = 204, >HeritageClause : SyntaxKind - CatchClause = 203, + CatchClause = 205, >CatchClause : SyntaxKind - PropertyAssignment = 204, + PropertyAssignment = 206, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 205, + ShorthandPropertyAssignment = 207, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 206, + EnumMember = 208, >EnumMember : SyntaxKind - SourceFile = 207, + SourceFile = 209, >SourceFile : SyntaxKind - SyntaxList = 208, + SyntaxList = 210, >SyntaxList : SyntaxKind - Count = 209, + Count = 211, >Count : SyntaxKind FirstAssignment = 52, @@ -982,7 +988,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 120, + LastKeyword = 121, >LastKeyword : SyntaxKind FirstFutureReservedWord = 101, @@ -991,10 +997,10 @@ declare module "typescript" { LastFutureReservedWord = 109, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 135, + FirstTypeNode = 136, >FirstTypeNode : SyntaxKind - LastTypeNode = 143, + LastTypeNode = 144, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -1033,7 +1039,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 121, + FirstNode = 122, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -2014,6 +2020,19 @@ declare module "typescript" { expression: Expression; >expression : Expression +>Expression : Expression + } + interface ForOfStatement extends IterationStatement { +>ForOfStatement : ForOfStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression >Expression : Expression } interface BreakOrContinueStatement extends Statement { diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 0e80f6b55b9..0abe024854f 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -212,105 +212,107 @@ declare module "typescript" { SetKeyword = 118, StringKeyword = 119, TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + OfKeyword = 121, + QualifiedName = 122, + ComputedPropertyName = 123, + TypeParameter = 124, + Parameter = 125, + PropertySignature = 126, + PropertyDeclaration = 127, + MethodSignature = 128, + MethodDeclaration = 129, + Constructor = 130, + GetAccessor = 131, + SetAccessor = 132, + CallSignature = 133, + ConstructSignature = 134, + IndexSignature = 135, + TypeReference = 136, + FunctionType = 137, + ConstructorType = 138, + TypeQuery = 139, + TypeLiteral = 140, + ArrayType = 141, + TupleType = 142, + UnionType = 143, + ParenthesizedType = 144, + ObjectBindingPattern = 145, + ArrayBindingPattern = 146, + BindingElement = 147, + ArrayLiteralExpression = 148, + ObjectLiteralExpression = 149, + PropertyAccessExpression = 150, + ElementAccessExpression = 151, + CallExpression = 152, + NewExpression = 153, + TaggedTemplateExpression = 154, + TypeAssertionExpression = 155, + ParenthesizedExpression = 156, + FunctionExpression = 157, + ArrowFunction = 158, + DeleteExpression = 159, + TypeOfExpression = 160, + VoidExpression = 161, + PrefixUnaryExpression = 162, + PostfixUnaryExpression = 163, + BinaryExpression = 164, + ConditionalExpression = 165, + TemplateExpression = 166, + YieldExpression = 167, + SpreadElementExpression = 168, + OmittedExpression = 169, + TemplateSpan = 170, + Block = 171, + VariableStatement = 172, + EmptyStatement = 173, + ExpressionStatement = 174, + IfStatement = 175, + DoStatement = 176, + WhileStatement = 177, + ForStatement = 178, + ForInStatement = 179, + ForOfStatement = 180, + ContinueStatement = 181, + BreakStatement = 182, + ReturnStatement = 183, + WithStatement = 184, + SwitchStatement = 185, + LabeledStatement = 186, + ThrowStatement = 187, + TryStatement = 188, + DebuggerStatement = 189, + VariableDeclaration = 190, + VariableDeclarationList = 191, + FunctionDeclaration = 192, + ClassDeclaration = 193, + InterfaceDeclaration = 194, + TypeAliasDeclaration = 195, + EnumDeclaration = 196, + ModuleDeclaration = 197, + ModuleBlock = 198, + ImportDeclaration = 199, + ExportAssignment = 200, + ExternalModuleReference = 201, + CaseClause = 202, + DefaultClause = 203, + HeritageClause = 204, + CatchClause = 205, + PropertyAssignment = 206, + ShorthandPropertyAssignment = 207, + EnumMember = 208, + SourceFile = 209, + SyntaxList = 210, + Count = 211, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 121, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 136, + LastTypeNode = 144, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, @@ -323,7 +325,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 122, } const enum NodeFlags { Export = 1, @@ -654,6 +656,10 @@ declare module "typescript" { initializer: VariableDeclarationList | Expression; expression: Expression; } + interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } interface BreakOrContinueStatement extends Statement { label?: Identifier; } diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 0c201b0a5fd..8e9d349cf1f 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -652,271 +652,277 @@ declare module "typescript" { TypeKeyword = 120, >TypeKeyword : SyntaxKind - QualifiedName = 121, + OfKeyword = 121, +>OfKeyword : SyntaxKind + + QualifiedName = 122, >QualifiedName : SyntaxKind - ComputedPropertyName = 122, + ComputedPropertyName = 123, >ComputedPropertyName : SyntaxKind - TypeParameter = 123, + TypeParameter = 124, >TypeParameter : SyntaxKind - Parameter = 124, + Parameter = 125, >Parameter : SyntaxKind - PropertySignature = 125, + PropertySignature = 126, >PropertySignature : SyntaxKind - PropertyDeclaration = 126, + PropertyDeclaration = 127, >PropertyDeclaration : SyntaxKind - MethodSignature = 127, + MethodSignature = 128, >MethodSignature : SyntaxKind - MethodDeclaration = 128, + MethodDeclaration = 129, >MethodDeclaration : SyntaxKind - Constructor = 129, + Constructor = 130, >Constructor : SyntaxKind - GetAccessor = 130, + GetAccessor = 131, >GetAccessor : SyntaxKind - SetAccessor = 131, + SetAccessor = 132, >SetAccessor : SyntaxKind - CallSignature = 132, + CallSignature = 133, >CallSignature : SyntaxKind - ConstructSignature = 133, + ConstructSignature = 134, >ConstructSignature : SyntaxKind - IndexSignature = 134, + IndexSignature = 135, >IndexSignature : SyntaxKind - TypeReference = 135, + TypeReference = 136, >TypeReference : SyntaxKind - FunctionType = 136, + FunctionType = 137, >FunctionType : SyntaxKind - ConstructorType = 137, + ConstructorType = 138, >ConstructorType : SyntaxKind - TypeQuery = 138, + TypeQuery = 139, >TypeQuery : SyntaxKind - TypeLiteral = 139, + TypeLiteral = 140, >TypeLiteral : SyntaxKind - ArrayType = 140, + ArrayType = 141, >ArrayType : SyntaxKind - TupleType = 141, + TupleType = 142, >TupleType : SyntaxKind - UnionType = 142, + UnionType = 143, >UnionType : SyntaxKind - ParenthesizedType = 143, + ParenthesizedType = 144, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 144, + ObjectBindingPattern = 145, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 145, + ArrayBindingPattern = 146, >ArrayBindingPattern : SyntaxKind - BindingElement = 146, + BindingElement = 147, >BindingElement : SyntaxKind - ArrayLiteralExpression = 147, + ArrayLiteralExpression = 148, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 148, + ObjectLiteralExpression = 149, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 149, + PropertyAccessExpression = 150, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 150, + ElementAccessExpression = 151, >ElementAccessExpression : SyntaxKind - CallExpression = 151, + CallExpression = 152, >CallExpression : SyntaxKind - NewExpression = 152, + NewExpression = 153, >NewExpression : SyntaxKind - TaggedTemplateExpression = 153, + TaggedTemplateExpression = 154, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 154, + TypeAssertionExpression = 155, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 155, + ParenthesizedExpression = 156, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 156, + FunctionExpression = 157, >FunctionExpression : SyntaxKind - ArrowFunction = 157, + ArrowFunction = 158, >ArrowFunction : SyntaxKind - DeleteExpression = 158, + DeleteExpression = 159, >DeleteExpression : SyntaxKind - TypeOfExpression = 159, + TypeOfExpression = 160, >TypeOfExpression : SyntaxKind - VoidExpression = 160, + VoidExpression = 161, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 161, + PrefixUnaryExpression = 162, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 162, + PostfixUnaryExpression = 163, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 163, + BinaryExpression = 164, >BinaryExpression : SyntaxKind - ConditionalExpression = 164, + ConditionalExpression = 165, >ConditionalExpression : SyntaxKind - TemplateExpression = 165, + TemplateExpression = 166, >TemplateExpression : SyntaxKind - YieldExpression = 166, + YieldExpression = 167, >YieldExpression : SyntaxKind - SpreadElementExpression = 167, + SpreadElementExpression = 168, >SpreadElementExpression : SyntaxKind - OmittedExpression = 168, + OmittedExpression = 169, >OmittedExpression : SyntaxKind - TemplateSpan = 169, + TemplateSpan = 170, >TemplateSpan : SyntaxKind - Block = 170, + Block = 171, >Block : SyntaxKind - VariableStatement = 171, + VariableStatement = 172, >VariableStatement : SyntaxKind - EmptyStatement = 172, + EmptyStatement = 173, >EmptyStatement : SyntaxKind - ExpressionStatement = 173, + ExpressionStatement = 174, >ExpressionStatement : SyntaxKind - IfStatement = 174, + IfStatement = 175, >IfStatement : SyntaxKind - DoStatement = 175, + DoStatement = 176, >DoStatement : SyntaxKind - WhileStatement = 176, + WhileStatement = 177, >WhileStatement : SyntaxKind - ForStatement = 177, + ForStatement = 178, >ForStatement : SyntaxKind - ForInStatement = 178, + ForInStatement = 179, >ForInStatement : SyntaxKind - ContinueStatement = 179, + ForOfStatement = 180, +>ForOfStatement : SyntaxKind + + ContinueStatement = 181, >ContinueStatement : SyntaxKind - BreakStatement = 180, + BreakStatement = 182, >BreakStatement : SyntaxKind - ReturnStatement = 181, + ReturnStatement = 183, >ReturnStatement : SyntaxKind - WithStatement = 182, + WithStatement = 184, >WithStatement : SyntaxKind - SwitchStatement = 183, + SwitchStatement = 185, >SwitchStatement : SyntaxKind - LabeledStatement = 184, + LabeledStatement = 186, >LabeledStatement : SyntaxKind - ThrowStatement = 185, + ThrowStatement = 187, >ThrowStatement : SyntaxKind - TryStatement = 186, + TryStatement = 188, >TryStatement : SyntaxKind - DebuggerStatement = 187, + DebuggerStatement = 189, >DebuggerStatement : SyntaxKind - VariableDeclaration = 188, + VariableDeclaration = 190, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 189, + VariableDeclarationList = 191, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 190, + FunctionDeclaration = 192, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 191, + ClassDeclaration = 193, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 192, + InterfaceDeclaration = 194, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 193, + TypeAliasDeclaration = 195, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 194, + EnumDeclaration = 196, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 195, + ModuleDeclaration = 197, >ModuleDeclaration : SyntaxKind - ModuleBlock = 196, + ModuleBlock = 198, >ModuleBlock : SyntaxKind - ImportDeclaration = 197, + ImportDeclaration = 199, >ImportDeclaration : SyntaxKind - ExportAssignment = 198, + ExportAssignment = 200, >ExportAssignment : SyntaxKind - ExternalModuleReference = 199, + ExternalModuleReference = 201, >ExternalModuleReference : SyntaxKind - CaseClause = 200, + CaseClause = 202, >CaseClause : SyntaxKind - DefaultClause = 201, + DefaultClause = 203, >DefaultClause : SyntaxKind - HeritageClause = 202, + HeritageClause = 204, >HeritageClause : SyntaxKind - CatchClause = 203, + CatchClause = 205, >CatchClause : SyntaxKind - PropertyAssignment = 204, + PropertyAssignment = 206, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 205, + ShorthandPropertyAssignment = 207, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 206, + EnumMember = 208, >EnumMember : SyntaxKind - SourceFile = 207, + SourceFile = 209, >SourceFile : SyntaxKind - SyntaxList = 208, + SyntaxList = 210, >SyntaxList : SyntaxKind - Count = 209, + Count = 211, >Count : SyntaxKind FirstAssignment = 52, @@ -934,7 +940,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 120, + LastKeyword = 121, >LastKeyword : SyntaxKind FirstFutureReservedWord = 101, @@ -943,10 +949,10 @@ declare module "typescript" { LastFutureReservedWord = 109, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 135, + FirstTypeNode = 136, >FirstTypeNode : SyntaxKind - LastTypeNode = 143, + LastTypeNode = 144, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -985,7 +991,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 121, + FirstNode = 122, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -1966,6 +1972,19 @@ declare module "typescript" { expression: Expression; >expression : Expression +>Expression : Expression + } + interface ForOfStatement extends IterationStatement { +>ForOfStatement : ForOfStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression >Expression : Expression } interface BreakOrContinueStatement extends Statement { diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 27a2ce5e415..2aeede54d51 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -249,105 +249,107 @@ declare module "typescript" { SetKeyword = 118, StringKeyword = 119, TypeKeyword = 120, - QualifiedName = 121, - ComputedPropertyName = 122, - TypeParameter = 123, - Parameter = 124, - PropertySignature = 125, - PropertyDeclaration = 126, - MethodSignature = 127, - MethodDeclaration = 128, - Constructor = 129, - GetAccessor = 130, - SetAccessor = 131, - CallSignature = 132, - ConstructSignature = 133, - IndexSignature = 134, - TypeReference = 135, - FunctionType = 136, - ConstructorType = 137, - TypeQuery = 138, - TypeLiteral = 139, - ArrayType = 140, - TupleType = 141, - UnionType = 142, - ParenthesizedType = 143, - ObjectBindingPattern = 144, - ArrayBindingPattern = 145, - BindingElement = 146, - ArrayLiteralExpression = 147, - ObjectLiteralExpression = 148, - PropertyAccessExpression = 149, - ElementAccessExpression = 150, - CallExpression = 151, - NewExpression = 152, - TaggedTemplateExpression = 153, - TypeAssertionExpression = 154, - ParenthesizedExpression = 155, - FunctionExpression = 156, - ArrowFunction = 157, - DeleteExpression = 158, - TypeOfExpression = 159, - VoidExpression = 160, - PrefixUnaryExpression = 161, - PostfixUnaryExpression = 162, - BinaryExpression = 163, - ConditionalExpression = 164, - TemplateExpression = 165, - YieldExpression = 166, - SpreadElementExpression = 167, - OmittedExpression = 168, - TemplateSpan = 169, - Block = 170, - VariableStatement = 171, - EmptyStatement = 172, - ExpressionStatement = 173, - IfStatement = 174, - DoStatement = 175, - WhileStatement = 176, - ForStatement = 177, - ForInStatement = 178, - ContinueStatement = 179, - BreakStatement = 180, - ReturnStatement = 181, - WithStatement = 182, - SwitchStatement = 183, - LabeledStatement = 184, - ThrowStatement = 185, - TryStatement = 186, - DebuggerStatement = 187, - VariableDeclaration = 188, - VariableDeclarationList = 189, - FunctionDeclaration = 190, - ClassDeclaration = 191, - InterfaceDeclaration = 192, - TypeAliasDeclaration = 193, - EnumDeclaration = 194, - ModuleDeclaration = 195, - ModuleBlock = 196, - ImportDeclaration = 197, - ExportAssignment = 198, - ExternalModuleReference = 199, - CaseClause = 200, - DefaultClause = 201, - HeritageClause = 202, - CatchClause = 203, - PropertyAssignment = 204, - ShorthandPropertyAssignment = 205, - EnumMember = 206, - SourceFile = 207, - SyntaxList = 208, - Count = 209, + OfKeyword = 121, + QualifiedName = 122, + ComputedPropertyName = 123, + TypeParameter = 124, + Parameter = 125, + PropertySignature = 126, + PropertyDeclaration = 127, + MethodSignature = 128, + MethodDeclaration = 129, + Constructor = 130, + GetAccessor = 131, + SetAccessor = 132, + CallSignature = 133, + ConstructSignature = 134, + IndexSignature = 135, + TypeReference = 136, + FunctionType = 137, + ConstructorType = 138, + TypeQuery = 139, + TypeLiteral = 140, + ArrayType = 141, + TupleType = 142, + UnionType = 143, + ParenthesizedType = 144, + ObjectBindingPattern = 145, + ArrayBindingPattern = 146, + BindingElement = 147, + ArrayLiteralExpression = 148, + ObjectLiteralExpression = 149, + PropertyAccessExpression = 150, + ElementAccessExpression = 151, + CallExpression = 152, + NewExpression = 153, + TaggedTemplateExpression = 154, + TypeAssertionExpression = 155, + ParenthesizedExpression = 156, + FunctionExpression = 157, + ArrowFunction = 158, + DeleteExpression = 159, + TypeOfExpression = 160, + VoidExpression = 161, + PrefixUnaryExpression = 162, + PostfixUnaryExpression = 163, + BinaryExpression = 164, + ConditionalExpression = 165, + TemplateExpression = 166, + YieldExpression = 167, + SpreadElementExpression = 168, + OmittedExpression = 169, + TemplateSpan = 170, + Block = 171, + VariableStatement = 172, + EmptyStatement = 173, + ExpressionStatement = 174, + IfStatement = 175, + DoStatement = 176, + WhileStatement = 177, + ForStatement = 178, + ForInStatement = 179, + ForOfStatement = 180, + ContinueStatement = 181, + BreakStatement = 182, + ReturnStatement = 183, + WithStatement = 184, + SwitchStatement = 185, + LabeledStatement = 186, + ThrowStatement = 187, + TryStatement = 188, + DebuggerStatement = 189, + VariableDeclaration = 190, + VariableDeclarationList = 191, + FunctionDeclaration = 192, + ClassDeclaration = 193, + InterfaceDeclaration = 194, + TypeAliasDeclaration = 195, + EnumDeclaration = 196, + ModuleDeclaration = 197, + ModuleBlock = 198, + ImportDeclaration = 199, + ExportAssignment = 200, + ExternalModuleReference = 201, + CaseClause = 202, + DefaultClause = 203, + HeritageClause = 204, + CatchClause = 205, + PropertyAssignment = 206, + ShorthandPropertyAssignment = 207, + EnumMember = 208, + SourceFile = 209, + SyntaxList = 210, + Count = 211, FirstAssignment = 52, LastAssignment = 63, FirstReservedWord = 65, LastReservedWord = 100, FirstKeyword = 65, - LastKeyword = 120, + LastKeyword = 121, FirstFutureReservedWord = 101, LastFutureReservedWord = 109, - FirstTypeNode = 135, - LastTypeNode = 143, + FirstTypeNode = 136, + LastTypeNode = 144, FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, @@ -360,7 +362,7 @@ declare module "typescript" { LastTemplateToken = 13, FirstBinaryOperator = 24, LastBinaryOperator = 63, - FirstNode = 121, + FirstNode = 122, } const enum NodeFlags { Export = 1, @@ -691,6 +693,10 @@ declare module "typescript" { initializer: VariableDeclarationList | Expression; expression: Expression; } + interface ForOfStatement extends IterationStatement { + initializer: VariableDeclarationList | Expression; + expression: Expression; + } interface BreakOrContinueStatement extends Statement { label?: Identifier; } diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 4e137cae59d..bcf11cc6df4 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -825,271 +825,277 @@ declare module "typescript" { TypeKeyword = 120, >TypeKeyword : SyntaxKind - QualifiedName = 121, + OfKeyword = 121, +>OfKeyword : SyntaxKind + + QualifiedName = 122, >QualifiedName : SyntaxKind - ComputedPropertyName = 122, + ComputedPropertyName = 123, >ComputedPropertyName : SyntaxKind - TypeParameter = 123, + TypeParameter = 124, >TypeParameter : SyntaxKind - Parameter = 124, + Parameter = 125, >Parameter : SyntaxKind - PropertySignature = 125, + PropertySignature = 126, >PropertySignature : SyntaxKind - PropertyDeclaration = 126, + PropertyDeclaration = 127, >PropertyDeclaration : SyntaxKind - MethodSignature = 127, + MethodSignature = 128, >MethodSignature : SyntaxKind - MethodDeclaration = 128, + MethodDeclaration = 129, >MethodDeclaration : SyntaxKind - Constructor = 129, + Constructor = 130, >Constructor : SyntaxKind - GetAccessor = 130, + GetAccessor = 131, >GetAccessor : SyntaxKind - SetAccessor = 131, + SetAccessor = 132, >SetAccessor : SyntaxKind - CallSignature = 132, + CallSignature = 133, >CallSignature : SyntaxKind - ConstructSignature = 133, + ConstructSignature = 134, >ConstructSignature : SyntaxKind - IndexSignature = 134, + IndexSignature = 135, >IndexSignature : SyntaxKind - TypeReference = 135, + TypeReference = 136, >TypeReference : SyntaxKind - FunctionType = 136, + FunctionType = 137, >FunctionType : SyntaxKind - ConstructorType = 137, + ConstructorType = 138, >ConstructorType : SyntaxKind - TypeQuery = 138, + TypeQuery = 139, >TypeQuery : SyntaxKind - TypeLiteral = 139, + TypeLiteral = 140, >TypeLiteral : SyntaxKind - ArrayType = 140, + ArrayType = 141, >ArrayType : SyntaxKind - TupleType = 141, + TupleType = 142, >TupleType : SyntaxKind - UnionType = 142, + UnionType = 143, >UnionType : SyntaxKind - ParenthesizedType = 143, + ParenthesizedType = 144, >ParenthesizedType : SyntaxKind - ObjectBindingPattern = 144, + ObjectBindingPattern = 145, >ObjectBindingPattern : SyntaxKind - ArrayBindingPattern = 145, + ArrayBindingPattern = 146, >ArrayBindingPattern : SyntaxKind - BindingElement = 146, + BindingElement = 147, >BindingElement : SyntaxKind - ArrayLiteralExpression = 147, + ArrayLiteralExpression = 148, >ArrayLiteralExpression : SyntaxKind - ObjectLiteralExpression = 148, + ObjectLiteralExpression = 149, >ObjectLiteralExpression : SyntaxKind - PropertyAccessExpression = 149, + PropertyAccessExpression = 150, >PropertyAccessExpression : SyntaxKind - ElementAccessExpression = 150, + ElementAccessExpression = 151, >ElementAccessExpression : SyntaxKind - CallExpression = 151, + CallExpression = 152, >CallExpression : SyntaxKind - NewExpression = 152, + NewExpression = 153, >NewExpression : SyntaxKind - TaggedTemplateExpression = 153, + TaggedTemplateExpression = 154, >TaggedTemplateExpression : SyntaxKind - TypeAssertionExpression = 154, + TypeAssertionExpression = 155, >TypeAssertionExpression : SyntaxKind - ParenthesizedExpression = 155, + ParenthesizedExpression = 156, >ParenthesizedExpression : SyntaxKind - FunctionExpression = 156, + FunctionExpression = 157, >FunctionExpression : SyntaxKind - ArrowFunction = 157, + ArrowFunction = 158, >ArrowFunction : SyntaxKind - DeleteExpression = 158, + DeleteExpression = 159, >DeleteExpression : SyntaxKind - TypeOfExpression = 159, + TypeOfExpression = 160, >TypeOfExpression : SyntaxKind - VoidExpression = 160, + VoidExpression = 161, >VoidExpression : SyntaxKind - PrefixUnaryExpression = 161, + PrefixUnaryExpression = 162, >PrefixUnaryExpression : SyntaxKind - PostfixUnaryExpression = 162, + PostfixUnaryExpression = 163, >PostfixUnaryExpression : SyntaxKind - BinaryExpression = 163, + BinaryExpression = 164, >BinaryExpression : SyntaxKind - ConditionalExpression = 164, + ConditionalExpression = 165, >ConditionalExpression : SyntaxKind - TemplateExpression = 165, + TemplateExpression = 166, >TemplateExpression : SyntaxKind - YieldExpression = 166, + YieldExpression = 167, >YieldExpression : SyntaxKind - SpreadElementExpression = 167, + SpreadElementExpression = 168, >SpreadElementExpression : SyntaxKind - OmittedExpression = 168, + OmittedExpression = 169, >OmittedExpression : SyntaxKind - TemplateSpan = 169, + TemplateSpan = 170, >TemplateSpan : SyntaxKind - Block = 170, + Block = 171, >Block : SyntaxKind - VariableStatement = 171, + VariableStatement = 172, >VariableStatement : SyntaxKind - EmptyStatement = 172, + EmptyStatement = 173, >EmptyStatement : SyntaxKind - ExpressionStatement = 173, + ExpressionStatement = 174, >ExpressionStatement : SyntaxKind - IfStatement = 174, + IfStatement = 175, >IfStatement : SyntaxKind - DoStatement = 175, + DoStatement = 176, >DoStatement : SyntaxKind - WhileStatement = 176, + WhileStatement = 177, >WhileStatement : SyntaxKind - ForStatement = 177, + ForStatement = 178, >ForStatement : SyntaxKind - ForInStatement = 178, + ForInStatement = 179, >ForInStatement : SyntaxKind - ContinueStatement = 179, + ForOfStatement = 180, +>ForOfStatement : SyntaxKind + + ContinueStatement = 181, >ContinueStatement : SyntaxKind - BreakStatement = 180, + BreakStatement = 182, >BreakStatement : SyntaxKind - ReturnStatement = 181, + ReturnStatement = 183, >ReturnStatement : SyntaxKind - WithStatement = 182, + WithStatement = 184, >WithStatement : SyntaxKind - SwitchStatement = 183, + SwitchStatement = 185, >SwitchStatement : SyntaxKind - LabeledStatement = 184, + LabeledStatement = 186, >LabeledStatement : SyntaxKind - ThrowStatement = 185, + ThrowStatement = 187, >ThrowStatement : SyntaxKind - TryStatement = 186, + TryStatement = 188, >TryStatement : SyntaxKind - DebuggerStatement = 187, + DebuggerStatement = 189, >DebuggerStatement : SyntaxKind - VariableDeclaration = 188, + VariableDeclaration = 190, >VariableDeclaration : SyntaxKind - VariableDeclarationList = 189, + VariableDeclarationList = 191, >VariableDeclarationList : SyntaxKind - FunctionDeclaration = 190, + FunctionDeclaration = 192, >FunctionDeclaration : SyntaxKind - ClassDeclaration = 191, + ClassDeclaration = 193, >ClassDeclaration : SyntaxKind - InterfaceDeclaration = 192, + InterfaceDeclaration = 194, >InterfaceDeclaration : SyntaxKind - TypeAliasDeclaration = 193, + TypeAliasDeclaration = 195, >TypeAliasDeclaration : SyntaxKind - EnumDeclaration = 194, + EnumDeclaration = 196, >EnumDeclaration : SyntaxKind - ModuleDeclaration = 195, + ModuleDeclaration = 197, >ModuleDeclaration : SyntaxKind - ModuleBlock = 196, + ModuleBlock = 198, >ModuleBlock : SyntaxKind - ImportDeclaration = 197, + ImportDeclaration = 199, >ImportDeclaration : SyntaxKind - ExportAssignment = 198, + ExportAssignment = 200, >ExportAssignment : SyntaxKind - ExternalModuleReference = 199, + ExternalModuleReference = 201, >ExternalModuleReference : SyntaxKind - CaseClause = 200, + CaseClause = 202, >CaseClause : SyntaxKind - DefaultClause = 201, + DefaultClause = 203, >DefaultClause : SyntaxKind - HeritageClause = 202, + HeritageClause = 204, >HeritageClause : SyntaxKind - CatchClause = 203, + CatchClause = 205, >CatchClause : SyntaxKind - PropertyAssignment = 204, + PropertyAssignment = 206, >PropertyAssignment : SyntaxKind - ShorthandPropertyAssignment = 205, + ShorthandPropertyAssignment = 207, >ShorthandPropertyAssignment : SyntaxKind - EnumMember = 206, + EnumMember = 208, >EnumMember : SyntaxKind - SourceFile = 207, + SourceFile = 209, >SourceFile : SyntaxKind - SyntaxList = 208, + SyntaxList = 210, >SyntaxList : SyntaxKind - Count = 209, + Count = 211, >Count : SyntaxKind FirstAssignment = 52, @@ -1107,7 +1113,7 @@ declare module "typescript" { FirstKeyword = 65, >FirstKeyword : SyntaxKind - LastKeyword = 120, + LastKeyword = 121, >LastKeyword : SyntaxKind FirstFutureReservedWord = 101, @@ -1116,10 +1122,10 @@ declare module "typescript" { LastFutureReservedWord = 109, >LastFutureReservedWord : SyntaxKind - FirstTypeNode = 135, + FirstTypeNode = 136, >FirstTypeNode : SyntaxKind - LastTypeNode = 143, + LastTypeNode = 144, >LastTypeNode : SyntaxKind FirstPunctuation = 14, @@ -1158,7 +1164,7 @@ declare module "typescript" { LastBinaryOperator = 63, >LastBinaryOperator : SyntaxKind - FirstNode = 121, + FirstNode = 122, >FirstNode : SyntaxKind } const enum NodeFlags { @@ -2139,6 +2145,19 @@ declare module "typescript" { expression: Expression; >expression : Expression +>Expression : Expression + } + interface ForOfStatement extends IterationStatement { +>ForOfStatement : ForOfStatement +>IterationStatement : IterationStatement + + initializer: VariableDeclarationList | Expression; +>initializer : Expression | VariableDeclarationList +>VariableDeclarationList : VariableDeclarationList +>Expression : Expression + + expression: Expression; +>expression : Expression >Expression : Expression } interface BreakOrContinueStatement extends Statement { From 1a3294a7d246ce1fb3d073dd8388f6ce1426d1b5 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 17 Feb 2015 12:37:14 -0800 Subject: [PATCH 120/162] Parity sweep for for-in & for-of --- src/compiler/binder.ts | 1 + src/compiler/checker.ts | 42 +++++++++++++------ .../diagnosticInformationMap.generated.ts | 2 +- src/compiler/diagnosticMessages.json | 2 +- src/compiler/parser.ts | 3 +- src/compiler/utilities.ts | 5 ++- src/services/breakpoints.ts | 7 +++- src/services/formatting/rules.ts | 1 + src/services/formatting/smartIndenter.ts | 1 + src/services/outliningElementsCollector.ts | 1 + src/services/services.ts | 6 ++- 11 files changed, 51 insertions(+), 20 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index be9e9a525c0..037892bf972 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -495,6 +495,7 @@ module ts { case SyntaxKind.CatchClause: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.SwitchStatement: bindChildren(node, 0, /*isBlockScopeContainer*/ true); break; diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index caf07cbf4dc..3e6ac9ffe2e 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4612,6 +4612,7 @@ module ts { case SyntaxKind.WhileStatement: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.ReturnStatement: case SyntaxKind.WithStatement: case SyntaxKind.SwitchStatement: @@ -8449,23 +8450,12 @@ module ts { function checkForOfStatement(node: ForOfStatement) { // TODO: not yet implemented - if (!checkGrammarForStatementInAmbientContext(node)) { - checkGrammarForOfStatement(node); - } + checkGrammarForOfStatement(node); } function checkForInStatement(node: ForInStatement) { // Grammar checking - if (!checkGrammarForStatementInAmbientContext(node)) { - if (node.initializer.kind === SyntaxKind.VariableDeclarationList) { - var variableList = node.initializer; - if (!checkGrammarVariableDeclarationList(variableList)) { - if (variableList.declarations.length > 1) { - grammarErrorOnFirstToken(variableList.declarations[1], Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement); - } - } - } - } + checkGrammarForInOrForOfStatement(node); // TypeScript 1.0 spec (April 2014): 5.4 // In a 'for-in' statement of the form @@ -9568,6 +9558,7 @@ module ts { case SyntaxKind.WhileStatement: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.ContinueStatement: case SyntaxKind.BreakStatement: case SyntaxKind.ReturnStatement: @@ -10764,10 +10755,33 @@ module ts { } } + function checkGrammarForInOrForOfStatement(forInOrOfStatement: ForInStatement | ForOfStatement): boolean { + if (checkGrammarForStatementInAmbientContext(forInOrOfStatement)) { + return true; + } + + if (forInOrOfStatement.initializer.kind === SyntaxKind.VariableDeclarationList) { + var variableList = forInOrOfStatement.initializer; + if (!checkGrammarVariableDeclarationList(variableList)) { + if (variableList.declarations.length > 1) { + var keywordText = forInOrOfStatement.kind === SyntaxKind.ForInStatement ? "in" : "of"; + return grammarErrorOnFirstToken(variableList.declarations[1], Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_0_statement, keywordText); + } + } + } + + return false; + } + function checkGrammarForOfStatement(forOfStatement: ForOfStatement): boolean { + if (checkGrammarForInOrForOfStatement(forOfStatement)) { + return true; + } if (languageVersion < ScriptTarget.ES6) { return grammarErrorOnFirstToken(forOfStatement, Diagnostics.For_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); } + + return false; } function checkGrammarAccessor(accessor: MethodDeclaration): boolean { @@ -10862,6 +10876,7 @@ module ts { switch (node.kind) { case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.DoStatement: case SyntaxKind.WhileStatement: return true; @@ -11018,6 +11033,7 @@ module ts { case SyntaxKind.WithStatement: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: return false; case SyntaxKind.LabeledStatement: return allowLetAndConstDeclarations(parent.parent); diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index a661f53ddfc..b9b407eb1d5 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -55,7 +55,7 @@ module ts { An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: DiagnosticCategory.Error, key: "An accessor cannot be declared in an ambient context." }, _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a constructor declaration." }, _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a parameter." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_0_statement: { code: 1091, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...{0}' statement." }, Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: DiagnosticCategory.Error, key: "Type parameters cannot appear on a constructor declaration." }, Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: DiagnosticCategory.Error, key: "Type annotation cannot appear on a constructor declaration." }, An_accessor_cannot_have_type_parameters: { code: 1094, category: DiagnosticCategory.Error, key: "An accessor cannot have type parameters." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index d59d4fe0d8e..b59bd229e62 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -211,7 +211,7 @@ "category": "Error", "code": 1090 }, - "Only a single variable declaration is allowed in a 'for...in' statement.": { + "Only a single variable declaration is allowed in a 'for...{0}' statement.": { "category": "Error", "code": 1091 }, diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 64f9560999b..d40101aacc3 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -1602,7 +1602,7 @@ module ts { } // in the case where we're parsing the variable declarator of a 'for-in' statement, we - // are done if we see an 'in' keyword in front of us. + // are done if we see an 'in' keyword in front of us. Same with for-of if (isInOrOfKeyword(token)) { return true; } @@ -1881,6 +1881,7 @@ module ts { case SyntaxKind.BreakStatement: case SyntaxKind.ContinueStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.ForStatement: case SyntaxKind.WhileStatement: case SyntaxKind.WithStatement: diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 5a50e2799dc..d3a7392c2bc 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -343,6 +343,7 @@ module ts { case SyntaxKind.WhileStatement: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.WithStatement: case SyntaxKind.SwitchStatement: case SyntaxKind.CaseClause: @@ -560,7 +561,8 @@ module ts { forStatement.condition === node || forStatement.iterator === node; case SyntaxKind.ForInStatement: - var forInStatement = parent; + case SyntaxKind.ForOfStatement: + var forInStatement = parent; return (forInStatement.initializer === node && forInStatement.initializer.kind !== SyntaxKind.VariableDeclarationList) || forInStatement.expression === node; case SyntaxKind.TypeAssertionExpression: @@ -688,6 +690,7 @@ module ts { case SyntaxKind.ExpressionStatement: case SyntaxKind.EmptyStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.ForStatement: case SyntaxKind.IfStatement: case SyntaxKind.LabeledStatement: diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index e49d035559b..86b72b711c1 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -151,8 +151,9 @@ module ts.BreakpointResolver { return spanInForStatement(node); case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: // span on for (a in ...) - return textSpan(node, findNextToken((node).expression, node)); + return textSpan(node, findNextToken((node).expression, node)); case SyntaxKind.SwitchStatement: // span on switch(...) @@ -261,7 +262,8 @@ module ts.BreakpointResolver { function spanInVariableDeclaration(variableDeclaration: VariableDeclaration): TextSpan { // If declaration of for in statement, just set the span in parent - if (variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement) { + if (variableDeclaration.parent.parent.kind === SyntaxKind.ForInStatement || + variableDeclaration.parent.parent.kind === SyntaxKind.ForOfStatement) { return spanInNode(variableDeclaration.parent.parent); } @@ -362,6 +364,7 @@ module ts.BreakpointResolver { case SyntaxKind.WhileStatement: case SyntaxKind.IfStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]); // Set span on previous token if it starts on same line otherwise on the first statement of the block diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index 9fcc787030d..bf7e3f3988a 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -592,6 +592,7 @@ module ts.formatting { case SyntaxKind.SwitchStatement: case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.WhileStatement: case SyntaxKind.TryStatement: case SyntaxKind.DoStatement: diff --git a/src/services/formatting/smartIndenter.ts b/src/services/formatting/smartIndenter.ts index 3aa97fe6ae6..8d7d96e5887 100644 --- a/src/services/formatting/smartIndenter.ts +++ b/src/services/formatting/smartIndenter.ts @@ -359,6 +359,7 @@ module ts.formatting { case SyntaxKind.DoStatement: case SyntaxKind.WhileStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.ForStatement: case SyntaxKind.IfStatement: case SyntaxKind.FunctionDeclaration: diff --git a/src/services/outliningElementsCollector.ts b/src/services/outliningElementsCollector.ts index 0b39f54ca29..b65ad7e36c8 100644 --- a/src/services/outliningElementsCollector.ts +++ b/src/services/outliningElementsCollector.ts @@ -61,6 +61,7 @@ module ts { // to be the entire span of the parent. if (parent.kind === SyntaxKind.DoStatement || parent.kind === SyntaxKind.ForInStatement || + parent.kind === SyntaxKind.ForOfStatement || parent.kind === SyntaxKind.ForStatement || parent.kind === SyntaxKind.IfStatement || parent.kind === SyntaxKind.WhileStatement || diff --git a/src/services/services.ts b/src/services/services.ts index 767d1a7f099..c1528fe67cf 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3441,7 +3441,9 @@ module ts { } break; case SyntaxKind.ForKeyword: - if (hasKind(node.parent, SyntaxKind.ForStatement) || hasKind(node.parent, SyntaxKind.ForInStatement)) { + if (hasKind(node.parent, SyntaxKind.ForStatement) || + hasKind(node.parent, SyntaxKind.ForInStatement) || + hasKind(node.parent, SyntaxKind.ForOfStatement)) { return getLoopBreakContinueOccurrences(node.parent); } break; @@ -3718,6 +3720,7 @@ module ts { switch (owner.kind) { case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.DoStatement: case SyntaxKind.WhileStatement: return getLoopBreakContinueOccurrences(owner) @@ -3762,6 +3765,7 @@ module ts { // Fall through. case SyntaxKind.ForStatement: case SyntaxKind.ForInStatement: + case SyntaxKind.ForOfStatement: case SyntaxKind.WhileStatement: case SyntaxKind.DoStatement: if (!statement.label || isLabeledBy(node, statement.label.text)) { From 7fe286061d7275ce50582952564f5cb5d2f632f2 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 17 Feb 2015 12:38:10 -0800 Subject: [PATCH 121/162] Add tests for for-of --- .../ecmascript5/Statements/parserES5ForOfStatement1.d.ts | 3 +++ .../parser/ecmascript5/Statements/parserES5ForOfStatement10.ts | 3 +++ .../parser/ecmascript5/Statements/parserES5ForOfStatement11.ts | 3 +++ .../parser/ecmascript5/Statements/parserES5ForOfStatement12.ts | 3 +++ .../parser/ecmascript5/Statements/parserES5ForOfStatement13.ts | 3 +++ .../parser/ecmascript5/Statements/parserES5ForOfStatement14.ts | 3 +++ .../parser/ecmascript5/Statements/parserES5ForOfStatement15.ts | 3 +++ .../parser/ecmascript5/Statements/parserES5ForOfStatement16.ts | 3 +++ .../parser/ecmascript5/Statements/parserES5ForOfStatement2.ts | 3 +++ .../parser/ecmascript5/Statements/parserES5ForOfStatement3.ts | 3 +++ .../parser/ecmascript5/Statements/parserES5ForOfStatement4.ts | 3 +++ .../parser/ecmascript5/Statements/parserES5ForOfStatement5.ts | 3 +++ .../parser/ecmascript5/Statements/parserES5ForOfStatement6.ts | 3 +++ .../parser/ecmascript5/Statements/parserES5ForOfStatement7.ts | 3 +++ .../parser/ecmascript5/Statements/parserES5ForOfStatement8.ts | 3 +++ .../parser/ecmascript5/Statements/parserES5ForOfStatement9.ts | 3 +++ .../parser/ecmascript6/Iterators/parserForOfStatement1.d.ts | 3 +++ .../parser/ecmascript6/Iterators/parserForOfStatement10.ts | 3 +++ .../parser/ecmascript6/Iterators/parserForOfStatement11.ts | 3 +++ .../parser/ecmascript6/Iterators/parserForOfStatement12.ts | 3 +++ .../parser/ecmascript6/Iterators/parserForOfStatement13.ts | 3 +++ .../parser/ecmascript6/Iterators/parserForOfStatement14.ts | 3 +++ .../parser/ecmascript6/Iterators/parserForOfStatement15.ts | 3 +++ .../parser/ecmascript6/Iterators/parserForOfStatement16.ts | 3 +++ .../parser/ecmascript6/Iterators/parserForOfStatement2.ts | 3 +++ .../parser/ecmascript6/Iterators/parserForOfStatement3.ts | 3 +++ .../parser/ecmascript6/Iterators/parserForOfStatement4.ts | 3 +++ .../parser/ecmascript6/Iterators/parserForOfStatement5.ts | 3 +++ .../parser/ecmascript6/Iterators/parserForOfStatement6.ts | 3 +++ .../parser/ecmascript6/Iterators/parserForOfStatement7.ts | 3 +++ .../parser/ecmascript6/Iterators/parserForOfStatement8.ts | 3 +++ .../parser/ecmascript6/Iterators/parserForOfStatement9.ts | 3 +++ 32 files changed, 96 insertions(+) create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts new file mode 100644 index 00000000000..8f9a4072f42 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var i of e) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts new file mode 100644 index 00000000000..3a6f932e821 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (const v of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts new file mode 100644 index 00000000000..94ca9330ab0 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (const [a, b] of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts new file mode 100644 index 00000000000..7d4655e4b36 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (const {a, b} of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts new file mode 100644 index 00000000000..7a11d2e073e --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (let {a, b} of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts new file mode 100644 index 00000000000..c39939a1a08 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (let [a, b] of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts new file mode 100644 index 00000000000..95c5c2c53ee --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var [a, b] of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts new file mode 100644 index 00000000000..9a68bad827c --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var {a, b} of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts new file mode 100644 index 00000000000..7ef97688115 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts new file mode 100644 index 00000000000..1b183225b74 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var a, b of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts new file mode 100644 index 00000000000..a99b69a2f4a --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var a = 1 of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts new file mode 100644 index 00000000000..c3c434b605c --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var a: number of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts new file mode 100644 index 00000000000..4e03b361e73 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var a = 1, b = 2 of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts new file mode 100644 index 00000000000..8340bab563b --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var a: number = 1, b: string = "" of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts new file mode 100644 index 00000000000..39ecbcfbcb3 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (var v of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts new file mode 100644 index 00000000000..63fe58a93f8 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts @@ -0,0 +1,3 @@ +//@target: ES5 +for (let v of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts new file mode 100644 index 00000000000..9248d2fb45c --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var i of e) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts new file mode 100644 index 00000000000..9febb87d74f --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (const v of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts new file mode 100644 index 00000000000..dbcf40c36ab --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (const [a, b] of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts new file mode 100644 index 00000000000..8bb57d3a356 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (const {a, b} of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts new file mode 100644 index 00000000000..5da8edc65c4 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (let {a, b} of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts new file mode 100644 index 00000000000..ddd1216471f --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (let [a, b] of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts new file mode 100644 index 00000000000..43e18b460ca --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var [a, b] of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts new file mode 100644 index 00000000000..e042179fbba --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var {a, b} of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts new file mode 100644 index 00000000000..8274876781d --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts new file mode 100644 index 00000000000..d16c99e6c3d --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var a, b of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts new file mode 100644 index 00000000000..f7cd4b34d26 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var a = 1 of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts new file mode 100644 index 00000000000..789e5f9725d --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var a: number of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts new file mode 100644 index 00000000000..946e5ba1574 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var a = 1, b = 2 of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts new file mode 100644 index 00000000000..e7e56f74c4e --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var a: number = 1, b: string = "" of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts new file mode 100644 index 00000000000..7a528a9898e --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (var v of X) { +} \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts new file mode 100644 index 00000000000..741a56a8cf7 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts @@ -0,0 +1,3 @@ +//@target: ES6 +for (let v of X) { +} \ No newline at end of file From 8d0829594c239d0d7f251f96aa4edb5dca12ed70 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 17 Feb 2015 12:38:21 -0800 Subject: [PATCH 122/162] Accept baselines for added tests --- .../reference/parserES5ForOfStatement1.d.errors.txt | 8 ++++++++ .../reference/parserES5ForOfStatement10.errors.txt | 11 +++++++++++ .../baselines/reference/parserES5ForOfStatement10.js | 7 +++++++ .../reference/parserES5ForOfStatement11.errors.txt | 11 +++++++++++ .../baselines/reference/parserES5ForOfStatement11.js | 7 +++++++ .../reference/parserES5ForOfStatement12.errors.txt | 11 +++++++++++ .../baselines/reference/parserES5ForOfStatement12.js | 7 +++++++ .../reference/parserES5ForOfStatement13.errors.txt | 11 +++++++++++ .../baselines/reference/parserES5ForOfStatement13.js | 7 +++++++ .../reference/parserES5ForOfStatement14.errors.txt | 11 +++++++++++ .../baselines/reference/parserES5ForOfStatement14.js | 7 +++++++ .../reference/parserES5ForOfStatement15.errors.txt | 8 ++++++++ .../baselines/reference/parserES5ForOfStatement15.js | 7 +++++++ .../reference/parserES5ForOfStatement16.errors.txt | 8 ++++++++ .../baselines/reference/parserES5ForOfStatement16.js | 7 +++++++ .../reference/parserES5ForOfStatement3.errors.txt | 8 ++++++++ tests/baselines/reference/parserES5ForOfStatement3.js | 7 +++++++ .../reference/parserES5ForOfStatement4.errors.txt | 8 ++++++++ tests/baselines/reference/parserES5ForOfStatement4.js | 7 +++++++ .../reference/parserES5ForOfStatement5.errors.txt | 8 ++++++++ tests/baselines/reference/parserES5ForOfStatement5.js | 7 +++++++ .../reference/parserES5ForOfStatement6.errors.txt | 8 ++++++++ tests/baselines/reference/parserES5ForOfStatement6.js | 7 +++++++ .../reference/parserES5ForOfStatement7.errors.txt | 8 ++++++++ tests/baselines/reference/parserES5ForOfStatement7.js | 7 +++++++ .../reference/parserES5ForOfStatement8.errors.txt | 8 ++++++++ tests/baselines/reference/parserES5ForOfStatement8.js | 7 +++++++ .../reference/parserES5ForOfStatement9.errors.txt | 11 +++++++++++ tests/baselines/reference/parserES5ForOfStatement9.js | 7 +++++++ .../reference/parserForOfStatement1.d.errors.txt | 8 ++++++++ tests/baselines/reference/parserForOfStatement10.js | 7 +++++++ .../baselines/reference/parserForOfStatement10.types | 5 +++++ tests/baselines/reference/parserForOfStatement11.js | 7 +++++++ .../baselines/reference/parserForOfStatement11.types | 6 ++++++ tests/baselines/reference/parserForOfStatement12.js | 7 +++++++ .../baselines/reference/parserForOfStatement12.types | 6 ++++++ tests/baselines/reference/parserForOfStatement13.js | 7 +++++++ .../baselines/reference/parserForOfStatement13.types | 6 ++++++ tests/baselines/reference/parserForOfStatement14.js | 7 +++++++ .../baselines/reference/parserForOfStatement14.types | 6 ++++++ tests/baselines/reference/parserForOfStatement15.js | 7 +++++++ .../baselines/reference/parserForOfStatement15.types | 6 ++++++ tests/baselines/reference/parserForOfStatement16.js | 7 +++++++ .../baselines/reference/parserForOfStatement16.types | 6 ++++++ .../reference/parserForOfStatement3.errors.txt | 8 ++++++++ tests/baselines/reference/parserForOfStatement3.js | 7 +++++++ tests/baselines/reference/parserForOfStatement4.js | 7 +++++++ tests/baselines/reference/parserForOfStatement5.js | 7 +++++++ .../reference/parserForOfStatement6.errors.txt | 8 ++++++++ tests/baselines/reference/parserForOfStatement6.js | 7 +++++++ .../reference/parserForOfStatement7.errors.txt | 8 ++++++++ tests/baselines/reference/parserForOfStatement7.js | 7 +++++++ tests/baselines/reference/parserForOfStatement8.js | 7 +++++++ tests/baselines/reference/parserForOfStatement8.types | 5 +++++ tests/baselines/reference/parserForOfStatement9.js | 7 +++++++ tests/baselines/reference/parserForOfStatement9.types | 5 +++++ 56 files changed, 417 insertions(+) create mode 100644 tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement10.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement10.js create mode 100644 tests/baselines/reference/parserES5ForOfStatement11.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement11.js create mode 100644 tests/baselines/reference/parserES5ForOfStatement12.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement12.js create mode 100644 tests/baselines/reference/parserES5ForOfStatement13.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement13.js create mode 100644 tests/baselines/reference/parserES5ForOfStatement14.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement14.js create mode 100644 tests/baselines/reference/parserES5ForOfStatement15.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement15.js create mode 100644 tests/baselines/reference/parserES5ForOfStatement16.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement16.js create mode 100644 tests/baselines/reference/parserES5ForOfStatement3.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement3.js create mode 100644 tests/baselines/reference/parserES5ForOfStatement4.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement4.js create mode 100644 tests/baselines/reference/parserES5ForOfStatement5.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement5.js create mode 100644 tests/baselines/reference/parserES5ForOfStatement6.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement6.js create mode 100644 tests/baselines/reference/parserES5ForOfStatement7.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement7.js create mode 100644 tests/baselines/reference/parserES5ForOfStatement8.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement8.js create mode 100644 tests/baselines/reference/parserES5ForOfStatement9.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement9.js create mode 100644 tests/baselines/reference/parserForOfStatement1.d.errors.txt create mode 100644 tests/baselines/reference/parserForOfStatement10.js create mode 100644 tests/baselines/reference/parserForOfStatement10.types create mode 100644 tests/baselines/reference/parserForOfStatement11.js create mode 100644 tests/baselines/reference/parserForOfStatement11.types create mode 100644 tests/baselines/reference/parserForOfStatement12.js create mode 100644 tests/baselines/reference/parserForOfStatement12.types create mode 100644 tests/baselines/reference/parserForOfStatement13.js create mode 100644 tests/baselines/reference/parserForOfStatement13.types create mode 100644 tests/baselines/reference/parserForOfStatement14.js create mode 100644 tests/baselines/reference/parserForOfStatement14.types create mode 100644 tests/baselines/reference/parserForOfStatement15.js create mode 100644 tests/baselines/reference/parserForOfStatement15.types create mode 100644 tests/baselines/reference/parserForOfStatement16.js create mode 100644 tests/baselines/reference/parserForOfStatement16.types create mode 100644 tests/baselines/reference/parserForOfStatement3.errors.txt create mode 100644 tests/baselines/reference/parserForOfStatement3.js create mode 100644 tests/baselines/reference/parserForOfStatement4.js create mode 100644 tests/baselines/reference/parserForOfStatement5.js create mode 100644 tests/baselines/reference/parserForOfStatement6.errors.txt create mode 100644 tests/baselines/reference/parserForOfStatement6.js create mode 100644 tests/baselines/reference/parserForOfStatement7.errors.txt create mode 100644 tests/baselines/reference/parserForOfStatement7.js create mode 100644 tests/baselines/reference/parserForOfStatement8.js create mode 100644 tests/baselines/reference/parserForOfStatement8.types create mode 100644 tests/baselines/reference/parserForOfStatement9.js create mode 100644 tests/baselines/reference/parserForOfStatement9.types diff --git a/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt b/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt new file mode 100644 index 00000000000..f3034cd2c27 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts(1,1): error TS1036: Statements are not allowed in ambient contexts. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts (1 errors) ==== + for (var i of e) { + ~~~ +!!! error TS1036: Statements are not allowed in ambient contexts. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement10.errors.txt b/tests/baselines/reference/parserES5ForOfStatement10.errors.txt new file mode 100644 index 00000000000..7fdbe80e12e --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement10.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts(1,6): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts (2 errors) ==== + for (const v of X) { + ~~~ +!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + ~~~~~ +!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement10.js b/tests/baselines/reference/parserES5ForOfStatement10.js new file mode 100644 index 00000000000..2b9dc843887 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement10.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement10.ts] +for (const v of X) { +} + +//// [parserES5ForOfStatement10.js] +for (var v of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement11.errors.txt b/tests/baselines/reference/parserES5ForOfStatement11.errors.txt new file mode 100644 index 00000000000..146aff8f91b --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement11.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts(1,6): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts (2 errors) ==== + for (const [a, b] of X) { + ~~~ +!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + ~~~~~ +!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement11.js b/tests/baselines/reference/parserES5ForOfStatement11.js new file mode 100644 index 00000000000..45a24b109c0 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement11.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement11.ts] +for (const [a, b] of X) { +} + +//// [parserES5ForOfStatement11.js] +for (var _a = void 0, a = _a[0], b = _a[1] of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement12.errors.txt b/tests/baselines/reference/parserES5ForOfStatement12.errors.txt new file mode 100644 index 00000000000..ea1ad1d8eb7 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement12.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts(1,6): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts (2 errors) ==== + for (const {a, b} of X) { + ~~~ +!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + ~~~~~ +!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement12.js b/tests/baselines/reference/parserES5ForOfStatement12.js new file mode 100644 index 00000000000..30beac5118c --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement12.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement12.ts] +for (const {a, b} of X) { +} + +//// [parserES5ForOfStatement12.js] +for (var _a = void 0, a = _a.a, b = _a.b of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement13.errors.txt b/tests/baselines/reference/parserES5ForOfStatement13.errors.txt new file mode 100644 index 00000000000..27dc44f094a --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement13.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts(1,6): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts (2 errors) ==== + for (let {a, b} of X) { + ~~~ +!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + ~~~ +!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement13.js b/tests/baselines/reference/parserES5ForOfStatement13.js new file mode 100644 index 00000000000..89706613add --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement13.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement13.ts] +for (let {a, b} of X) { +} + +//// [parserES5ForOfStatement13.js] +for (let _a = void 0, a = _a.a, b = _a.b of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement14.errors.txt b/tests/baselines/reference/parserES5ForOfStatement14.errors.txt new file mode 100644 index 00000000000..9eba6e25c9a --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement14.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts(1,6): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts (2 errors) ==== + for (let [a, b] of X) { + ~~~ +!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + ~~~ +!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement14.js b/tests/baselines/reference/parserES5ForOfStatement14.js new file mode 100644 index 00000000000..96aa327a625 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement14.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement14.ts] +for (let [a, b] of X) { +} + +//// [parserES5ForOfStatement14.js] +for (let _a = void 0, a = _a[0], b = _a[1] of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement15.errors.txt b/tests/baselines/reference/parserES5ForOfStatement15.errors.txt new file mode 100644 index 00000000000..2f39244ecd5 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement15.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts (1 errors) ==== + for (var [a, b] of X) { + ~~~ +!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement15.js b/tests/baselines/reference/parserES5ForOfStatement15.js new file mode 100644 index 00000000000..efca0b289f6 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement15.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement15.ts] +for (var [a, b] of X) { +} + +//// [parserES5ForOfStatement15.js] +for (var _a = void 0, a = _a[0], b = _a[1] of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement16.errors.txt b/tests/baselines/reference/parserES5ForOfStatement16.errors.txt new file mode 100644 index 00000000000..80a45c0f8b5 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement16.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts (1 errors) ==== + for (var {a, b} of X) { + ~~~ +!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement16.js b/tests/baselines/reference/parserES5ForOfStatement16.js new file mode 100644 index 00000000000..102e91685c3 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement16.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement16.ts] +for (var {a, b} of X) { +} + +//// [parserES5ForOfStatement16.js] +for (var _a = void 0, a = _a.a, b = _a.b of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement3.errors.txt b/tests/baselines/reference/parserES5ForOfStatement3.errors.txt new file mode 100644 index 00000000000..6209ed2475f --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement3.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,13): error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts (1 errors) ==== + for (var a, b of X) { + ~ +!!! error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement3.js b/tests/baselines/reference/parserES5ForOfStatement3.js new file mode 100644 index 00000000000..64892eb5094 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement3.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement3.ts] +for (var a, b of X) { +} + +//// [parserES5ForOfStatement3.js] +for (var a of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement4.errors.txt b/tests/baselines/reference/parserES5ForOfStatement4.errors.txt new file mode 100644 index 00000000000..36c1894ed78 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement4.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts (1 errors) ==== + for (var a = 1 of X) { + ~~~ +!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement4.js b/tests/baselines/reference/parserES5ForOfStatement4.js new file mode 100644 index 00000000000..e17699a8662 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement4.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement4.ts] +for (var a = 1 of X) { +} + +//// [parserES5ForOfStatement4.js] +for (var a = 1 of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement5.errors.txt b/tests/baselines/reference/parserES5ForOfStatement5.errors.txt new file mode 100644 index 00000000000..55c56d60aae --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement5.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts (1 errors) ==== + for (var a: number of X) { + ~~~ +!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement5.js b/tests/baselines/reference/parserES5ForOfStatement5.js new file mode 100644 index 00000000000..2eeb504365e --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement5.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement5.ts] +for (var a: number of X) { +} + +//// [parserES5ForOfStatement5.js] +for (var a of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement6.errors.txt b/tests/baselines/reference/parserES5ForOfStatement6.errors.txt new file mode 100644 index 00000000000..1bbacc01c9e --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement6.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,17): error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts (1 errors) ==== + for (var a = 1, b = 2 of X) { + ~ +!!! error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement6.js b/tests/baselines/reference/parserES5ForOfStatement6.js new file mode 100644 index 00000000000..575368fcd20 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement6.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement6.ts] +for (var a = 1, b = 2 of X) { +} + +//// [parserES5ForOfStatement6.js] +for (var a = 1 of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement7.errors.txt b/tests/baselines/reference/parserES5ForOfStatement7.errors.txt new file mode 100644 index 00000000000..7d2810f6de7 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement7.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,25): error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts (1 errors) ==== + for (var a: number = 1, b: string = "" of X) { + ~ +!!! error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement7.js b/tests/baselines/reference/parserES5ForOfStatement7.js new file mode 100644 index 00000000000..ac240494c18 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement7.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement7.ts] +for (var a: number = 1, b: string = "" of X) { +} + +//// [parserES5ForOfStatement7.js] +for (var a = 1 of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement8.errors.txt b/tests/baselines/reference/parserES5ForOfStatement8.errors.txt new file mode 100644 index 00000000000..739369e8f82 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement8.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts (1 errors) ==== + for (var v of X) { + ~~~ +!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement8.js b/tests/baselines/reference/parserES5ForOfStatement8.js new file mode 100644 index 00000000000..c926784adfe --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement8.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement8.ts] +for (var v of X) { +} + +//// [parserES5ForOfStatement8.js] +for (var v of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement9.errors.txt b/tests/baselines/reference/parserES5ForOfStatement9.errors.txt new file mode 100644 index 00000000000..c03669fcb98 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement9.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts(1,6): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts (2 errors) ==== + for (let v of X) { + ~~~ +!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + ~~~ +!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement9.js b/tests/baselines/reference/parserES5ForOfStatement9.js new file mode 100644 index 00000000000..e2ec49e9ac9 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement9.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement9.ts] +for (let v of X) { +} + +//// [parserES5ForOfStatement9.js] +for (let v of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement1.d.errors.txt b/tests/baselines/reference/parserForOfStatement1.d.errors.txt new file mode 100644 index 00000000000..3b1b2a65922 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement1.d.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts(1,1): error TS1036: Statements are not allowed in ambient contexts. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts (1 errors) ==== + for (var i of e) { + ~~~ +!!! error TS1036: Statements are not allowed in ambient contexts. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement10.js b/tests/baselines/reference/parserForOfStatement10.js new file mode 100644 index 00000000000..d0b48203090 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement10.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement10.ts] +for (const v of X) { +} + +//// [parserForOfStatement10.js] +for (var v of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement10.types b/tests/baselines/reference/parserForOfStatement10.types new file mode 100644 index 00000000000..1707fa934cb --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement10.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts === +for (const v of X) { +>v : any +>X : unknown +} diff --git a/tests/baselines/reference/parserForOfStatement11.js b/tests/baselines/reference/parserForOfStatement11.js new file mode 100644 index 00000000000..daa3fb6df48 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement11.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement11.ts] +for (const [a, b] of X) { +} + +//// [parserForOfStatement11.js] +for (var [a, b] of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement11.types b/tests/baselines/reference/parserForOfStatement11.types new file mode 100644 index 00000000000..eebc0c6a864 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement11.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts === +for (const [a, b] of X) { +>a : any +>b : any +>X : unknown +} diff --git a/tests/baselines/reference/parserForOfStatement12.js b/tests/baselines/reference/parserForOfStatement12.js new file mode 100644 index 00000000000..2e62b90de5e --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement12.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement12.ts] +for (const {a, b} of X) { +} + +//// [parserForOfStatement12.js] +for (var { a, b } of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement12.types b/tests/baselines/reference/parserForOfStatement12.types new file mode 100644 index 00000000000..51071059db1 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement12.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts === +for (const {a, b} of X) { +>a : any +>b : any +>X : unknown +} diff --git a/tests/baselines/reference/parserForOfStatement13.js b/tests/baselines/reference/parserForOfStatement13.js new file mode 100644 index 00000000000..a9c59046b8e --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement13.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement13.ts] +for (let {a, b} of X) { +} + +//// [parserForOfStatement13.js] +for (let { a, b } of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement13.types b/tests/baselines/reference/parserForOfStatement13.types new file mode 100644 index 00000000000..22c7af5605c --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement13.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts === +for (let {a, b} of X) { +>a : any +>b : any +>X : unknown +} diff --git a/tests/baselines/reference/parserForOfStatement14.js b/tests/baselines/reference/parserForOfStatement14.js new file mode 100644 index 00000000000..e46e2c46ea6 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement14.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement14.ts] +for (let [a, b] of X) { +} + +//// [parserForOfStatement14.js] +for (let [a, b] of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement14.types b/tests/baselines/reference/parserForOfStatement14.types new file mode 100644 index 00000000000..f255015bb15 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement14.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts === +for (let [a, b] of X) { +>a : any +>b : any +>X : unknown +} diff --git a/tests/baselines/reference/parserForOfStatement15.js b/tests/baselines/reference/parserForOfStatement15.js new file mode 100644 index 00000000000..81782393383 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement15.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement15.ts] +for (var [a, b] of X) { +} + +//// [parserForOfStatement15.js] +for (var [a, b] of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement15.types b/tests/baselines/reference/parserForOfStatement15.types new file mode 100644 index 00000000000..bf6faf3478e --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement15.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts === +for (var [a, b] of X) { +>a : any +>b : any +>X : unknown +} diff --git a/tests/baselines/reference/parserForOfStatement16.js b/tests/baselines/reference/parserForOfStatement16.js new file mode 100644 index 00000000000..f0ca1ee3e6d --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement16.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement16.ts] +for (var {a, b} of X) { +} + +//// [parserForOfStatement16.js] +for (var { a, b } of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement16.types b/tests/baselines/reference/parserForOfStatement16.types new file mode 100644 index 00000000000..48476dfae0a --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement16.types @@ -0,0 +1,6 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts === +for (var {a, b} of X) { +>a : any +>b : any +>X : unknown +} diff --git a/tests/baselines/reference/parserForOfStatement3.errors.txt b/tests/baselines/reference/parserForOfStatement3.errors.txt new file mode 100644 index 00000000000..36cd23b0931 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement3.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts(1,13): error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts (1 errors) ==== + for (var a, b of X) { + ~ +!!! error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement3.js b/tests/baselines/reference/parserForOfStatement3.js new file mode 100644 index 00000000000..206e8fe5af8 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement3.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement3.ts] +for (var a, b of X) { +} + +//// [parserForOfStatement3.js] +for (var a of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement4.js b/tests/baselines/reference/parserForOfStatement4.js new file mode 100644 index 00000000000..9e7549c20fc --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement4.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement4.ts] +for (var a = 1 of X) { +} + +//// [parserForOfStatement4.js] +for (var a = 1 of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement5.js b/tests/baselines/reference/parserForOfStatement5.js new file mode 100644 index 00000000000..9028ebe7e3f --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement5.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement5.ts] +for (var a: number of X) { +} + +//// [parserForOfStatement5.js] +for (var a of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement6.errors.txt b/tests/baselines/reference/parserForOfStatement6.errors.txt new file mode 100644 index 00000000000..f6a87d8a37d --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement6.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts(1,17): error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts (1 errors) ==== + for (var a = 1, b = 2 of X) { + ~ +!!! error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement6.js b/tests/baselines/reference/parserForOfStatement6.js new file mode 100644 index 00000000000..37f3560a29c --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement6.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement6.ts] +for (var a = 1, b = 2 of X) { +} + +//// [parserForOfStatement6.js] +for (var a = 1 of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement7.errors.txt b/tests/baselines/reference/parserForOfStatement7.errors.txt new file mode 100644 index 00000000000..e40bcd448f6 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement7.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts(1,25): error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts (1 errors) ==== + for (var a: number = 1, b: string = "" of X) { + ~ +!!! error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement7.js b/tests/baselines/reference/parserForOfStatement7.js new file mode 100644 index 00000000000..0b18d0358b4 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement7.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement7.ts] +for (var a: number = 1, b: string = "" of X) { +} + +//// [parserForOfStatement7.js] +for (var a = 1 of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement8.js b/tests/baselines/reference/parserForOfStatement8.js new file mode 100644 index 00000000000..3565998701e --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement8.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement8.ts] +for (var v of X) { +} + +//// [parserForOfStatement8.js] +for (var v of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement8.types b/tests/baselines/reference/parserForOfStatement8.types new file mode 100644 index 00000000000..a4168caf262 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement8.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts === +for (var v of X) { +>v : any +>X : unknown +} diff --git a/tests/baselines/reference/parserForOfStatement9.js b/tests/baselines/reference/parserForOfStatement9.js new file mode 100644 index 00000000000..f03dad33c5f --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement9.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement9.ts] +for (let v of X) { +} + +//// [parserForOfStatement9.js] +for (let v of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement9.types b/tests/baselines/reference/parserForOfStatement9.types new file mode 100644 index 00000000000..0285a3e4b76 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement9.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts === +for (let v of X) { +>v : any +>X : unknown +} From cc81a670ac4ca600b0f6aed0ec2defb617cd95b1 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 17 Feb 2015 12:47:57 -0800 Subject: [PATCH 123/162] Fork grammar message into two messages --- src/compiler/checker.ts | 6 ++++-- src/compiler/diagnosticInformationMap.generated.ts | 3 ++- src/compiler/diagnosticMessages.json | 6 +++++- .../baselines/reference/parserES5ForOfStatement3.errors.txt | 4 ++-- .../baselines/reference/parserES5ForOfStatement6.errors.txt | 4 ++-- .../baselines/reference/parserES5ForOfStatement7.errors.txt | 4 ++-- tests/baselines/reference/parserForOfStatement3.errors.txt | 4 ++-- tests/baselines/reference/parserForOfStatement6.errors.txt | 4 ++-- tests/baselines/reference/parserForOfStatement7.errors.txt | 4 ++-- 9 files changed, 23 insertions(+), 16 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3e6ac9ffe2e..125f5623412 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10764,8 +10764,10 @@ module ts { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var keywordText = forInOrOfStatement.kind === SyntaxKind.ForInStatement ? "in" : "of"; - return grammarErrorOnFirstToken(variableList.declarations[1], Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_0_statement, keywordText); + var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement ? + Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : + Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } } } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index b9b407eb1d5..ab9097ae76e 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -55,7 +55,7 @@ module ts { An_accessor_cannot_be_declared_in_an_ambient_context: { code: 1086, category: DiagnosticCategory.Error, key: "An accessor cannot be declared in an ambient context." }, _0_modifier_cannot_appear_on_a_constructor_declaration: { code: 1089, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a constructor declaration." }, _0_modifier_cannot_appear_on_a_parameter: { code: 1090, category: DiagnosticCategory.Error, key: "'{0}' modifier cannot appear on a parameter." }, - Only_a_single_variable_declaration_is_allowed_in_a_for_0_statement: { code: 1091, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...{0}' statement." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement: { code: 1091, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...in' statement." }, Type_parameters_cannot_appear_on_a_constructor_declaration: { code: 1092, category: DiagnosticCategory.Error, key: "Type parameters cannot appear on a constructor declaration." }, Type_annotation_cannot_appear_on_a_constructor_declaration: { code: 1093, category: DiagnosticCategory.Error, key: "Type annotation cannot appear on a constructor declaration." }, An_accessor_cannot_have_type_parameters: { code: 1094, category: DiagnosticCategory.Error, key: "An accessor cannot have type parameters." }, @@ -147,6 +147,7 @@ module ts { Merge_conflict_marker_encountered: { code: 1185, category: DiagnosticCategory.Error, key: "Merge conflict marker encountered." }, A_rest_element_cannot_have_an_initializer: { code: 1186, category: DiagnosticCategory.Error, key: "A rest element cannot have an initializer." }, A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: DiagnosticCategory.Error, key: "A parameter property may not be a binding pattern." }, + Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index b59bd229e62..6a5fb54f228 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -211,7 +211,7 @@ "category": "Error", "code": 1090 }, - "Only a single variable declaration is allowed in a 'for...{0}' statement.": { + "Only a single variable declaration is allowed in a 'for...in' statement.": { "category": "Error", "code": 1091 }, @@ -579,6 +579,10 @@ "category": "Error", "code": 1187 }, + "Only a single variable declaration is allowed in a 'for...of' statement.": { + "category": "Error", + "code": 1188 + }, "Duplicate identifier '{0}'.": { "category": "Error", diff --git a/tests/baselines/reference/parserES5ForOfStatement3.errors.txt b/tests/baselines/reference/parserES5ForOfStatement3.errors.txt index 6209ed2475f..a976d9c0d54 100644 --- a/tests/baselines/reference/parserES5ForOfStatement3.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement3.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,13): error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,13): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts (1 errors) ==== for (var a, b of X) { ~ -!!! error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. +!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement6.errors.txt b/tests/baselines/reference/parserES5ForOfStatement6.errors.txt index 1bbacc01c9e..da76589190d 100644 --- a/tests/baselines/reference/parserES5ForOfStatement6.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,17): error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,17): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts (1 errors) ==== for (var a = 1, b = 2 of X) { ~ -!!! error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. +!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement7.errors.txt b/tests/baselines/reference/parserES5ForOfStatement7.errors.txt index 7d2810f6de7..ced399ca103 100644 --- a/tests/baselines/reference/parserES5ForOfStatement7.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement7.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,25): error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,25): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts (1 errors) ==== for (var a: number = 1, b: string = "" of X) { ~ -!!! error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. +!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement3.errors.txt b/tests/baselines/reference/parserForOfStatement3.errors.txt index 36cd23b0931..995ef4637c2 100644 --- a/tests/baselines/reference/parserForOfStatement3.errors.txt +++ b/tests/baselines/reference/parserForOfStatement3.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts(1,13): error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts(1,13): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts (1 errors) ==== for (var a, b of X) { ~ -!!! error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. +!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement6.errors.txt b/tests/baselines/reference/parserForOfStatement6.errors.txt index f6a87d8a37d..57d95361b65 100644 --- a/tests/baselines/reference/parserForOfStatement6.errors.txt +++ b/tests/baselines/reference/parserForOfStatement6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts(1,17): error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts(1,17): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts (1 errors) ==== for (var a = 1, b = 2 of X) { ~ -!!! error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. +!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement7.errors.txt b/tests/baselines/reference/parserForOfStatement7.errors.txt index e40bcd448f6..07f93c263ec 100644 --- a/tests/baselines/reference/parserForOfStatement7.errors.txt +++ b/tests/baselines/reference/parserForOfStatement7.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts(1,25): error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts(1,25): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts (1 errors) ==== for (var a: number = 1, b: string = "" of X) { ~ -!!! error TS1091: Only a single variable declaration is allowed in a 'for...of' statement. +!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. } \ No newline at end of file From f7a6354470d59e3d1a8c17733c0e500b3c83ed9d Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 17 Feb 2015 16:59:58 -0800 Subject: [PATCH 124/162] More resilient error recovery when declaration in for-of is empty --- src/compiler/parser.ts | 33 +++++++++++++++---- .../reference/parserES5ForOfStatement17.js | 5 +++ .../reference/parserES5ForOfStatement17.types | 4 +++ .../parserES5ForOfStatement18.errors.txt | 7 ++++ .../reference/parserES5ForOfStatement18.js | 5 +++ .../reference/parserES5ForOfStatement19.js | 5 +++ .../reference/parserES5ForOfStatement19.types | 5 +++ .../parserES5ForOfStatement2.errors.txt | 11 +++++++ .../reference/parserES5ForOfStatement2.js | 7 ++++ .../reference/parserES5ForOfStatement20.js | 5 +++ .../reference/parserES5ForOfStatement20.types | 5 +++ .../parserES5ForOfStatement21.errors.txt | 10 ++++++ .../reference/parserES5ForOfStatement21.js | 5 +++ .../reference/parserForOfStatement17.js | 5 +++ .../reference/parserForOfStatement17.types | 4 +++ .../reference/parserForOfStatement18.js | 5 +++ .../reference/parserForOfStatement18.types | 5 +++ .../reference/parserForOfStatement19.js | 5 +++ .../reference/parserForOfStatement19.types | 5 +++ .../parserForOfStatement2.errors.txt | 8 +++++ .../reference/parserForOfStatement2.js | 7 ++++ .../reference/parserForOfStatement20.js | 5 +++ .../reference/parserForOfStatement20.types | 5 +++ .../parserForOfStatement21.errors.txt | 7 ++++ .../reference/parserForOfStatement21.js | 5 +++ .../Statements/parserES5ForOfStatement17.ts | 2 ++ .../Statements/parserES5ForOfStatement18.ts | 2 ++ .../Statements/parserES5ForOfStatement19.ts | 2 ++ .../Statements/parserES5ForOfStatement20.ts | 2 ++ .../Statements/parserES5ForOfStatement21.ts | 2 ++ .../Iterators/parserForOfStatement17.ts | 2 ++ .../Iterators/parserForOfStatement18.ts | 2 ++ .../Iterators/parserForOfStatement19.ts | 2 ++ .../Iterators/parserForOfStatement20.ts | 2 ++ .../Iterators/parserForOfStatement21.ts | 2 ++ 35 files changed, 186 insertions(+), 7 deletions(-) create mode 100644 tests/baselines/reference/parserES5ForOfStatement17.js create mode 100644 tests/baselines/reference/parserES5ForOfStatement17.types create mode 100644 tests/baselines/reference/parserES5ForOfStatement18.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement18.js create mode 100644 tests/baselines/reference/parserES5ForOfStatement19.js create mode 100644 tests/baselines/reference/parserES5ForOfStatement19.types create mode 100644 tests/baselines/reference/parserES5ForOfStatement2.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement2.js create mode 100644 tests/baselines/reference/parserES5ForOfStatement20.js create mode 100644 tests/baselines/reference/parserES5ForOfStatement20.types create mode 100644 tests/baselines/reference/parserES5ForOfStatement21.errors.txt create mode 100644 tests/baselines/reference/parserES5ForOfStatement21.js create mode 100644 tests/baselines/reference/parserForOfStatement17.js create mode 100644 tests/baselines/reference/parserForOfStatement17.types create mode 100644 tests/baselines/reference/parserForOfStatement18.js create mode 100644 tests/baselines/reference/parserForOfStatement18.types create mode 100644 tests/baselines/reference/parserForOfStatement19.js create mode 100644 tests/baselines/reference/parserForOfStatement19.types create mode 100644 tests/baselines/reference/parserForOfStatement2.errors.txt create mode 100644 tests/baselines/reference/parserForOfStatement2.js create mode 100644 tests/baselines/reference/parserForOfStatement20.js create mode 100644 tests/baselines/reference/parserForOfStatement20.types create mode 100644 tests/baselines/reference/parserForOfStatement21.errors.txt create mode 100644 tests/baselines/reference/parserForOfStatement21.js create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement17.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts create mode 100644 tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement17.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts create mode 100644 tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index d40101aacc3..159aa545ec9 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -3805,7 +3805,7 @@ module ts { var initializer: VariableDeclarationList | Expression = undefined; if (token !== SyntaxKind.SemicolonToken) { if (token === SyntaxKind.VarKeyword || token === SyntaxKind.LetKeyword || token === SyntaxKind.ConstKeyword) { - initializer = parseVariableDeclarationList(/*disallowIn:*/ true); + initializer = parseVariableDeclarationList(/*inForStatementInitializer:*/ true); } else { initializer = disallowInAnd(parseExpression); @@ -4236,7 +4236,7 @@ module ts { return finishNode(node); } - function parseVariableDeclarationList(disallowIn: boolean): VariableDeclarationList { + function parseVariableDeclarationList(inForStatementInitializer: boolean): VariableDeclarationList { var node = createNode(SyntaxKind.VariableDeclarationList); switch (token) { @@ -4253,20 +4253,39 @@ module ts { } nextToken(); - var savedDisallowIn = inDisallowInContext(); - setDisallowInContext(disallowIn); - node.declarations = parseDelimitedList(ParsingContext.VariableDeclarations, parseVariableDeclaration); + // The user may have written the following: + // + // for (var of X) { } + // + // In this case, we want to parse an empty declaration list, and then parse 'of' + // as a keyword. The reason this is not automatic is that 'of' is a valid identifier. + // So we need to look ahead to determine if 'of' should be treated as a keyword in + // this context. + // The checker will then give an error that there is an empty declaration list. + if (token === SyntaxKind.OfKeyword && lookAhead(canFollowContextualOfKeyword)) { + node.declarations = createMissingList(); + } + else { + var savedDisallowIn = inDisallowInContext(); + setDisallowInContext(inForStatementInitializer); - setDisallowInContext(savedDisallowIn); + node.declarations = parseDelimitedList(ParsingContext.VariableDeclarations, parseVariableDeclaration); + + setDisallowInContext(savedDisallowIn); + } return finishNode(node); } + + function canFollowContextualOfKeyword(): boolean { + return nextTokenIsIdentifier() && nextToken() === SyntaxKind.CloseParenToken; + } function parseVariableStatement(fullStart: number, modifiers: ModifiersArray): VariableStatement { var node = createNode(SyntaxKind.VariableStatement, fullStart); setModifiers(node, modifiers); - node.declarationList = parseVariableDeclarationList(/*disallowIn:*/ false); + node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer:*/ false); parseSemicolon(); return finishNode(node); } diff --git a/tests/baselines/reference/parserES5ForOfStatement17.js b/tests/baselines/reference/parserES5ForOfStatement17.js new file mode 100644 index 00000000000..7995c4c689e --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement17.js @@ -0,0 +1,5 @@ +//// [parserES5ForOfStatement17.ts] +for (var of; ;) { } + +//// [parserES5ForOfStatement17.js] +for (var of;;) { } diff --git a/tests/baselines/reference/parserES5ForOfStatement17.types b/tests/baselines/reference/parserES5ForOfStatement17.types new file mode 100644 index 00000000000..5dd0f6e9b93 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement17.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement17.ts === +for (var of; ;) { } +>of : any + diff --git a/tests/baselines/reference/parserES5ForOfStatement18.errors.txt b/tests/baselines/reference/parserES5ForOfStatement18.errors.txt new file mode 100644 index 00000000000..e07b516abf0 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement18.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts (1 errors) ==== + for (var of of of) { } + ~~~ +!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement18.js b/tests/baselines/reference/parserES5ForOfStatement18.js new file mode 100644 index 00000000000..1df3e0bed7b --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement18.js @@ -0,0 +1,5 @@ +//// [parserES5ForOfStatement18.ts] +for (var of of of) { } + +//// [parserES5ForOfStatement18.js] +for (var of of of) { } diff --git a/tests/baselines/reference/parserES5ForOfStatement19.js b/tests/baselines/reference/parserES5ForOfStatement19.js new file mode 100644 index 00000000000..7ed0d5a333a --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement19.js @@ -0,0 +1,5 @@ +//// [parserES5ForOfStatement19.ts] +for (var of in of) { } + +//// [parserES5ForOfStatement19.js] +for (var of in of) { } diff --git a/tests/baselines/reference/parserES5ForOfStatement19.types b/tests/baselines/reference/parserES5ForOfStatement19.types new file mode 100644 index 00000000000..13abc7ae757 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement19.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts === +for (var of in of) { } +>of : any +>of : any + diff --git a/tests/baselines/reference/parserES5ForOfStatement2.errors.txt b/tests/baselines/reference/parserES5ForOfStatement2.errors.txt new file mode 100644 index 00000000000..70bf84999f5 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement2.errors.txt @@ -0,0 +1,11 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts(1,9): error TS1123: Variable declaration list cannot be empty. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts (2 errors) ==== + for (var of X) { + ~~~ +!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + +!!! error TS1123: Variable declaration list cannot be empty. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement2.js b/tests/baselines/reference/parserES5ForOfStatement2.js new file mode 100644 index 00000000000..dfcfb476172 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement2.js @@ -0,0 +1,7 @@ +//// [parserES5ForOfStatement2.ts] +for (var of X) { +} + +//// [parserES5ForOfStatement2.js] +for ( of X) { +} diff --git a/tests/baselines/reference/parserES5ForOfStatement20.js b/tests/baselines/reference/parserES5ForOfStatement20.js new file mode 100644 index 00000000000..c51cbbc2a3a --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement20.js @@ -0,0 +1,5 @@ +//// [parserES5ForOfStatement20.ts] +for (var of = 0 in of) { } + +//// [parserES5ForOfStatement20.js] +for (var of = 0 in of) { } diff --git a/tests/baselines/reference/parserES5ForOfStatement20.types b/tests/baselines/reference/parserES5ForOfStatement20.types new file mode 100644 index 00000000000..54df94516c3 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement20.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts === +for (var of = 0 in of) { } +>of : any +>of : any + diff --git a/tests/baselines/reference/parserES5ForOfStatement21.errors.txt b/tests/baselines/reference/parserES5ForOfStatement21.errors.txt new file mode 100644 index 00000000000..338d1e34b2f --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement21.errors.txt @@ -0,0 +1,10 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts(1,9): error TS1123: Variable declaration list cannot be empty. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts (2 errors) ==== + for (var of of) { } + ~~~ +!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + +!!! error TS1123: Variable declaration list cannot be empty. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement21.js b/tests/baselines/reference/parserES5ForOfStatement21.js new file mode 100644 index 00000000000..e02ed853cb5 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement21.js @@ -0,0 +1,5 @@ +//// [parserES5ForOfStatement21.ts] +for (var of of) { } + +//// [parserES5ForOfStatement21.js] +for ( of of) { } diff --git a/tests/baselines/reference/parserForOfStatement17.js b/tests/baselines/reference/parserForOfStatement17.js new file mode 100644 index 00000000000..a6e2aee79a4 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement17.js @@ -0,0 +1,5 @@ +//// [parserForOfStatement17.ts] +for (var of; ;) { } + +//// [parserForOfStatement17.js] +for (var of;;) { } diff --git a/tests/baselines/reference/parserForOfStatement17.types b/tests/baselines/reference/parserForOfStatement17.types new file mode 100644 index 00000000000..64e15462dd6 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement17.types @@ -0,0 +1,4 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement17.ts === +for (var of; ;) { } +>of : any + diff --git a/tests/baselines/reference/parserForOfStatement18.js b/tests/baselines/reference/parserForOfStatement18.js new file mode 100644 index 00000000000..c30fbb60857 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement18.js @@ -0,0 +1,5 @@ +//// [parserForOfStatement18.ts] +for (var of of of) { } + +//// [parserForOfStatement18.js] +for (var of of of) { } diff --git a/tests/baselines/reference/parserForOfStatement18.types b/tests/baselines/reference/parserForOfStatement18.types new file mode 100644 index 00000000000..8e3b52ac877 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement18.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts === +for (var of of of) { } +>of : any +>of : any + diff --git a/tests/baselines/reference/parserForOfStatement19.js b/tests/baselines/reference/parserForOfStatement19.js new file mode 100644 index 00000000000..c838e8c71e0 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement19.js @@ -0,0 +1,5 @@ +//// [parserForOfStatement19.ts] +for (var of in of) { } + +//// [parserForOfStatement19.js] +for (var of in of) { } diff --git a/tests/baselines/reference/parserForOfStatement19.types b/tests/baselines/reference/parserForOfStatement19.types new file mode 100644 index 00000000000..6fcc5e8f792 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement19.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts === +for (var of in of) { } +>of : any +>of : any + diff --git a/tests/baselines/reference/parserForOfStatement2.errors.txt b/tests/baselines/reference/parserForOfStatement2.errors.txt new file mode 100644 index 00000000000..7229fe4196d --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement2.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts(1,9): error TS1123: Variable declaration list cannot be empty. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts (1 errors) ==== + for (var of X) { + +!!! error TS1123: Variable declaration list cannot be empty. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement2.js b/tests/baselines/reference/parserForOfStatement2.js new file mode 100644 index 00000000000..84d23d4e2aa --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement2.js @@ -0,0 +1,7 @@ +//// [parserForOfStatement2.ts] +for (var of X) { +} + +//// [parserForOfStatement2.js] +for ( of X) { +} diff --git a/tests/baselines/reference/parserForOfStatement20.js b/tests/baselines/reference/parserForOfStatement20.js new file mode 100644 index 00000000000..8599238d853 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement20.js @@ -0,0 +1,5 @@ +//// [parserForOfStatement20.ts] +for (var of = 0 in of) { } + +//// [parserForOfStatement20.js] +for (var of = 0 in of) { } diff --git a/tests/baselines/reference/parserForOfStatement20.types b/tests/baselines/reference/parserForOfStatement20.types new file mode 100644 index 00000000000..de664ca3c0f --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement20.types @@ -0,0 +1,5 @@ +=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts === +for (var of = 0 in of) { } +>of : any +>of : any + diff --git a/tests/baselines/reference/parserForOfStatement21.errors.txt b/tests/baselines/reference/parserForOfStatement21.errors.txt new file mode 100644 index 00000000000..9103e2fedee --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement21.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts(1,9): error TS1123: Variable declaration list cannot be empty. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts (1 errors) ==== + for (var of of) { } + +!!! error TS1123: Variable declaration list cannot be empty. \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement21.js b/tests/baselines/reference/parserForOfStatement21.js new file mode 100644 index 00000000000..5db883e18a0 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement21.js @@ -0,0 +1,5 @@ +//// [parserForOfStatement21.ts] +for (var of of) { } + +//// [parserForOfStatement21.js] +for ( of of) { } diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement17.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement17.ts new file mode 100644 index 00000000000..882ae938d6c --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement17.ts @@ -0,0 +1,2 @@ +//@target: ES5 +for (var of; ;) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts new file mode 100644 index 00000000000..a7dff6f225b --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts @@ -0,0 +1,2 @@ +//@target: ES5 +for (var of of of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts new file mode 100644 index 00000000000..730f574be33 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement19.ts @@ -0,0 +1,2 @@ +//@target: ES5 +for (var of in of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts new file mode 100644 index 00000000000..edffb88a1e3 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts @@ -0,0 +1,2 @@ +//@target: ES5 +for (var of = 0 in of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts new file mode 100644 index 00000000000..a61edfbd050 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts @@ -0,0 +1,2 @@ +//@target: ES5 +for (var of of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement17.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement17.ts new file mode 100644 index 00000000000..f088b36f4fd --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement17.ts @@ -0,0 +1,2 @@ +//@target: ES6 +for (var of; ;) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts new file mode 100644 index 00000000000..268dc163dde --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts @@ -0,0 +1,2 @@ +//@target: ES6 +for (var of of of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts new file mode 100644 index 00000000000..4dff469112b --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement19.ts @@ -0,0 +1,2 @@ +//@target: ES6 +for (var of in of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts new file mode 100644 index 00000000000..d0b7b75175d --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts @@ -0,0 +1,2 @@ +//@target: ES6 +for (var of = 0 in of) { } \ No newline at end of file diff --git a/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts new file mode 100644 index 00000000000..f480ac371a2 --- /dev/null +++ b/tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts @@ -0,0 +1,2 @@ +//@target: ES6 +for (var of of) { } \ No newline at end of file From 147cc204b8d2ca2fbd032f8feaf085af481eeae0 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 17 Feb 2015 17:52:55 -0800 Subject: [PATCH 125/162] Disallow initializers in for-in and for-of loops --- src/compiler/checker.ts | 6 ++++++ src/compiler/diagnosticInformationMap.generated.ts | 2 ++ src/compiler/diagnosticMessages.json | 8 ++++++++ .../reference/parserES5ForOfStatement20.errors.txt | 7 +++++++ tests/baselines/reference/parserES5ForOfStatement20.types | 5 ----- .../reference/parserES5ForOfStatement4.errors.txt | 6 +++--- .../baselines/reference/parserForInStatement4.errors.txt | 5 ++++- .../baselines/reference/parserForOfStatement20.errors.txt | 7 +++++++ tests/baselines/reference/parserForOfStatement20.types | 5 ----- .../baselines/reference/parserForOfStatement4.errors.txt | 8 ++++++++ 10 files changed, 45 insertions(+), 14 deletions(-) create mode 100644 tests/baselines/reference/parserES5ForOfStatement20.errors.txt delete mode 100644 tests/baselines/reference/parserES5ForOfStatement20.types create mode 100644 tests/baselines/reference/parserForOfStatement20.errors.txt delete mode 100644 tests/baselines/reference/parserForOfStatement20.types create mode 100644 tests/baselines/reference/parserForOfStatement4.errors.txt diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 125f5623412..96439b2cf68 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10769,6 +10769,12 @@ module ts { Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } + if (variableList.declarations[0].initializer) { + var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement ? + Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : + Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + return grammarErrorOnNode(variableList.declarations[0].name, diagnostic); + } } } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index ab9097ae76e..17c0bec44a3 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -148,6 +148,8 @@ module ts { A_rest_element_cannot_have_an_initializer: { code: 1186, category: DiagnosticCategory.Error, key: "A rest element cannot have an initializer." }, A_parameter_property_may_not_be_a_binding_pattern: { code: 1187, category: DiagnosticCategory.Error, key: "A parameter property may not be a binding pattern." }, Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement: { code: 1188, category: DiagnosticCategory.Error, key: "Only a single variable declaration is allowed in a 'for...of' statement." }, + The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...in' statement cannot have an initializer." }, + The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...of' statement cannot have an initializer." }, Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." }, Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." }, Static_members_cannot_reference_class_type_parameters: { code: 2302, category: DiagnosticCategory.Error, key: "Static members cannot reference class type parameters." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 6a5fb54f228..b0bf5945e8c 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -583,6 +583,14 @@ "category": "Error", "code": 1188 }, + "The variable declaration of a 'for...in' statement cannot have an initializer.": { + "category": "Error", + "code": 1189 + }, + "The variable declaration of a 'for...of' statement cannot have an initializer.": { + "category": "Error", + "code": 1190 + }, "Duplicate identifier '{0}'.": { "category": "Error", diff --git a/tests/baselines/reference/parserES5ForOfStatement20.errors.txt b/tests/baselines/reference/parserES5ForOfStatement20.errors.txt new file mode 100644 index 00000000000..4aee32394b6 --- /dev/null +++ b/tests/baselines/reference/parserES5ForOfStatement20.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. + + +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts (1 errors) ==== + for (var of = 0 in of) { } + ~~ +!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement20.types b/tests/baselines/reference/parserES5ForOfStatement20.types deleted file mode 100644 index 54df94516c3..00000000000 --- a/tests/baselines/reference/parserES5ForOfStatement20.types +++ /dev/null @@ -1,5 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement20.ts === -for (var of = 0 in of) { } ->of : any ->of : any - diff --git a/tests/baselines/reference/parserES5ForOfStatement4.errors.txt b/tests/baselines/reference/parserES5ForOfStatement4.errors.txt index 36c1894ed78..e2b38b56be5 100644 --- a/tests/baselines/reference/parserES5ForOfStatement4.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement4.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,10): error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts (1 errors) ==== for (var a = 1 of X) { - ~~~ -!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + ~ +!!! error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForInStatement4.errors.txt b/tests/baselines/reference/parserForInStatement4.errors.txt index a4df2beaedb..91484260903 100644 --- a/tests/baselines/reference/parserForInStatement4.errors.txt +++ b/tests/baselines/reference/parserForInStatement4.errors.txt @@ -1,8 +1,11 @@ +tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts(1,19): error TS2304: Cannot find name 'X'. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts (1 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement4.ts (2 errors) ==== for (var a = 1 in X) { + ~ +!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. ~ !!! error TS2304: Cannot find name 'X'. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement20.errors.txt b/tests/baselines/reference/parserForOfStatement20.errors.txt new file mode 100644 index 00000000000..461f307f6b9 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement20.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts(1,10): error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts (1 errors) ==== + for (var of = 0 in of) { } + ~~ +!!! error TS1189: The variable declaration of a 'for...in' statement cannot have an initializer. \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement20.types b/tests/baselines/reference/parserForOfStatement20.types deleted file mode 100644 index de664ca3c0f..00000000000 --- a/tests/baselines/reference/parserForOfStatement20.types +++ /dev/null @@ -1,5 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement20.ts === -for (var of = 0 in of) { } ->of : any ->of : any - diff --git a/tests/baselines/reference/parserForOfStatement4.errors.txt b/tests/baselines/reference/parserForOfStatement4.errors.txt new file mode 100644 index 00000000000..65b4bf342f2 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement4.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts(1,10): error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts (1 errors) ==== + for (var a = 1 of X) { + ~ +!!! error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer. + } \ No newline at end of file From 7cb2a643503698d3da5469b01d1a8fcd67d2125f Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Tue, 17 Feb 2015 18:16:00 -0800 Subject: [PATCH 126/162] Disallow type annotation on a for-of variable --- src/compiler/checker.ts | 14 +++++++++----- src/compiler/diagnosticInformationMap.generated.ts | 1 + src/compiler/diagnosticMessages.json | 4 ++++ .../reference/parserES5ForOfStatement5.errors.txt | 6 +++--- .../reference/parserForInStatement7.errors.txt | 5 +---- .../reference/parserForOfStatement5.errors.txt | 8 ++++++++ 6 files changed, 26 insertions(+), 12 deletions(-) create mode 100644 tests/baselines/reference/parserForOfStatement5.errors.txt diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 96439b2cf68..aeb2324fcbf 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8467,9 +8467,6 @@ module ts { if (variableDeclarationList.declarations.length >= 1) { var decl = variableDeclarationList.declarations[0]; checkVariableDeclaration(decl); - if (decl.type) { - error(decl, Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation); - } } } else { @@ -10769,11 +10766,18 @@ module ts { Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } - if (variableList.declarations[0].initializer) { + var firstDeclaration = variableList.declarations[0]; + if (firstDeclaration.initializer) { var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement ? Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; - return grammarErrorOnNode(variableList.declarations[0].name, diagnostic); + return grammarErrorOnNode(firstDeclaration.name, diagnostic); + } + if (firstDeclaration.type) { + var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement ? + Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : + Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + return grammarErrorOnNode(firstDeclaration, diagnostic); } } } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 17c0bec44a3..4d9ac1d91a7 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -317,6 +317,7 @@ module ts { let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2476, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2477, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, For_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: DiagnosticCategory.Error, key: "For-of statements are only available when targeting ECMAScript 6 or higher" }, + The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index b0bf5945e8c..65c73d3ccd4 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1260,6 +1260,10 @@ "category": "Error", "code": 2482 }, + "The left-hand side of a 'for...of' statement cannot use a type annotation.": { + "category": "Error", + "code": 2483 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", diff --git a/tests/baselines/reference/parserES5ForOfStatement5.errors.txt b/tests/baselines/reference/parserES5ForOfStatement5.errors.txt index 55c56d60aae..0e88ce6cf36 100644 --- a/tests/baselines/reference/parserES5ForOfStatement5.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,10): error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts (1 errors) ==== for (var a: number of X) { - ~~~ -!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher + ~ +!!! error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForInStatement7.errors.txt b/tests/baselines/reference/parserForInStatement7.errors.txt index 397401003db..7c85ce3f795 100644 --- a/tests/baselines/reference/parserForInStatement7.errors.txt +++ b/tests/baselines/reference/parserForInStatement7.errors.txt @@ -1,12 +1,9 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts(1,10): error TS2404: The left-hand side of a 'for...in' statement cannot use a type annotation. tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts(1,25): error TS1091: Only a single variable declaration is allowed in a 'for...in' statement. tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts(1,43): error TS2304: Cannot find name 'X'. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts (3 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserForInStatement7.ts (2 errors) ==== for (var a: number = 1, b: string = "" in X) { - ~ -!!! error TS2404: The left-hand side of a 'for...in' statement cannot use a type annotation. ~ !!! error TS1091: Only a single variable declaration is allowed in a 'for...in' statement. ~ diff --git a/tests/baselines/reference/parserForOfStatement5.errors.txt b/tests/baselines/reference/parserForOfStatement5.errors.txt new file mode 100644 index 00000000000..13fd8739866 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement5.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts(1,10): error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts (1 errors) ==== + for (var a: number of X) { + ~ +!!! error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation. + } \ No newline at end of file From 8558d642f3b82c7626634cc3098096c8a3609457 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 18 Feb 2015 11:14:58 -0800 Subject: [PATCH 127/162] Temporarily disallow for-of statements --- src/compiler/checker.ts | 2 ++ src/compiler/diagnosticInformationMap.generated.ts | 3 ++- src/compiler/diagnosticMessages.json | 6 +++++- .../reference/parserES5ForOfStatement1.d.errors.txt | 4 ++-- .../reference/parserES5ForOfStatement10.errors.txt | 9 +++------ .../reference/parserES5ForOfStatement11.errors.txt | 9 +++------ .../reference/parserES5ForOfStatement12.errors.txt | 9 +++------ .../reference/parserES5ForOfStatement13.errors.txt | 9 +++------ .../reference/parserES5ForOfStatement14.errors.txt | 9 +++------ .../reference/parserES5ForOfStatement15.errors.txt | 4 ++-- .../reference/parserES5ForOfStatement16.errors.txt | 4 ++-- .../reference/parserES5ForOfStatement18.errors.txt | 4 ++-- .../reference/parserES5ForOfStatement2.errors.txt | 9 +++------ .../reference/parserES5ForOfStatement21.errors.txt | 9 +++------ .../reference/parserES5ForOfStatement3.errors.txt | 6 +++--- .../reference/parserES5ForOfStatement4.errors.txt | 6 +++--- .../reference/parserES5ForOfStatement5.errors.txt | 6 +++--- .../reference/parserES5ForOfStatement6.errors.txt | 6 +++--- .../reference/parserES5ForOfStatement7.errors.txt | 6 +++--- .../reference/parserES5ForOfStatement8.errors.txt | 4 ++-- .../reference/parserES5ForOfStatement9.errors.txt | 9 +++------ .../reference/parserForOfStatement1.d.errors.txt | 4 ++-- .../reference/parserForOfStatement10.errors.txt | 8 ++++++++ tests/baselines/reference/parserForOfStatement10.types | 5 ----- .../reference/parserForOfStatement11.errors.txt | 8 ++++++++ tests/baselines/reference/parserForOfStatement11.types | 6 ------ .../reference/parserForOfStatement12.errors.txt | 8 ++++++++ tests/baselines/reference/parserForOfStatement12.types | 6 ------ .../reference/parserForOfStatement13.errors.txt | 8 ++++++++ tests/baselines/reference/parserForOfStatement13.types | 6 ------ .../reference/parserForOfStatement14.errors.txt | 8 ++++++++ tests/baselines/reference/parserForOfStatement14.types | 6 ------ .../reference/parserForOfStatement15.errors.txt | 8 ++++++++ tests/baselines/reference/parserForOfStatement15.types | 6 ------ .../reference/parserForOfStatement16.errors.txt | 8 ++++++++ tests/baselines/reference/parserForOfStatement16.types | 6 ------ .../reference/parserForOfStatement18.errors.txt | 7 +++++++ tests/baselines/reference/parserForOfStatement18.types | 5 ----- .../baselines/reference/parserForOfStatement2.errors.txt | 6 +++--- .../reference/parserForOfStatement21.errors.txt | 6 +++--- .../baselines/reference/parserForOfStatement3.errors.txt | 6 +++--- .../baselines/reference/parserForOfStatement4.errors.txt | 6 +++--- .../baselines/reference/parserForOfStatement5.errors.txt | 6 +++--- .../baselines/reference/parserForOfStatement6.errors.txt | 6 +++--- .../baselines/reference/parserForOfStatement7.errors.txt | 6 +++--- .../baselines/reference/parserForOfStatement8.errors.txt | 8 ++++++++ tests/baselines/reference/parserForOfStatement8.types | 5 ----- .../baselines/reference/parserForOfStatement9.errors.txt | 8 ++++++++ tests/baselines/reference/parserForOfStatement9.types | 5 ----- 49 files changed, 160 insertions(+), 154 deletions(-) create mode 100644 tests/baselines/reference/parserForOfStatement10.errors.txt delete mode 100644 tests/baselines/reference/parserForOfStatement10.types create mode 100644 tests/baselines/reference/parserForOfStatement11.errors.txt delete mode 100644 tests/baselines/reference/parserForOfStatement11.types create mode 100644 tests/baselines/reference/parserForOfStatement12.errors.txt delete mode 100644 tests/baselines/reference/parserForOfStatement12.types create mode 100644 tests/baselines/reference/parserForOfStatement13.errors.txt delete mode 100644 tests/baselines/reference/parserForOfStatement13.types create mode 100644 tests/baselines/reference/parserForOfStatement14.errors.txt delete mode 100644 tests/baselines/reference/parserForOfStatement14.types create mode 100644 tests/baselines/reference/parserForOfStatement15.errors.txt delete mode 100644 tests/baselines/reference/parserForOfStatement15.types create mode 100644 tests/baselines/reference/parserForOfStatement16.errors.txt delete mode 100644 tests/baselines/reference/parserForOfStatement16.types create mode 100644 tests/baselines/reference/parserForOfStatement18.errors.txt delete mode 100644 tests/baselines/reference/parserForOfStatement18.types create mode 100644 tests/baselines/reference/parserForOfStatement8.errors.txt delete mode 100644 tests/baselines/reference/parserForOfStatement8.types create mode 100644 tests/baselines/reference/parserForOfStatement9.errors.txt delete mode 100644 tests/baselines/reference/parserForOfStatement9.types diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index aeb2324fcbf..37de87ea83b 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -10786,6 +10786,8 @@ module ts { } function checkGrammarForOfStatement(forOfStatement: ForOfStatement): boolean { + // Temporarily disallow for-of statements until type check work is complete. + return grammarErrorOnFirstToken(forOfStatement, Diagnostics.For_of_statements_are_not_currently_supported); if (checkGrammarForInOrForOfStatement(forOfStatement)) { return true; } diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 4d9ac1d91a7..2fbe9b49457 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -316,7 +316,7 @@ module ts { Property_0_does_not_exist_on_const_enum_1: { code: 2475, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2476, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2477, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, - For_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: DiagnosticCategory.Error, key: "For-of statements are only available when targeting ECMAScript 6 or higher" }, + For_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: DiagnosticCategory.Error, key: "For...of statements are only available when targeting ECMAScript 6 or higher." }, The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, @@ -463,5 +463,6 @@ module ts { yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." }, The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, + For_of_statements_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "For...of statements are not currently supported." }, }; } \ No newline at end of file diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 65c73d3ccd4..1b81d14ffda 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1256,7 +1256,7 @@ "category": "Error", "code": 2477 }, - "For-of statements are only available when targeting ECMAScript 6 or higher": { + "For...of statements are only available when targeting ECMAScript 6 or higher.": { "category": "Error", "code": 2482 }, @@ -1845,5 +1845,9 @@ "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression.": { "category": "Error", "code": 9002 + }, + "For...of statements are not currently supported.": { + "category": "Error", + "code": 9003 } } diff --git a/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt b/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt index f3034cd2c27..b5117962a75 100644 --- a/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts(1,1): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts(1,1): error TS9003: For...of statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts (1 errors) ==== for (var i of e) { ~~~ -!!! error TS1036: Statements are not allowed in ambient contexts. +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement10.errors.txt b/tests/baselines/reference/parserES5ForOfStatement10.errors.txt index 7fdbe80e12e..7da7a0505e0 100644 --- a/tests/baselines/reference/parserES5ForOfStatement10.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement10.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts(1,6): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts(1,1): error TS9003: For...of statements are not currently supported. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts (1 errors) ==== for (const v of X) { ~~~ -!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher - ~~~~~ -!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement11.errors.txt b/tests/baselines/reference/parserES5ForOfStatement11.errors.txt index 146aff8f91b..f15beaa8f62 100644 --- a/tests/baselines/reference/parserES5ForOfStatement11.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement11.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts(1,6): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts(1,1): error TS9003: For...of statements are not currently supported. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts (1 errors) ==== for (const [a, b] of X) { ~~~ -!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher - ~~~~~ -!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement12.errors.txt b/tests/baselines/reference/parserES5ForOfStatement12.errors.txt index ea1ad1d8eb7..da8836c29d8 100644 --- a/tests/baselines/reference/parserES5ForOfStatement12.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement12.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts(1,6): error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts(1,1): error TS9003: For...of statements are not currently supported. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts (1 errors) ==== for (const {a, b} of X) { ~~~ -!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher - ~~~~~ -!!! error TS1154: 'const' declarations are only available when targeting ECMAScript 6 and higher. +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement13.errors.txt b/tests/baselines/reference/parserES5ForOfStatement13.errors.txt index 27dc44f094a..1f181b16e75 100644 --- a/tests/baselines/reference/parserES5ForOfStatement13.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement13.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts(1,6): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts(1,1): error TS9003: For...of statements are not currently supported. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts (1 errors) ==== for (let {a, b} of X) { ~~~ -!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement14.errors.txt b/tests/baselines/reference/parserES5ForOfStatement14.errors.txt index 9eba6e25c9a..a1d67e91bce 100644 --- a/tests/baselines/reference/parserES5ForOfStatement14.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement14.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts(1,6): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts(1,1): error TS9003: For...of statements are not currently supported. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts (1 errors) ==== for (let [a, b] of X) { ~~~ -!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement15.errors.txt b/tests/baselines/reference/parserES5ForOfStatement15.errors.txt index 2f39244ecd5..9c879f7cec4 100644 --- a/tests/baselines/reference/parserES5ForOfStatement15.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement15.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts(1,1): error TS9003: For...of statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts (1 errors) ==== for (var [a, b] of X) { ~~~ -!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement16.errors.txt b/tests/baselines/reference/parserES5ForOfStatement16.errors.txt index 80a45c0f8b5..fb0fe1b59cc 100644 --- a/tests/baselines/reference/parserES5ForOfStatement16.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement16.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts(1,1): error TS9003: For...of statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts (1 errors) ==== for (var {a, b} of X) { ~~~ -!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement18.errors.txt b/tests/baselines/reference/parserES5ForOfStatement18.errors.txt index e07b516abf0..7ddd631f6ec 100644 --- a/tests/baselines/reference/parserES5ForOfStatement18.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement18.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts(1,1): error TS9003: For...of statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts (1 errors) ==== for (var of of of) { } ~~~ -!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher \ No newline at end of file +!!! error TS9003: For...of statements are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement2.errors.txt b/tests/baselines/reference/parserES5ForOfStatement2.errors.txt index 70bf84999f5..309b145b84a 100644 --- a/tests/baselines/reference/parserES5ForOfStatement2.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement2.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts(1,9): error TS1123: Variable declaration list cannot be empty. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts(1,1): error TS9003: For...of statements are not currently supported. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts (1 errors) ==== for (var of X) { ~~~ -!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher - -!!! error TS1123: Variable declaration list cannot be empty. +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement21.errors.txt b/tests/baselines/reference/parserES5ForOfStatement21.errors.txt index 338d1e34b2f..9bd333c2592 100644 --- a/tests/baselines/reference/parserES5ForOfStatement21.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement21.errors.txt @@ -1,10 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts(1,9): error TS1123: Variable declaration list cannot be empty. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts(1,1): error TS9003: For...of statements are not currently supported. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts (1 errors) ==== for (var of of) { } ~~~ -!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher - -!!! error TS1123: Variable declaration list cannot be empty. \ No newline at end of file +!!! error TS9003: For...of statements are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement3.errors.txt b/tests/baselines/reference/parserES5ForOfStatement3.errors.txt index a976d9c0d54..78c0592f12d 100644 --- a/tests/baselines/reference/parserES5ForOfStatement3.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement3.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,13): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,1): error TS9003: For...of statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts (1 errors) ==== for (var a, b of X) { - ~ -!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. + ~~~ +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement4.errors.txt b/tests/baselines/reference/parserES5ForOfStatement4.errors.txt index e2b38b56be5..d456dcd2d22 100644 --- a/tests/baselines/reference/parserES5ForOfStatement4.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement4.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,10): error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,1): error TS9003: For...of statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts (1 errors) ==== for (var a = 1 of X) { - ~ -!!! error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer. + ~~~ +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement5.errors.txt b/tests/baselines/reference/parserES5ForOfStatement5.errors.txt index 0e88ce6cf36..45070d754cc 100644 --- a/tests/baselines/reference/parserES5ForOfStatement5.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,10): error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,1): error TS9003: For...of statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts (1 errors) ==== for (var a: number of X) { - ~ -!!! error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation. + ~~~ +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement6.errors.txt b/tests/baselines/reference/parserES5ForOfStatement6.errors.txt index da76589190d..85f2ce11537 100644 --- a/tests/baselines/reference/parserES5ForOfStatement6.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,17): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,1): error TS9003: For...of statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts (1 errors) ==== for (var a = 1, b = 2 of X) { - ~ -!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. + ~~~ +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement7.errors.txt b/tests/baselines/reference/parserES5ForOfStatement7.errors.txt index ced399ca103..0dddea7adc6 100644 --- a/tests/baselines/reference/parserES5ForOfStatement7.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement7.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,25): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,1): error TS9003: For...of statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts (1 errors) ==== for (var a: number = 1, b: string = "" of X) { - ~ -!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. + ~~~ +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement8.errors.txt b/tests/baselines/reference/parserES5ForOfStatement8.errors.txt index 739369e8f82..8707d03a135 100644 --- a/tests/baselines/reference/parserES5ForOfStatement8.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement8.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts(1,1): error TS9003: For...of statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts (1 errors) ==== for (var v of X) { ~~~ -!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement9.errors.txt b/tests/baselines/reference/parserES5ForOfStatement9.errors.txt index c03669fcb98..c41bc180a79 100644 --- a/tests/baselines/reference/parserES5ForOfStatement9.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement9.errors.txt @@ -1,11 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts(1,1): error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts(1,6): error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts(1,1): error TS9003: For...of statements are not currently supported. -==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts (2 errors) ==== +==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts (1 errors) ==== for (let v of X) { ~~~ -!!! error TS2482: For-of statements are only available when targeting ECMAScript 6 or higher - ~~~ -!!! error TS1153: 'let' declarations are only available when targeting ECMAScript 6 and higher. +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement1.d.errors.txt b/tests/baselines/reference/parserForOfStatement1.d.errors.txt index 3b1b2a65922..8961f8b7fbc 100644 --- a/tests/baselines/reference/parserForOfStatement1.d.errors.txt +++ b/tests/baselines/reference/parserForOfStatement1.d.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts(1,1): error TS1036: Statements are not allowed in ambient contexts. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts(1,1): error TS9003: For...of statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts (1 errors) ==== for (var i of e) { ~~~ -!!! error TS1036: Statements are not allowed in ambient contexts. +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement10.errors.txt b/tests/baselines/reference/parserForOfStatement10.errors.txt new file mode 100644 index 00000000000..71dbd6b9a15 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement10.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts(1,1): error TS9003: For...of statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts (1 errors) ==== + for (const v of X) { + ~~~ +!!! error TS9003: For...of statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement10.types b/tests/baselines/reference/parserForOfStatement10.types deleted file mode 100644 index 1707fa934cb..00000000000 --- a/tests/baselines/reference/parserForOfStatement10.types +++ /dev/null @@ -1,5 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts === -for (const v of X) { ->v : any ->X : unknown -} diff --git a/tests/baselines/reference/parserForOfStatement11.errors.txt b/tests/baselines/reference/parserForOfStatement11.errors.txt new file mode 100644 index 00000000000..9ed5ad72cf5 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement11.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts(1,1): error TS9003: For...of statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts (1 errors) ==== + for (const [a, b] of X) { + ~~~ +!!! error TS9003: For...of statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement11.types b/tests/baselines/reference/parserForOfStatement11.types deleted file mode 100644 index eebc0c6a864..00000000000 --- a/tests/baselines/reference/parserForOfStatement11.types +++ /dev/null @@ -1,6 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts === -for (const [a, b] of X) { ->a : any ->b : any ->X : unknown -} diff --git a/tests/baselines/reference/parserForOfStatement12.errors.txt b/tests/baselines/reference/parserForOfStatement12.errors.txt new file mode 100644 index 00000000000..da4a3e9a36d --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement12.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts(1,1): error TS9003: For...of statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts (1 errors) ==== + for (const {a, b} of X) { + ~~~ +!!! error TS9003: For...of statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement12.types b/tests/baselines/reference/parserForOfStatement12.types deleted file mode 100644 index 51071059db1..00000000000 --- a/tests/baselines/reference/parserForOfStatement12.types +++ /dev/null @@ -1,6 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts === -for (const {a, b} of X) { ->a : any ->b : any ->X : unknown -} diff --git a/tests/baselines/reference/parserForOfStatement13.errors.txt b/tests/baselines/reference/parserForOfStatement13.errors.txt new file mode 100644 index 00000000000..b01f4ecd52b --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement13.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts(1,1): error TS9003: For...of statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts (1 errors) ==== + for (let {a, b} of X) { + ~~~ +!!! error TS9003: For...of statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement13.types b/tests/baselines/reference/parserForOfStatement13.types deleted file mode 100644 index 22c7af5605c..00000000000 --- a/tests/baselines/reference/parserForOfStatement13.types +++ /dev/null @@ -1,6 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts === -for (let {a, b} of X) { ->a : any ->b : any ->X : unknown -} diff --git a/tests/baselines/reference/parserForOfStatement14.errors.txt b/tests/baselines/reference/parserForOfStatement14.errors.txt new file mode 100644 index 00000000000..2a4b79e35f1 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement14.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts(1,1): error TS9003: For...of statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts (1 errors) ==== + for (let [a, b] of X) { + ~~~ +!!! error TS9003: For...of statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement14.types b/tests/baselines/reference/parserForOfStatement14.types deleted file mode 100644 index f255015bb15..00000000000 --- a/tests/baselines/reference/parserForOfStatement14.types +++ /dev/null @@ -1,6 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts === -for (let [a, b] of X) { ->a : any ->b : any ->X : unknown -} diff --git a/tests/baselines/reference/parserForOfStatement15.errors.txt b/tests/baselines/reference/parserForOfStatement15.errors.txt new file mode 100644 index 00000000000..920cb21c6e1 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement15.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts(1,1): error TS9003: For...of statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts (1 errors) ==== + for (var [a, b] of X) { + ~~~ +!!! error TS9003: For...of statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement15.types b/tests/baselines/reference/parserForOfStatement15.types deleted file mode 100644 index bf6faf3478e..00000000000 --- a/tests/baselines/reference/parserForOfStatement15.types +++ /dev/null @@ -1,6 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts === -for (var [a, b] of X) { ->a : any ->b : any ->X : unknown -} diff --git a/tests/baselines/reference/parserForOfStatement16.errors.txt b/tests/baselines/reference/parserForOfStatement16.errors.txt new file mode 100644 index 00000000000..b13c13168bd --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement16.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts(1,1): error TS9003: For...of statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts (1 errors) ==== + for (var {a, b} of X) { + ~~~ +!!! error TS9003: For...of statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement16.types b/tests/baselines/reference/parserForOfStatement16.types deleted file mode 100644 index 48476dfae0a..00000000000 --- a/tests/baselines/reference/parserForOfStatement16.types +++ /dev/null @@ -1,6 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts === -for (var {a, b} of X) { ->a : any ->b : any ->X : unknown -} diff --git a/tests/baselines/reference/parserForOfStatement18.errors.txt b/tests/baselines/reference/parserForOfStatement18.errors.txt new file mode 100644 index 00000000000..35f63cbd95c --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement18.errors.txt @@ -0,0 +1,7 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts(1,1): error TS9003: For...of statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts (1 errors) ==== + for (var of of of) { } + ~~~ +!!! error TS9003: For...of statements are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement18.types b/tests/baselines/reference/parserForOfStatement18.types deleted file mode 100644 index 8e3b52ac877..00000000000 --- a/tests/baselines/reference/parserForOfStatement18.types +++ /dev/null @@ -1,5 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts === -for (var of of of) { } ->of : any ->of : any - diff --git a/tests/baselines/reference/parserForOfStatement2.errors.txt b/tests/baselines/reference/parserForOfStatement2.errors.txt index 7229fe4196d..88bac913833 100644 --- a/tests/baselines/reference/parserForOfStatement2.errors.txt +++ b/tests/baselines/reference/parserForOfStatement2.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts(1,9): error TS1123: Variable declaration list cannot be empty. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts(1,1): error TS9003: For...of statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts (1 errors) ==== for (var of X) { - -!!! error TS1123: Variable declaration list cannot be empty. + ~~~ +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement21.errors.txt b/tests/baselines/reference/parserForOfStatement21.errors.txt index 9103e2fedee..091a5c116eb 100644 --- a/tests/baselines/reference/parserForOfStatement21.errors.txt +++ b/tests/baselines/reference/parserForOfStatement21.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts(1,9): error TS1123: Variable declaration list cannot be empty. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts(1,1): error TS9003: For...of statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts (1 errors) ==== for (var of of) { } - -!!! error TS1123: Variable declaration list cannot be empty. \ No newline at end of file + ~~~ +!!! error TS9003: For...of statements are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement3.errors.txt b/tests/baselines/reference/parserForOfStatement3.errors.txt index 995ef4637c2..18127a69310 100644 --- a/tests/baselines/reference/parserForOfStatement3.errors.txt +++ b/tests/baselines/reference/parserForOfStatement3.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts(1,13): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts(1,1): error TS9003: For...of statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts (1 errors) ==== for (var a, b of X) { - ~ -!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. + ~~~ +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement4.errors.txt b/tests/baselines/reference/parserForOfStatement4.errors.txt index 65b4bf342f2..bee92e3035e 100644 --- a/tests/baselines/reference/parserForOfStatement4.errors.txt +++ b/tests/baselines/reference/parserForOfStatement4.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts(1,10): error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts(1,1): error TS9003: For...of statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts (1 errors) ==== for (var a = 1 of X) { - ~ -!!! error TS1190: The variable declaration of a 'for...of' statement cannot have an initializer. + ~~~ +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement5.errors.txt b/tests/baselines/reference/parserForOfStatement5.errors.txt index 13fd8739866..a1cc609fe81 100644 --- a/tests/baselines/reference/parserForOfStatement5.errors.txt +++ b/tests/baselines/reference/parserForOfStatement5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts(1,10): error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts(1,1): error TS9003: For...of statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts (1 errors) ==== for (var a: number of X) { - ~ -!!! error TS2483: The left-hand side of a 'for...of' statement cannot use a type annotation. + ~~~ +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement6.errors.txt b/tests/baselines/reference/parserForOfStatement6.errors.txt index 57d95361b65..477544babe9 100644 --- a/tests/baselines/reference/parserForOfStatement6.errors.txt +++ b/tests/baselines/reference/parserForOfStatement6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts(1,17): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts(1,1): error TS9003: For...of statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts (1 errors) ==== for (var a = 1, b = 2 of X) { - ~ -!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. + ~~~ +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement7.errors.txt b/tests/baselines/reference/parserForOfStatement7.errors.txt index 07f93c263ec..c03d9451f5d 100644 --- a/tests/baselines/reference/parserForOfStatement7.errors.txt +++ b/tests/baselines/reference/parserForOfStatement7.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts(1,25): error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts(1,1): error TS9003: For...of statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts (1 errors) ==== for (var a: number = 1, b: string = "" of X) { - ~ -!!! error TS1188: Only a single variable declaration is allowed in a 'for...of' statement. + ~~~ +!!! error TS9003: For...of statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement8.errors.txt b/tests/baselines/reference/parserForOfStatement8.errors.txt new file mode 100644 index 00000000000..1f0e9215584 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement8.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts(1,1): error TS9003: For...of statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts (1 errors) ==== + for (var v of X) { + ~~~ +!!! error TS9003: For...of statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement8.types b/tests/baselines/reference/parserForOfStatement8.types deleted file mode 100644 index a4168caf262..00000000000 --- a/tests/baselines/reference/parserForOfStatement8.types +++ /dev/null @@ -1,5 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts === -for (var v of X) { ->v : any ->X : unknown -} diff --git a/tests/baselines/reference/parserForOfStatement9.errors.txt b/tests/baselines/reference/parserForOfStatement9.errors.txt new file mode 100644 index 00000000000..18f0f41a2e9 --- /dev/null +++ b/tests/baselines/reference/parserForOfStatement9.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts(1,1): error TS9003: For...of statements are not currently supported. + + +==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts (1 errors) ==== + for (let v of X) { + ~~~ +!!! error TS9003: For...of statements are not currently supported. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement9.types b/tests/baselines/reference/parserForOfStatement9.types deleted file mode 100644 index 0285a3e4b76..00000000000 --- a/tests/baselines/reference/parserForOfStatement9.types +++ /dev/null @@ -1,5 +0,0 @@ -=== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts === -for (let v of X) { ->v : any ->X : unknown -} From 826ed0545b01099cb5cc455accff98b6aec6e514 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 18 Feb 2015 12:01:24 -0800 Subject: [PATCH 128/162] Addressed CR feedback. --- src/compiler/emitter.ts | 49 +++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index f456d968e6d..40338636c3e 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2520,7 +2520,7 @@ module ts { } for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) { - writeSeparator(); + writeComma(); var property = properties[i]; @@ -2593,7 +2593,7 @@ module ts { emitEnd(property); } - writeSeparator(); + writeComma(); emit(tempVar); if (multiLine) { @@ -2603,7 +2603,7 @@ module ts { write(")"); - function writeSeparator() { + function writeComma() { if (multiLine) { write(","); writeLine(); @@ -2614,31 +2614,32 @@ module ts { } } - function emitObjectLiteral(node: ObjectLiteralExpression) { - if (languageVersion >= ScriptTarget.ES6) { - emitObjectLiteralBody(node, node.properties.length); - return; - } - + function emitObjectLiteral(node: ObjectLiteralExpression): void { var properties = node.properties; - // Find the first computed property. - // Everything until that point can be emitted as part of the initial object literal. - var numInitialNonComputedProperties = properties.length; - forEach(properties, (property, i) => { - if (hasDynamicName(properties[i])) { - numInitialNonComputedProperties = i; - return true; - } - }); + if (languageVersion < ScriptTarget.ES6) { - var hasComputedProperty = numInitialNonComputedProperties !== properties.length; - if (hasComputedProperty) { - emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); - } - else { - emitObjectLiteralBody(node, properties.length); + // Find the first computed property. + // Everything until that point can be emitted as part of the initial object literal. + var numProperties = properties.length; + var numInitialNonComputedProperties = numProperties; + for (var i = 0, n = properties.length; i < n; i++) { + if (properties[i].name.kind === SyntaxKind.ComputedPropertyName) { + numInitialNonComputedProperties = i; + break; + } + } + + var hasComputedProperty = numInitialNonComputedProperties !== properties.length; + if (hasComputedProperty) { + emitDownlevelObjectLiteralWithComputedProperties(node, numInitialNonComputedProperties); + return; + } } + + // Ordinary case: either the object has no computed properties + // or we're compiling with an ES6+ target. + emitObjectLiteralBody(node, properties.length); } function emitComputedPropertyName(node: ComputedPropertyName) { From a6c55058814f819c32f75f44dca2f76a36aefc9a Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 18 Feb 2015 12:10:00 -0800 Subject: [PATCH 129/162] Created a combined 'createAndRecordTempVariable' function. --- src/compiler/emitter.ts | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 40338636c3e..06648fb90db 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2002,13 +2002,20 @@ module ts { return result; } - function recordTempDeclaration(name: Identifier) { + function recordTempDeclaration(name: Identifier): void { if (!tempVariables) { tempVariables = []; } tempVariables.push(name); } + function createAndRecordTempVariable(location: Node): Identifier { + var temp = createTempVariable(location, /*forLoopVariable*/ false); + recordTempDeclaration(temp); + + return temp; + } + function emitTempDeclarations(newLine: boolean) { if (tempVariables) { if (newLine) { @@ -2505,8 +2512,7 @@ module ts { // For computed properties, we need to create a unique handle to the object // literal so we can modify it without risking internal assignments tainting the object. - var tempVar = createTempVariable(node); - recordTempDeclaration(tempVar); + var tempVar = createAndRecordTempVariable(node); // Write out the first non-computed properties // (or all properties if none of them are computed), @@ -2735,8 +2741,8 @@ module ts { emit(node); return node; } - var temp = createTempVariable(node); - recordTempDeclaration(temp); + var temp = createAndRecordTempVariable(node); + write("("); emit(temp); write(" = "); From 6c32a6aca8c098886b03edb7293ddbc2556206c5 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Wed, 18 Feb 2015 14:39:07 -0800 Subject: [PATCH 130/162] Address feedback --- src/compiler/checker.ts | 61 +++++++++---------- .../diagnosticInformationMap.generated.ts | 4 +- src/compiler/diagnosticMessages.json | 4 +- .../parserES5ForOfStatement1.d.errors.txt | 4 +- .../parserES5ForOfStatement10.errors.txt | 4 +- .../parserES5ForOfStatement11.errors.txt | 4 +- .../parserES5ForOfStatement12.errors.txt | 4 +- .../parserES5ForOfStatement13.errors.txt | 4 +- .../parserES5ForOfStatement14.errors.txt | 4 +- .../parserES5ForOfStatement15.errors.txt | 4 +- .../parserES5ForOfStatement16.errors.txt | 4 +- .../parserES5ForOfStatement18.errors.txt | 4 +- .../parserES5ForOfStatement2.errors.txt | 4 +- .../parserES5ForOfStatement21.errors.txt | 4 +- .../parserES5ForOfStatement3.errors.txt | 4 +- .../parserES5ForOfStatement4.errors.txt | 4 +- .../parserES5ForOfStatement5.errors.txt | 4 +- .../parserES5ForOfStatement6.errors.txt | 4 +- .../parserES5ForOfStatement7.errors.txt | 4 +- .../parserES5ForOfStatement8.errors.txt | 4 +- .../parserES5ForOfStatement9.errors.txt | 4 +- .../parserForOfStatement1.d.errors.txt | 4 +- .../parserForOfStatement10.errors.txt | 4 +- .../parserForOfStatement11.errors.txt | 4 +- .../parserForOfStatement12.errors.txt | 4 +- .../parserForOfStatement13.errors.txt | 4 +- .../parserForOfStatement14.errors.txt | 4 +- .../parserForOfStatement15.errors.txt | 4 +- .../parserForOfStatement16.errors.txt | 4 +- .../parserForOfStatement18.errors.txt | 4 +- .../parserForOfStatement2.errors.txt | 4 +- .../parserForOfStatement21.errors.txt | 4 +- .../parserForOfStatement3.errors.txt | 4 +- .../parserForOfStatement4.errors.txt | 4 +- .../parserForOfStatement5.errors.txt | 4 +- .../parserForOfStatement6.errors.txt | 4 +- .../parserForOfStatement7.errors.txt | 4 +- .../parserForOfStatement8.errors.txt | 4 +- .../parserForOfStatement9.errors.txt | 4 +- 39 files changed, 105 insertions(+), 108 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 37de87ea83b..e94a125faed 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8082,7 +8082,7 @@ module ts { function checkBlock(node: Block) { // Grammar checking for SyntaxKind.Block if (node.kind === SyntaxKind.Block) { - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); } forEach(node.statements, checkSourceElement); @@ -8396,14 +8396,14 @@ module ts { function checkExpressionStatement(node: ExpressionStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node) + checkGrammarStatementInAmbientContext(node) checkExpression(node.expression); } function checkIfStatement(node: IfStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.thenStatement); @@ -8412,7 +8412,7 @@ module ts { function checkDoStatement(node: DoStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkSourceElement(node.statement); checkExpression(node.expression); @@ -8420,7 +8420,7 @@ module ts { function checkWhileStatement(node: WhileStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkExpression(node.expression); checkSourceElement(node.statement); @@ -8428,7 +8428,7 @@ module ts { function checkForStatement(node: ForStatement) { // Grammar checking - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { if (node.initializer && node.initializer.kind == SyntaxKind.VariableDeclarationList) { checkGrammarVariableDeclarationList(node.initializer); } @@ -8497,7 +8497,7 @@ module ts { function checkBreakOrContinueStatement(node: BreakOrContinueStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); + checkGrammarStatementInAmbientContext(node) || checkGrammarBreakOrContinueStatement(node); // TODO: Check that target label is valid } @@ -8508,7 +8508,7 @@ module ts { function checkReturnStatement(node: ReturnStatement) { // Grammar checking - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { var functionBlock = getContainingFunction(node); if (!functionBlock) { grammarErrorOnFirstToken(node, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body); @@ -8539,7 +8539,7 @@ module ts { function checkWithStatement(node: WithStatement) { // Grammar checking for withStatement - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { if (node.parserContextFlags & ParserContextFlags.StrictMode) { grammarErrorOnFirstToken(node, Diagnostics.with_statements_are_not_allowed_in_strict_mode); } @@ -8551,7 +8551,7 @@ module ts { function checkSwitchStatement(node: SwitchStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); var firstDefaultClause: CaseOrDefaultClause; var hasDuplicateDefaultClause = false; @@ -8588,7 +8588,7 @@ module ts { function checkLabeledStatement(node: LabeledStatement) { // Grammar checking - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { var current = node.parent; while (current) { if (isAnyFunction(current)) { @@ -8609,7 +8609,7 @@ module ts { function checkThrowStatement(node: ThrowStatement) { // Grammar checking - if (!checkGrammarForStatementInAmbientContext(node)) { + if (!checkGrammarStatementInAmbientContext(node)) { if (node.expression === undefined) { grammarErrorAfterFirstToken(node, Diagnostics.Line_break_not_permitted_here); } @@ -8622,7 +8622,7 @@ module ts { function checkTryStatement(node: TryStatement) { // Grammar checking - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); checkBlock(node.tryBlock); var catchClause = node.catchClause; @@ -9480,10 +9480,10 @@ module ts { case SyntaxKind.ExportAssignment: return checkExportAssignment(node); case SyntaxKind.EmptyStatement: - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); return; case SyntaxKind.DebuggerStatement: - checkGrammarForStatementInAmbientContext(node); + checkGrammarStatementInAmbientContext(node); return; } } @@ -10753,7 +10753,7 @@ module ts { } function checkGrammarForInOrForOfStatement(forInOrOfStatement: ForInStatement | ForOfStatement): boolean { - if (checkGrammarForStatementInAmbientContext(forInOrOfStatement)) { + if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) { return true; } @@ -10761,22 +10761,22 @@ module ts { var variableList = forInOrOfStatement.initializer; if (!checkGrammarVariableDeclarationList(variableList)) { if (variableList.declarations.length > 1) { - var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement ? - Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement : - Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; + var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement + ? Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement + : Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement; return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic); } var firstDeclaration = variableList.declarations[0]; if (firstDeclaration.initializer) { - var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement ? - Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer : - Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; + var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement + ? Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer + : Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer; return grammarErrorOnNode(firstDeclaration.name, diagnostic); } if (firstDeclaration.type) { - var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement ? - Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation : - Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; + var diagnostic = forInOrOfStatement.kind === SyntaxKind.ForInStatement + ? Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation + : Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation; return grammarErrorOnNode(firstDeclaration, diagnostic); } } @@ -10787,15 +10787,12 @@ module ts { function checkGrammarForOfStatement(forOfStatement: ForOfStatement): boolean { // Temporarily disallow for-of statements until type check work is complete. - return grammarErrorOnFirstToken(forOfStatement, Diagnostics.For_of_statements_are_not_currently_supported); - if (checkGrammarForInOrForOfStatement(forOfStatement)) { - return true; - } + return grammarErrorOnFirstToken(forOfStatement, Diagnostics.for_of_statements_are_not_currently_supported); if (languageVersion < ScriptTarget.ES6) { - return grammarErrorOnFirstToken(forOfStatement, Diagnostics.For_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); + return grammarErrorOnFirstToken(forOfStatement, Diagnostics.for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher); } - return false; + return checkGrammarForInOrForOfStatement(forOfStatement); } function checkGrammarAccessor(accessor: MethodDeclaration): boolean { @@ -11235,7 +11232,7 @@ module ts { return isInAmbientContext(node) && checkGrammarTopLevelElementsForRequiredDeclareModifier(node); } - function checkGrammarForStatementInAmbientContext(node: Node): boolean { + function checkGrammarStatementInAmbientContext(node: Node): boolean { if (isInAmbientContext(node)) { // An accessors is already reported about the ambient context if (isAccessor(node.parent.kind)) { diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 2fbe9b49457..db0058f64db 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -316,7 +316,7 @@ module ts { Property_0_does_not_exist_on_const_enum_1: { code: 2475, category: DiagnosticCategory.Error, key: "Property '{0}' does not exist on 'const' enum '{1}'." }, let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations: { code: 2476, category: DiagnosticCategory.Error, key: "'let' is not allowed to be used as a name in 'let' or 'const' declarations." }, Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1: { code: 2477, category: DiagnosticCategory.Error, key: "Cannot initialize outer scoped variable '{0}' in the same scope as block scoped declaration '{1}'." }, - For_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: DiagnosticCategory.Error, key: "For...of statements are only available when targeting ECMAScript 6 or higher." }, + for_of_statements_are_only_available_when_targeting_ECMAScript_6_or_higher: { code: 2482, category: DiagnosticCategory.Error, key: "'for...of' statements are only available when targeting ECMAScript 6 or higher." }, The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation: { code: 2483, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...of' statement cannot use a type annotation." }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, @@ -463,6 +463,6 @@ module ts { yield_expressions_are_not_currently_supported: { code: 9000, category: DiagnosticCategory.Error, key: "'yield' expressions are not currently supported." }, Generators_are_not_currently_supported: { code: 9001, category: DiagnosticCategory.Error, key: "Generators are not currently supported." }, The_arguments_object_cannot_be_referenced_in_an_arrow_function_Consider_using_a_standard_function_expression: { code: 9002, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function. Consider using a standard function expression." }, - For_of_statements_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "For...of statements are not currently supported." }, + for_of_statements_are_not_currently_supported: { code: 9003, category: DiagnosticCategory.Error, key: "'for...of' statements are not currently supported." }, }; } \ No newline at end of file diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 1b81d14ffda..0ba9c6729f3 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1256,7 +1256,7 @@ "category": "Error", "code": 2477 }, - "For...of statements are only available when targeting ECMAScript 6 or higher.": { + "'for...of' statements are only available when targeting ECMAScript 6 or higher.": { "category": "Error", "code": 2482 }, @@ -1846,7 +1846,7 @@ "category": "Error", "code": 9002 }, - "For...of statements are not currently supported.": { + "'for...of' statements are not currently supported.": { "category": "Error", "code": 9003 } diff --git a/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt b/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt index b5117962a75..9c1a39b1f4a 100644 --- a/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement1.d.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement1.d.ts (1 errors) ==== for (var i of e) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement10.errors.txt b/tests/baselines/reference/parserES5ForOfStatement10.errors.txt index 7da7a0505e0..d7f411b1879 100644 --- a/tests/baselines/reference/parserES5ForOfStatement10.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement10.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement10.ts (1 errors) ==== for (const v of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement11.errors.txt b/tests/baselines/reference/parserES5ForOfStatement11.errors.txt index f15beaa8f62..48805a336c7 100644 --- a/tests/baselines/reference/parserES5ForOfStatement11.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement11.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement11.ts (1 errors) ==== for (const [a, b] of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement12.errors.txt b/tests/baselines/reference/parserES5ForOfStatement12.errors.txt index da8836c29d8..3b9f242b975 100644 --- a/tests/baselines/reference/parserES5ForOfStatement12.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement12.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement12.ts (1 errors) ==== for (const {a, b} of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement13.errors.txt b/tests/baselines/reference/parserES5ForOfStatement13.errors.txt index 1f181b16e75..8b8c8ce0868 100644 --- a/tests/baselines/reference/parserES5ForOfStatement13.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement13.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement13.ts (1 errors) ==== for (let {a, b} of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement14.errors.txt b/tests/baselines/reference/parserES5ForOfStatement14.errors.txt index a1d67e91bce..dc4db95270a 100644 --- a/tests/baselines/reference/parserES5ForOfStatement14.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement14.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement14.ts (1 errors) ==== for (let [a, b] of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement15.errors.txt b/tests/baselines/reference/parserES5ForOfStatement15.errors.txt index 9c879f7cec4..07aa6dd5b37 100644 --- a/tests/baselines/reference/parserES5ForOfStatement15.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement15.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement15.ts (1 errors) ==== for (var [a, b] of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement16.errors.txt b/tests/baselines/reference/parserES5ForOfStatement16.errors.txt index fb0fe1b59cc..15a3e4f7f0b 100644 --- a/tests/baselines/reference/parserES5ForOfStatement16.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement16.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement16.ts (1 errors) ==== for (var {a, b} of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement18.errors.txt b/tests/baselines/reference/parserES5ForOfStatement18.errors.txt index 7ddd631f6ec..fc314e51012 100644 --- a/tests/baselines/reference/parserES5ForOfStatement18.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement18.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement18.ts (1 errors) ==== for (var of of of) { } ~~~ -!!! error TS9003: For...of statements are not currently supported. \ No newline at end of file +!!! error TS9003: 'for...of' statements are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement2.errors.txt b/tests/baselines/reference/parserES5ForOfStatement2.errors.txt index 309b145b84a..347ae29ddb8 100644 --- a/tests/baselines/reference/parserES5ForOfStatement2.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement2.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement2.ts (1 errors) ==== for (var of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement21.errors.txt b/tests/baselines/reference/parserES5ForOfStatement21.errors.txt index 9bd333c2592..2ddbf4b5666 100644 --- a/tests/baselines/reference/parserES5ForOfStatement21.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement21.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement21.ts (1 errors) ==== for (var of of) { } ~~~ -!!! error TS9003: For...of statements are not currently supported. \ No newline at end of file +!!! error TS9003: 'for...of' statements are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement3.errors.txt b/tests/baselines/reference/parserES5ForOfStatement3.errors.txt index 78c0592f12d..553ca40aee0 100644 --- a/tests/baselines/reference/parserES5ForOfStatement3.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement3.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement3.ts (1 errors) ==== for (var a, b of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement4.errors.txt b/tests/baselines/reference/parserES5ForOfStatement4.errors.txt index d456dcd2d22..6a08c8942ed 100644 --- a/tests/baselines/reference/parserES5ForOfStatement4.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement4.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement4.ts (1 errors) ==== for (var a = 1 of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement5.errors.txt b/tests/baselines/reference/parserES5ForOfStatement5.errors.txt index 45070d754cc..212eae8ac10 100644 --- a/tests/baselines/reference/parserES5ForOfStatement5.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement5.ts (1 errors) ==== for (var a: number of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement6.errors.txt b/tests/baselines/reference/parserES5ForOfStatement6.errors.txt index 85f2ce11537..e331b66eb85 100644 --- a/tests/baselines/reference/parserES5ForOfStatement6.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement6.ts (1 errors) ==== for (var a = 1, b = 2 of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement7.errors.txt b/tests/baselines/reference/parserES5ForOfStatement7.errors.txt index 0dddea7adc6..5ba60c264eb 100644 --- a/tests/baselines/reference/parserES5ForOfStatement7.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement7.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement7.ts (1 errors) ==== for (var a: number = 1, b: string = "" of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement8.errors.txt b/tests/baselines/reference/parserES5ForOfStatement8.errors.txt index 8707d03a135..3696bf11f8c 100644 --- a/tests/baselines/reference/parserES5ForOfStatement8.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement8.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement8.ts (1 errors) ==== for (var v of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ForOfStatement9.errors.txt b/tests/baselines/reference/parserES5ForOfStatement9.errors.txt index c41bc180a79..6e2e9d05705 100644 --- a/tests/baselines/reference/parserES5ForOfStatement9.errors.txt +++ b/tests/baselines/reference/parserES5ForOfStatement9.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript5/Statements/parserES5ForOfStatement9.ts (1 errors) ==== for (let v of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement1.d.errors.txt b/tests/baselines/reference/parserForOfStatement1.d.errors.txt index 8961f8b7fbc..05af0a6f775 100644 --- a/tests/baselines/reference/parserForOfStatement1.d.errors.txt +++ b/tests/baselines/reference/parserForOfStatement1.d.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement1.d.ts (1 errors) ==== for (var i of e) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement10.errors.txt b/tests/baselines/reference/parserForOfStatement10.errors.txt index 71dbd6b9a15..570c319b51f 100644 --- a/tests/baselines/reference/parserForOfStatement10.errors.txt +++ b/tests/baselines/reference/parserForOfStatement10.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement10.ts (1 errors) ==== for (const v of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement11.errors.txt b/tests/baselines/reference/parserForOfStatement11.errors.txt index 9ed5ad72cf5..f253a2d4295 100644 --- a/tests/baselines/reference/parserForOfStatement11.errors.txt +++ b/tests/baselines/reference/parserForOfStatement11.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement11.ts (1 errors) ==== for (const [a, b] of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement12.errors.txt b/tests/baselines/reference/parserForOfStatement12.errors.txt index da4a3e9a36d..07ef4498984 100644 --- a/tests/baselines/reference/parserForOfStatement12.errors.txt +++ b/tests/baselines/reference/parserForOfStatement12.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement12.ts (1 errors) ==== for (const {a, b} of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement13.errors.txt b/tests/baselines/reference/parserForOfStatement13.errors.txt index b01f4ecd52b..6c10a7b0582 100644 --- a/tests/baselines/reference/parserForOfStatement13.errors.txt +++ b/tests/baselines/reference/parserForOfStatement13.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement13.ts (1 errors) ==== for (let {a, b} of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement14.errors.txt b/tests/baselines/reference/parserForOfStatement14.errors.txt index 2a4b79e35f1..209a39c0513 100644 --- a/tests/baselines/reference/parserForOfStatement14.errors.txt +++ b/tests/baselines/reference/parserForOfStatement14.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement14.ts (1 errors) ==== for (let [a, b] of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement15.errors.txt b/tests/baselines/reference/parserForOfStatement15.errors.txt index 920cb21c6e1..c5fd77af299 100644 --- a/tests/baselines/reference/parserForOfStatement15.errors.txt +++ b/tests/baselines/reference/parserForOfStatement15.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement15.ts (1 errors) ==== for (var [a, b] of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement16.errors.txt b/tests/baselines/reference/parserForOfStatement16.errors.txt index b13c13168bd..d169eef1256 100644 --- a/tests/baselines/reference/parserForOfStatement16.errors.txt +++ b/tests/baselines/reference/parserForOfStatement16.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement16.ts (1 errors) ==== for (var {a, b} of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement18.errors.txt b/tests/baselines/reference/parserForOfStatement18.errors.txt index 35f63cbd95c..9312af76fc1 100644 --- a/tests/baselines/reference/parserForOfStatement18.errors.txt +++ b/tests/baselines/reference/parserForOfStatement18.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement18.ts (1 errors) ==== for (var of of of) { } ~~~ -!!! error TS9003: For...of statements are not currently supported. \ No newline at end of file +!!! error TS9003: 'for...of' statements are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement2.errors.txt b/tests/baselines/reference/parserForOfStatement2.errors.txt index 88bac913833..8e7da497308 100644 --- a/tests/baselines/reference/parserForOfStatement2.errors.txt +++ b/tests/baselines/reference/parserForOfStatement2.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement2.ts (1 errors) ==== for (var of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement21.errors.txt b/tests/baselines/reference/parserForOfStatement21.errors.txt index 091a5c116eb..dad48f415cd 100644 --- a/tests/baselines/reference/parserForOfStatement21.errors.txt +++ b/tests/baselines/reference/parserForOfStatement21.errors.txt @@ -1,7 +1,7 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement21.ts (1 errors) ==== for (var of of) { } ~~~ -!!! error TS9003: For...of statements are not currently supported. \ No newline at end of file +!!! error TS9003: 'for...of' statements are not currently supported. \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement3.errors.txt b/tests/baselines/reference/parserForOfStatement3.errors.txt index 18127a69310..83985f1a710 100644 --- a/tests/baselines/reference/parserForOfStatement3.errors.txt +++ b/tests/baselines/reference/parserForOfStatement3.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement3.ts (1 errors) ==== for (var a, b of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement4.errors.txt b/tests/baselines/reference/parserForOfStatement4.errors.txt index bee92e3035e..94dd08ed597 100644 --- a/tests/baselines/reference/parserForOfStatement4.errors.txt +++ b/tests/baselines/reference/parserForOfStatement4.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement4.ts (1 errors) ==== for (var a = 1 of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement5.errors.txt b/tests/baselines/reference/parserForOfStatement5.errors.txt index a1cc609fe81..6570f4a0755 100644 --- a/tests/baselines/reference/parserForOfStatement5.errors.txt +++ b/tests/baselines/reference/parserForOfStatement5.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement5.ts (1 errors) ==== for (var a: number of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement6.errors.txt b/tests/baselines/reference/parserForOfStatement6.errors.txt index 477544babe9..6208749911f 100644 --- a/tests/baselines/reference/parserForOfStatement6.errors.txt +++ b/tests/baselines/reference/parserForOfStatement6.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement6.ts (1 errors) ==== for (var a = 1, b = 2 of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement7.errors.txt b/tests/baselines/reference/parserForOfStatement7.errors.txt index c03d9451f5d..1810daad5ee 100644 --- a/tests/baselines/reference/parserForOfStatement7.errors.txt +++ b/tests/baselines/reference/parserForOfStatement7.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement7.ts (1 errors) ==== for (var a: number = 1, b: string = "" of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement8.errors.txt b/tests/baselines/reference/parserForOfStatement8.errors.txt index 1f0e9215584..8e2c41d0cef 100644 --- a/tests/baselines/reference/parserForOfStatement8.errors.txt +++ b/tests/baselines/reference/parserForOfStatement8.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement8.ts (1 errors) ==== for (var v of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file diff --git a/tests/baselines/reference/parserForOfStatement9.errors.txt b/tests/baselines/reference/parserForOfStatement9.errors.txt index 18f0f41a2e9..01fd729e9cd 100644 --- a/tests/baselines/reference/parserForOfStatement9.errors.txt +++ b/tests/baselines/reference/parserForOfStatement9.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts(1,1): error TS9003: For...of statements are not currently supported. +tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts(1,1): error TS9003: 'for...of' statements are not currently supported. ==== tests/cases/conformance/parser/ecmascript6/Iterators/parserForOfStatement9.ts (1 errors) ==== for (let v of X) { ~~~ -!!! error TS9003: For...of statements are not currently supported. +!!! error TS9003: 'for...of' statements are not currently supported. } \ No newline at end of file From 4b590836e7e16a2bb65f9c9e18d64956c1883904 Mon Sep 17 00:00:00 2001 From: steveluc Date: Wed, 18 Feb 2015 15:12:35 -0800 Subject: [PATCH 131/162] Split completions req/response pair into two messages "completions" and "completionEntryDetails". This mirrors the function of the LS API and increases performance of completion in large projects. --- src/server/client.ts | 31 +++++++++++++------------ src/server/protocol.d.ts | 43 +++++++++++++++++++++++++++------- src/server/session.ts | 50 +++++++++++++++++++++++++--------------- 3 files changed, 83 insertions(+), 41 deletions(-) diff --git a/src/server/client.ts b/src/server/client.ts index d51777c2e99..a0b68de840e 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -1,5 +1,5 @@ /// - + module ts.server { export interface SessionClientHost extends LanguageServiceHost { @@ -172,7 +172,7 @@ module ts.server { documentation: [{ kind: "text", text: response.body.documentation }] }; } - + getCompletionsAtPosition(fileName: string, position: number): CompletionInfo { var lineCol = this.positionToOneBasedLineCol(fileName, position); var args: protocol.CompletionsRequestArgs = { @@ -185,27 +185,28 @@ module ts.server { var request = this.processRequest(CommandNames.Completions, args); var response = this.processResponse(request); - return this.lastCompletionEntry = { + return { isMemberCompletion: false, isNewIdentifierLocation: false, - entries: response.body.map(entry => ({ - kind: entry.kind, - kindModifiers: entry.kindModifiers, - name: entry.name, - displayParts: entry.displayParts, - documentation: entry.documentation - })), + entries: response.body, fileName: fileName, position: position }; } - + getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails { - if (!this.lastCompletionEntry || this.lastCompletionEntry.fileName !== fileName || this.lastCompletionEntry.position !== position) { - this.getCompletionsAtPosition(fileName, position); - } + var lineCol = this.positionToOneBasedLineCol(fileName, position); + var args: protocol.CompletionDetailsRequestArgs = { + file: fileName, + line: lineCol.line, + col: lineCol.col, + entryNames: [entryName] + }; - return this.lastCompletionEntry.entries.filter(entry => entry.name === entryName)[0]; + var request = this.processRequest(CommandNames.CompletionDetails, args); + var response = this.processResponse(request); + Debug.assert(response.body.length == 1, "Unexpected length of completion details response body."); + return response.body[0]; } getNavigateToItems(searchTerm: string): NavigateToItem[] { diff --git a/src/server/protocol.d.ts b/src/server/protocol.d.ts index a446f0176ae..b07fb20d48d 100644 --- a/src/server/protocol.d.ts +++ b/src/server/protocol.d.ts @@ -471,6 +471,26 @@ declare module ts.server.protocol { arguments: CompletionsRequestArgs; } + /** + * Arguments for completion details request. + */ + export interface CompletionDetailsRequestArgs extends FileLocationRequestArgs { + /** + * Names of one or more entries for which to obtain details. + */ + entryNames: string[]; + } + + /** + * Completion entry details request; value of command field is + * "completionEntryDetails". Given a file location (file, line, + * col) and an array of completion entry names return more + * detailed information for each completion entry. + */ + export interface CompletionDetailsRequest extends FileLocationRequest { + arguments: CompletionDetailsRequestArgs; + } + /** * Part of a symbol description. */ @@ -489,35 +509,42 @@ declare module ts.server.protocol { /** * An item found in a completion response. */ - export interface CompletionItem { + export interface CompletionEntry { /** * The symbol's name. */ name: string; - /** * The symbol's kind (such as 'className' or 'parameterName'). */ kind: string; - /** * Optional modifiers for the kind (such as 'public'). */ - kindModifiers?: string; - + kindModifiers: string; + } + + /** + * Additional completion entry details, available on demand + */ + export interface CompletionEntryDetails extends CompletionEntry { /** * Display parts of the symbol (similar to quick info). */ - displayParts?: SymbolDisplayPart[]; + displayParts: SymbolDisplayPart[]; /** * Documentation strings for the symbol. */ - documentation?: SymbolDisplayPart[]; + documentation: SymbolDisplayPart[]; } export interface CompletionsResponse extends Response { - body?: CompletionItem[]; + body?: CompletionEntry[]; + } + + export interface CompletionDetailsResponse extends Response { + body?: CompletionEntryDetails[]; } /** diff --git a/src/server/session.ts b/src/server/session.ts index 1a0a8d98a90..bfcf82bce29 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -81,7 +81,7 @@ module ts.server { function formatDiag(fileName: string, project: Project, diag: ts.Diagnostic) { return { start: project.compilerService.host.positionToLineCol(fileName, diag.start), - end: project.compilerService.host.positionToLineCol(fileName, diag.start+diag.length), + end: project.compilerService.host.positionToLineCol(fileName, diag.start + diag.length), text: ts.flattenDiagnosticMessageText(diag.messageText, "\n") }; } @@ -104,6 +104,7 @@ module ts.server { export var Change = "change"; export var Close = "close"; export var Completions = "completions"; + export var CompletionDetails = "completionEntryDetails"; export var Definition = "definition"; export var Format = "format"; export var Formatonkey = "formatonkey"; @@ -486,8 +487,8 @@ module ts.server { }; }); } - - getCompletions(line: number, col: number, prefix: string, fileName: string): protocol.CompletionItem[] { + + getCompletions(line: number, col: number, prefix: string, fileName: string): protocol.CompletionEntry[] { if (!prefix) { prefix = ""; } @@ -505,27 +506,34 @@ module ts.server { throw Errors.NoContent; } - return completions.entries.reduce((result: ts.CompletionEntryDetails[], entry: ts.CompletionEntry) => { + return completions.entries.reduce((result: protocol.CompletionEntry[], entry: ts.CompletionEntry) => { if (completions.isMemberCompletion || entry.name.indexOf(prefix) == 0) { - var protoEntry = {}; - protoEntry.name = entry.name; - protoEntry.kind = entry.kind; - if (entry.kindModifiers && (entry.kindModifiers.length > 0)) { - protoEntry.kindModifiers = entry.kindModifiers; - } - var details = compilerService.languageService.getCompletionEntryDetails(file, position, entry.name); - if (details && (details.documentation) && (details.documentation.length > 0)) { - protoEntry.documentation = details.documentation; - } - if (details && (details.displayParts) && (details.displayParts.length > 0)) { - protoEntry.displayParts = details.displayParts; - } - result.push(protoEntry); + result.push(entry); } return result; }, []); } + getCompletionEntryDetails(line: number, col: number, + entryNames: string[], fileName: string): protocol.CompletionEntryDetails[] { + var file = ts.normalizePath(fileName); + var project = this.projectService.getProjectForFile(file); + if (!project) { + throw Errors.NoProject; + } + + var compilerService = project.compilerService; + var position = compilerService.host.lineColToPosition(file, line, col); + + return entryNames.reduce((accum: protocol.CompletionEntryDetails[], entryName: string) => { + var details = compilerService.languageService.getCompletionEntryDetails(file, position, entryName); + if (details) { + accum.push(details); + } + return accum; + }, []); + } + getDiagnostics(delay: number, fileNames: string[]) { var checkList = fileNames.reduce((accum: PendingErrorCheck[], fileName: string) => { fileName = ts.normalizePath(fileName); @@ -724,6 +732,12 @@ module ts.server { response = this.getCompletions(request.arguments.line, request.arguments.col, completionsArgs.prefix, request.arguments.file); break; } + case CommandNames.CompletionDetails: { + var completionDetailsArgs = request.arguments; + response = this.getCompletionEntryDetails(request.arguments.line, request.arguments.col, completionDetailsArgs.entryNames, + request.arguments.file); + break; + } case CommandNames.Geterr: { var geterrArgs = request.arguments; response = this.getDiagnostics(geterrArgs.delay, geterrArgs.files); From d364f6110e2f43393377c97b474e2dd69d8ae2c5 Mon Sep 17 00:00:00 2001 From: steveluc Date: Thu, 19 Feb 2015 12:56:53 -0800 Subject: [PATCH 132/162] Style fixes. --- src/server/client.ts | 1 - src/server/session.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/src/server/client.ts b/src/server/client.ts index a0b68de840e..6185834a022 100644 --- a/src/server/client.ts +++ b/src/server/client.ts @@ -24,7 +24,6 @@ module ts.server { private fileMapping: ts.Map = {}; private lineMaps: ts.Map = {}; private messages: string[] = []; - private lastCompletionEntry: CompletionEntry; private lastRenameEntry: RenameEntry; constructor(private host: SessionClientHost) { diff --git a/src/server/session.ts b/src/server/session.ts index bfcf82bce29..19f6cd3645e 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -54,7 +54,6 @@ module ts.server { } function sortNavItems(items: ts.NavigateToItem[]) { - return items.sort((a, b) => { if (a.matchKind < b.matchKind) { return -1; From ce85b1458903954c9d3ffbaa79eb5663ffa33654 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 19 Feb 2015 13:11:59 -0800 Subject: [PATCH 133/162] Made the initial object literal properties indented. --- src/compiler/emitter.ts | 43 +++++++---- .../computedPropertyNames49_ES5.errors.txt | 52 +++++++++++++ .../reference/computedPropertyNames49_ES5.js | 75 +++++++++++++++++++ .../computedPropertyNames49_ES6.errors.txt | 40 ++++++++++ .../reference/computedPropertyNames49_ES6.js | 52 +++++++++++++ .../computedPropertyNames50_ES5.errors.txt | 52 +++++++++++++ .../reference/computedPropertyNames50_ES5.js | 71 ++++++++++++++++++ .../computedPropertyNames50_ES6.errors.txt | 40 ++++++++++ .../reference/computedPropertyNames50_ES6.js | 52 +++++++++++++ ...omputedPropertyNamesContextualType6_ES5.js | 6 +- ...omputedPropertyNamesContextualType7_ES5.js | 6 +- .../computedPropertyNames49_ES5.ts | 25 +++++++ .../computedPropertyNames49_ES6.ts | 26 +++++++ .../computedPropertyNames50_ES5.ts | 25 +++++++ .../computedPropertyNames50_ES6.ts | 26 +++++++ 15 files changed, 569 insertions(+), 22 deletions(-) create mode 100644 tests/baselines/reference/computedPropertyNames49_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames49_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames49_ES6.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames49_ES6.js create mode 100644 tests/baselines/reference/computedPropertyNames50_ES5.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames50_ES5.js create mode 100644 tests/baselines/reference/computedPropertyNames50_ES6.errors.txt create mode 100644 tests/baselines/reference/computedPropertyNames50_ES6.js create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts create mode 100644 tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 06648fb90db..0489fd70313 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2065,9 +2065,6 @@ module ts { } function emitList(nodes: Node[], start: number, count: number, multiLine: boolean, trailingComma: boolean) { - if (multiLine) { - increaseIndent(); - } for (var i = 0; i < count; i++) { if (multiLine) { if (i) { @@ -2086,7 +2083,6 @@ module ts { write(","); } if (multiLine) { - decreaseIndent(); writeLine(); } } @@ -2097,12 +2093,6 @@ module ts { } } - function emitMultiLineList(nodes: Node[]) { - if (nodes) { - emitList(nodes, 0, nodes.length, /*multiline*/ true, /*trailingComma*/ false); - } - } - function emitLines(nodes: Node[]) { emitLinesStartingAt(nodes, /*startIndex*/ 0); } @@ -2457,7 +2447,13 @@ module ts { i++; } write("["); + if (multiLine) { + increaseIndent(); + } emitList(elements, pos, i - pos, multiLine, trailingComma && i === length); + if (multiLine) { + decreaseIndent(); + } write("]"); pos = i; } @@ -2475,8 +2471,15 @@ module ts { } else if (languageVersion >= ScriptTarget.ES6) { write("["); - emitList(elements, 0, elements.length, /*multiLine*/ (node.flags & NodeFlags.MultiLine) !== 0, + var multiLine = (node.flags & NodeFlags.MultiLine) !== 0; + if (multiLine) { + increaseIndent(); + } + emitList(elements, 0, elements.length, /*multiLine*/ multiLine, /*trailingComma*/ elements.hasTrailingComma); + if (multiLine) { + decreaseIndent(); + } write("]"); } else { @@ -2488,17 +2491,24 @@ module ts { function emitObjectLiteralBody(node: ObjectLiteralExpression, numElements: number) { write("{"); + var multiLine = (node.flags & NodeFlags.MultiLine) !== 0; + if (numElements > 0) { var properties = node.properties; - var multiLine = (node.flags & NodeFlags.MultiLine) !== 0; if (!multiLine) { write(" "); } + else { + increaseIndent(); + } emitList(properties, 0, numElements, /*multiLine*/ multiLine, /*trailingComma*/ properties.hasTrailingComma && languageVersion >= ScriptTarget.ES5); if (!multiLine) { write(" "); } + else { + decreaseIndent(); + } } write("}"); @@ -2510,6 +2520,10 @@ module ts { write("("); + if (multiLine) { + increaseIndent(); + } + // For computed properties, we need to create a unique handle to the object // literal so we can modify it without risking internal assignments tainting the object. var tempVar = createAndRecordTempVariable(node); @@ -2521,9 +2535,6 @@ module ts { write(" = "); emitObjectLiteralBody(node, firstComputedPropertyIndex); - if (multiLine) { - increaseIndent(); - } for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) { writeComma(); @@ -2624,10 +2635,10 @@ module ts { var properties = node.properties; if (languageVersion < ScriptTarget.ES6) { + var numProperties = properties.length; // Find the first computed property. // Everything until that point can be emitted as part of the initial object literal. - var numProperties = properties.length; var numInitialNonComputedProperties = numProperties; for (var i = 0, n = properties.length; i < n; i++) { if (properties[i].name.kind === SyntaxKind.ComputedPropertyName) { diff --git a/tests/baselines/reference/computedPropertyNames49_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames49_ES5.errors.txt new file mode 100644 index 00000000000..cb4034d3bad --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(7,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(10,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(14,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(14,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(19,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts (8 errors) ==== + + var x = { + p1: 10, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + throw 10; + }, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + return 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + // just throw + throw 10; + }, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames49_ES5.js b/tests/baselines/reference/computedPropertyNames49_ES5.js new file mode 100644 index 00000000000..542017d42c1 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES5.js @@ -0,0 +1,75 @@ +//// [computedPropertyNames49_ES5.ts] + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames49_ES5.js] +var x = (_a = { + p1: 10 + }, + Object.defineProperty(_a, 1 + 1, { + get: function () { + throw 10; + }, + enumerable: true, + configurable: true + }), + Object.defineProperty(_a, 1 + 1, { + get: function () { + return 10; + }, + enumerable: true, + configurable: true + }), + Object.defineProperty(_a, 1 + 1, { + set: function () { + // just throw + throw 10; + }, + enumerable: true, + configurable: true + }), + Object.defineProperty(_a, "foo", { + get: function () { + if (1 == 1) { + return 10; + } + }, + enumerable: true, + configurable: true + }), + Object.defineProperty(_a, "foo", { + get: function () { + if (1 == 1) { + return 10; + } + }, + enumerable: true, + configurable: true + }), + _a.p2 = 20, + _a +); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames49_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames49_ES6.errors.txt new file mode 100644 index 00000000000..276f7fb17be --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES6.errors.txt @@ -0,0 +1,40 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(10,9): error TS1049: A 'set' accessor must have exactly one parameter. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(14,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts (4 errors) ==== + + var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1049: A 'set' accessor must have exactly one parameter. + // just throw + throw 10; + }, + get foo() { + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get foo() { + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames49_ES6.js b/tests/baselines/reference/computedPropertyNames49_ES6.js new file mode 100644 index 00000000000..d1b5fe26e9d --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames49_ES6.js @@ -0,0 +1,52 @@ +//// [computedPropertyNames49_ES6.ts] + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames49_ES6.js] +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +}; diff --git a/tests/baselines/reference/computedPropertyNames50_ES5.errors.txt b/tests/baselines/reference/computedPropertyNames50_ES5.errors.txt new file mode 100644 index 00000000000..63832dbed0c --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES5.errors.txt @@ -0,0 +1,52 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(4,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(9,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(12,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(16,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(19,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts (8 errors) ==== + + var x = { + p1: 10, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + throw 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + // just throw + throw 10; + }, + get [1 + 1]() { + ~~~~~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + return 10; + }, + get foo() { + ~~~ +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames50_ES5.js b/tests/baselines/reference/computedPropertyNames50_ES5.js new file mode 100644 index 00000000000..1d73938553e --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES5.js @@ -0,0 +1,71 @@ +//// [computedPropertyNames50_ES5.ts] + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames50_ES5.js] +var x = (_a = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + } + }, + Object.defineProperty(_a, 1 + 1, { + get: function () { + throw 10; + }, + enumerable: true, + configurable: true + }), + Object.defineProperty(_a, 1 + 1, { + set: function () { + // just throw + throw 10; + }, + enumerable: true, + configurable: true + }), + Object.defineProperty(_a, 1 + 1, { + get: function () { + return 10; + }, + enumerable: true, + configurable: true + }), + Object.defineProperty(_a, "foo", { + get: function () { + if (1 == 1) { + return 10; + } + }, + enumerable: true, + configurable: true + }), + _a.p2 = 20, + _a +); +var _a; diff --git a/tests/baselines/reference/computedPropertyNames50_ES6.errors.txt b/tests/baselines/reference/computedPropertyNames50_ES6.errors.txt new file mode 100644 index 00000000000..db61444a697 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES6.errors.txt @@ -0,0 +1,40 @@ +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(4,9): error TS2300: Duplicate identifier 'foo'. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(12,9): error TS1049: A 'set' accessor must have exactly one parameter. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(19,9): error TS1118: An object literal cannot have multiple get/set accessors with the same name. +tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts(19,9): error TS2300: Duplicate identifier 'foo'. + + +==== tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts (4 errors) ==== + + var x = { + p1: 10, + get foo() { + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + ~~~~~~~ +!!! error TS1049: A 'set' accessor must have exactly one parameter. + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + ~~~ +!!! error TS1118: An object literal cannot have multiple get/set accessors with the same name. + ~~~ +!!! error TS2300: Duplicate identifier 'foo'. + if (2 == 2) { + return 20; + } + }, + p2: 20 + } \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNames50_ES6.js b/tests/baselines/reference/computedPropertyNames50_ES6.js new file mode 100644 index 00000000000..24b0c8af1f5 --- /dev/null +++ b/tests/baselines/reference/computedPropertyNames50_ES6.js @@ -0,0 +1,52 @@ +//// [computedPropertyNames50_ES6.ts] + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} + +//// [computedPropertyNames50_ES6.js] +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +}; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js index 5b2537742d8..c97b7c5b1f8 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js @@ -15,9 +15,9 @@ foo({ //// [computedPropertyNamesContextualType6_ES5.js] foo((_a = { - p: "", - 0: function () { } -}, + p: "", + 0: function () { } + }, _a["hi" + "bye"] = true, _a[0 + 1] = 0, _a[+"hi"] = [0], diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js index 71f336d9db1..9ca7e826aa7 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js @@ -15,9 +15,9 @@ foo({ //// [computedPropertyNamesContextualType7_ES5.js] foo((_a = { - p: "", - 0: function () { } -}, + p: "", + 0: function () { } + }, _a["hi" + "bye"] = true, _a[0 + 1] = 0, _a[+"hi"] = [0], diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts new file mode 100644 index 00000000000..611d6a7d30f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES5.ts @@ -0,0 +1,25 @@ + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts new file mode 100644 index 00000000000..58f97a80feb --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames49_ES6.ts @@ -0,0 +1,26 @@ +// @target: es6 + +var x = { + p1: 10, + get [1 + 1]() { + throw 10; + }, + get [1 + 1]() { + return 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get foo() { + if (1 == 1) { + return 10; + } + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts new file mode 100644 index 00000000000..f7411e7cb4f --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES5.ts @@ -0,0 +1,25 @@ + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file diff --git a/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts new file mode 100644 index 00000000000..c599477c2e2 --- /dev/null +++ b/tests/cases/conformance/es6/computedProperties/computedPropertyNames50_ES6.ts @@ -0,0 +1,26 @@ +// @target: es6 + +var x = { + p1: 10, + get foo() { + if (1 == 1) { + return 10; + } + }, + get [1 + 1]() { + throw 10; + }, + set [1 + 1]() { + // just throw + throw 10; + }, + get [1 + 1]() { + return 10; + }, + get foo() { + if (2 == 2) { + return 20; + } + }, + p2: 20 +} \ No newline at end of file From 246ff099863ed66fa8ef95ef213d2f920a951dfc Mon Sep 17 00:00:00 2001 From: Yui T Date: Thu, 19 Feb 2015 13:52:50 -0800 Subject: [PATCH 134/162] Increase RWC timeout --- Jakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jakefile b/Jakefile index dc8070fd751..4e022f10652 100644 --- a/Jakefile +++ b/Jakefile @@ -542,7 +542,7 @@ task("runtests", ["tests", builtLocalDirectory], function() { } if (tests && tests.toLocaleLowerCase() === "rwc") { - testTimeout = 50000; + testTimeout = 100000; } colors = process.env.colors || process.env.color From 2b64e5048964637385ff51dd07711d211e917a08 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 19 Feb 2015 15:13:03 -0800 Subject: [PATCH 135/162] Add support for limiting the number of NavigateTo results that you get back. --- src/services/services.ts | 44 ++++++++++++------- src/services/shims.ts | 8 ++-- .../baselines/reference/APISample_compile.js | 2 +- .../reference/APISample_compile.types | 5 ++- tests/baselines/reference/APISample_linter.js | 2 +- .../reference/APISample_linter.types | 5 ++- .../reference/APISample_transform.js | 2 +- .../reference/APISample_transform.types | 5 ++- .../baselines/reference/APISample_watcher.js | 2 +- .../reference/APISample_watcher.types | 5 ++- 10 files changed, 47 insertions(+), 33 deletions(-) diff --git a/src/services/services.ts b/src/services/services.ts index 6bb1c3108d1..b22e58a26a8 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -900,7 +900,7 @@ module ts { getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; @@ -1380,8 +1380,8 @@ module ts { enum MatchKind { none = 0, exact = 1, - substring = 2, - prefix = 3 + prefix = 2, + substring = 3, } /// Language Service @@ -4662,7 +4662,7 @@ module ts { } /// NavigateTo - function getNavigateToItems(searchValue: string): NavigateToItem[] { + function getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[] { synchronizeHostData(); // Split search value in terms array @@ -4671,7 +4671,7 @@ module ts { // default NavigateTo approach: if search term contains only lower-case chars - use case-insensitive search, otherwise switch to case-sensitive version var searchTerms = map(terms, t => ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t })); - var items: NavigateToItem[] = []; + var rawItems: { name: string; fileName: string; matchKind: MatchKind; declaration: Declaration }[] = []; // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] forEach(program.getSourceFiles(), sourceFile => { @@ -4685,22 +4685,32 @@ module ts { var name = (declaration.name).text; var matchKind = getMatchKind(searchTerms, name); if (matchKind !== MatchKind.none) { - var container = getContainerNode(declaration); - items.push({ - name: name, - kind: getNodeKind(declaration), - kindModifiers: getNodeModifiers(declaration), - matchKind: MatchKind[matchKind], - fileName: fileName, - textSpan: createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), - // TODO(jfreeman): What should be the containerName when the container has a computed name? - containerName: container && container.name ? (container.name).text : "", - containerKind: container && container.name ? getNodeKind(container) : "" - }); + rawItems.push({ name, fileName, matchKind, declaration }); } } }); + rawItems.sort((i1, i2) => i1.matchKind - i2.matchKind); + if (maxResultCount !== undefined) { + rawItems = rawItems.slice(0, maxResultCount); + } + + var items = map(rawItems, i => { + var declaration = i.declaration; + var container = getContainerNode(declaration); + return { + name: i.name, + kind: getNodeKind(declaration), + kindModifiers: getNodeModifiers(declaration), + matchKind: MatchKind[i.matchKind], + fileName: i.fileName, + textSpan: createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + // TODO(jfreeman): What should be the containerName when the container has a computed name? + containerName: container && container.name ? (container.name).text : "", + containerKind: container && container.name ? getNodeKind(container) : "" + }; + }); + return items; function hasAnyUpperCaseCharacter(s: string): boolean { diff --git a/src/services/shims.ts b/src/services/shims.ts index 7b5b6d08cf4..01950772903 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -138,7 +138,7 @@ module ts { * Returns a JSON-encoded value of the type: * { name: string; kind: string; kindModifiers: string; containerName: string; containerKind: string; matchKind: string; fileName: string; textSpan: { start: number; length: number}; } [] = []; */ - getNavigateToItems(searchValue: string): string; + getNavigateToItems(searchValue: string, maxResultCount?: number): string; /** * Returns a JSON-encoded value of the type: @@ -628,11 +628,11 @@ module ts { /// NAVIGATE TO /** Return a list of symbols that are interesting to navigate to */ - public getNavigateToItems(searchValue: string): string { + public getNavigateToItems(searchValue: string, maxResultCount?: number): string { return this.forwardJSONCall( - "getNavigateToItems('" + searchValue + "')", + "getNavigateToItems('" + searchValue + "', " + maxResultCount+ ")", () => { - var items = this.languageService.getNavigateToItems(searchValue); + var items = this.languageService.getNavigateToItems(searchValue, maxResultCount); return items; }); } diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 09c3bb32264..fa88b0c3534 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -1541,7 +1541,7 @@ declare module "typescript" { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index 425e3b5a1ea..e98b7ade392 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -4986,9 +4986,10 @@ declare module "typescript" { >position : number >ReferenceEntry : ReferenceEntry - getNavigateToItems(searchValue: string): NavigateToItem[]; ->getNavigateToItems : (searchValue: string) => NavigateToItem[] + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; +>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] >searchValue : string +>maxResultCount : number >NavigateToItem : NavigateToItem getNavigationBarItems(fileName: string): NavigationBarItem[]; diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 711a780d530..7a3622d9f88 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -1572,7 +1572,7 @@ declare module "typescript" { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 42ef1b57179..036deb33857 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -5130,9 +5130,10 @@ declare module "typescript" { >position : number >ReferenceEntry : ReferenceEntry - getNavigateToItems(searchValue: string): NavigateToItem[]; ->getNavigateToItems : (searchValue: string) => NavigateToItem[] + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; +>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] >searchValue : string +>maxResultCount : number >NavigateToItem : NavigateToItem getNavigationBarItems(fileName: string): NavigationBarItem[]; diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index ee382329e6b..41d1fec2d2d 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -1573,7 +1573,7 @@ declare module "typescript" { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 6f5f366a4c5..6cb4a6cebce 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -5082,9 +5082,10 @@ declare module "typescript" { >position : number >ReferenceEntry : ReferenceEntry - getNavigateToItems(searchValue: string): NavigateToItem[]; ->getNavigateToItems : (searchValue: string) => NavigateToItem[] + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; +>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] >searchValue : string +>maxResultCount : number >NavigateToItem : NavigateToItem getNavigationBarItems(fileName: string): NavigationBarItem[]; diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 0888faddac3..d59acaa858f 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -1610,7 +1610,7 @@ declare module "typescript" { getDefinitionAtPosition(fileName: string, position: number): DefinitionInfo[]; getReferencesAtPosition(fileName: string, position: number): ReferenceEntry[]; getOccurrencesAtPosition(fileName: string, position: number): ReferenceEntry[]; - getNavigateToItems(searchValue: string): NavigateToItem[]; + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; getNavigationBarItems(fileName: string): NavigationBarItem[]; getOutliningSpans(fileName: string): OutliningSpan[]; getTodoComments(fileName: string, descriptors: TodoCommentDescriptor[]): TodoComment[]; diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 402f8491be6..77235fb4188 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -5255,9 +5255,10 @@ declare module "typescript" { >position : number >ReferenceEntry : ReferenceEntry - getNavigateToItems(searchValue: string): NavigateToItem[]; ->getNavigateToItems : (searchValue: string) => NavigateToItem[] + getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[]; +>getNavigateToItems : (searchValue: string, maxResultCount?: number) => NavigateToItem[] >searchValue : string +>maxResultCount : number >NavigateToItem : NavigateToItem getNavigationBarItems(fileName: string): NavigationBarItem[]; From 990bbb2dce862eb536bebdad663fdd2c94deda90 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 19 Feb 2015 15:52:37 -0800 Subject: [PATCH 136/162] CR feedback to use template strings. --- src/compiler/tsc.ts | 4 ++-- src/compiler/utilities.ts | 2 +- src/harness/fourslash.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 68e85d3f71d..a3755650aed 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -88,11 +88,11 @@ module ts { if (diagnostic.file) { var loc = getLineAndCharacterOfPosition(diagnostic.file, diagnostic.start); - output += diagnostic.file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + "): "; + output += `${ diagnostic.file.fileName }(${ loc.line + 1 },${ loc.character + 1 }): `; } var category = DiagnosticCategory[diagnostic.category].toLowerCase(); - output += category + " TS" + diagnostic.code + ": " + flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) + sys.newLine; + output += `${ category } TS${ diagnostic.code }: ${ flattenDiagnosticMessageText(diagnostic.messageText, sys.newLine) }${ sys.newLine }`; sys.write(output); } diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 6b336544eba..6a85a5d7a78 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -114,7 +114,7 @@ module ts { export function nodePosToString(node: Node): string { var file = getSourceFileOfNode(node); var loc = getLineAndCharacterOfPosition(file, node.pos); - return file.fileName + "(" + (loc.line + 1) + "," + (loc.character + 1) + ")"; + return `${ file.fileName }(${ loc.line + 1 },${ loc.character + 1 })`; } export function getStartPosOfNode(node: Node): number { diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index e40a367074d..cfc5da02f88 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -396,7 +396,7 @@ module FourSlash { var lineStarts = ts.computeLineStarts(this.getFileContent(this.activeFile.fileName)); var lineCharPos = ts.computeLineAndCharacterOfPosition(lineStarts, pos); - this.scenarioActions.push(''); + this.scenarioActions.push(``); } public moveCaretRight(count = 1) { From 0d09dd594830b85197efba0a90ee4087e82ba8fa Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 19 Feb 2015 16:43:28 -0800 Subject: [PATCH 137/162] Make LastToken point to OfKeyword --- src/compiler/types.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index b396a0673aa..0133c83c422 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -142,7 +142,7 @@ module ts { StringKeyword, SymbolKeyword, TypeKeyword, - OfKeyword, + OfKeyword, // LastKeyword and LastToken // Parse tree nodes // Names @@ -269,7 +269,7 @@ module ts { FirstPunctuation = OpenBraceToken, LastPunctuation = CaretEqualsToken, FirstToken = Unknown, - LastToken = TypeKeyword, + LastToken = OfKeyword, FirstTriviaToken = SingleLineCommentTrivia, LastTriviaToken = ConflictMarkerTrivia, FirstLiteralToken = NumericLiteral, From 2928449bbeeb4f153dd4beac2fb9726af1ff131e Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 19 Feb 2015 16:43:45 -0800 Subject: [PATCH 138/162] Accept baselines --- tests/baselines/reference/APISample_compile.js | 2 +- tests/baselines/reference/APISample_compile.types | 2 +- tests/baselines/reference/APISample_linter.js | 2 +- tests/baselines/reference/APISample_linter.types | 2 +- tests/baselines/reference/APISample_transform.js | 2 +- tests/baselines/reference/APISample_transform.types | 2 +- tests/baselines/reference/APISample_watcher.js | 2 +- tests/baselines/reference/APISample_watcher.types | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index a1d695f5105..f951a955b29 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -285,7 +285,7 @@ declare module "typescript" { FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 121, + LastToken = 122, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index e2e75843311..7a1a306b989 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -871,7 +871,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 121, + LastToken = 122, >LastToken : SyntaxKind FirstTriviaToken = 2, diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index f7c81601bc8..9631a755165 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -316,7 +316,7 @@ declare module "typescript" { FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 121, + LastToken = 122, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 722fa806346..8caa6855e84 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -1015,7 +1015,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 121, + LastToken = 122, >LastToken : SyntaxKind FirstTriviaToken = 2, diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index daa00de9cb3..2ccf48a5e6c 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -317,7 +317,7 @@ declare module "typescript" { FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 121, + LastToken = 122, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 157691c6818..60ebae5472d 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -967,7 +967,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 121, + LastToken = 122, >LastToken : SyntaxKind FirstTriviaToken = 2, diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 177f08f381f..530f081c77a 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -354,7 +354,7 @@ declare module "typescript" { FirstPunctuation = 14, LastPunctuation = 63, FirstToken = 0, - LastToken = 121, + LastToken = 122, FirstTriviaToken = 2, LastTriviaToken = 6, FirstLiteralToken = 7, diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 1c153bfac39..ec48d879968 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -1140,7 +1140,7 @@ declare module "typescript" { FirstToken = 0, >FirstToken : SyntaxKind - LastToken = 121, + LastToken = 122, >LastToken : SyntaxKind FirstTriviaToken = 2, From 0fd783f3ef024026c30e3c09dd4c4278c203eb1f Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 19 Feb 2015 17:04:32 -0800 Subject: [PATCH 139/162] Don't emit accessors multiple times. --- src/compiler/emitter.ts | 3 +++ .../baselines/reference/computedPropertyNames49_ES5.js | 10 +--------- .../baselines/reference/computedPropertyNames50_ES5.js | 10 +--------- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 0489fd70313..edd6be126d5 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2545,6 +2545,9 @@ module ts { if (property.kind === SyntaxKind.GetAccessor || property.kind === SyntaxKind.SetAccessor) { // TODO (drosen): Reconcile with 'emitMemberFunctions'. var accessors = getAllAccessorDeclarations(node.properties, property); + if (property !== accessors.firstAccessor) { + continue; + } write("Object.defineProperty("); emit(tempVar); write(", "); diff --git a/tests/baselines/reference/computedPropertyNames49_ES5.js b/tests/baselines/reference/computedPropertyNames49_ES5.js index 542017d42c1..3427ea665a0 100644 --- a/tests/baselines/reference/computedPropertyNames49_ES5.js +++ b/tests/baselines/reference/computedPropertyNames49_ES5.js @@ -60,15 +60,7 @@ var x = (_a = { enumerable: true, configurable: true }), - Object.defineProperty(_a, "foo", { - get: function () { - if (1 == 1) { - return 10; - } - }, - enumerable: true, - configurable: true - }), + , _a.p2 = 20, _a ); diff --git a/tests/baselines/reference/computedPropertyNames50_ES5.js b/tests/baselines/reference/computedPropertyNames50_ES5.js index 1d73938553e..a74561295be 100644 --- a/tests/baselines/reference/computedPropertyNames50_ES5.js +++ b/tests/baselines/reference/computedPropertyNames50_ES5.js @@ -56,15 +56,7 @@ var x = (_a = { enumerable: true, configurable: true }), - Object.defineProperty(_a, "foo", { - get: function () { - if (1 == 1) { - return 10; - } - }, - enumerable: true, - configurable: true - }), + , _a.p2 = 20, _a ); From bf436543b95ec40e8da56c36fe01a5d8404cbf43 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Thu, 19 Feb 2015 17:17:04 -0800 Subject: [PATCH 140/162] Add a test --- .../syntacticClassificationsForOfKeyword.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/cases/fourslash/syntacticClassificationsForOfKeyword.ts diff --git a/tests/cases/fourslash/syntacticClassificationsForOfKeyword.ts b/tests/cases/fourslash/syntacticClassificationsForOfKeyword.ts new file mode 100644 index 00000000000..a7a8c704ce6 --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsForOfKeyword.ts @@ -0,0 +1,16 @@ +/// + +//// for (var of of of) { } + +var c = classification; +verify.syntacticClassificationsAre( + c.keyword("for"), + c.punctuation("("), + c.keyword("var"), + c.text("of"), + c.keyword("of"), + c.text("of"), + c.punctuation(")"), + c.punctuation("{"), + c.punctuation("}") + ); \ No newline at end of file From 14d0810fdf6571e60cc09f0f66ae1c0b93548d6f Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Thu, 19 Feb 2015 22:37:06 -0800 Subject: [PATCH 141/162] added regression test for formatting multiline template literals --- .../formattingMultilineTemplateLiterals.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 tests/cases/fourslash/formattingMultilineTemplateLiterals.ts diff --git a/tests/cases/fourslash/formattingMultilineTemplateLiterals.ts b/tests/cases/fourslash/formattingMultilineTemplateLiterals.ts new file mode 100644 index 00000000000..37e6f5782e0 --- /dev/null +++ b/tests/cases/fourslash/formattingMultilineTemplateLiterals.ts @@ -0,0 +1,13 @@ +/// + +/////*1*/new Error(`Failed to expand glob: ${projectSpec.filesGlob} +/////*2*/ at projectPath : ${projectFile} +/////*3*/ with error: ${ex.message}`) + +format.document(); +goTo.marker("1"); +verify.currentLineContentIs("new Error(`Failed to expand glob: ${projectSpec.filesGlob}"); +goTo.marker("2"); +verify.currentLineContentIs(" at projectPath : ${projectFile}"); +goTo.marker("3"); +verify.currentLineContentIs(" with error: ${ex.message}`)"); \ No newline at end of file From 33e1e5d90566954345f26d1c2dbd7f53c588f8f7 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 20 Feb 2015 00:22:41 -0800 Subject: [PATCH 142/162] Add a PatternMatcher API (similar to the one in Roslyn) for more advanced matching with features like NavigateTo. --- Jakefile | 4 +- src/compiler/scanner.ts | 2 +- src/compiler/types.ts | 1 + src/services/patternMatcher.ts | 810 ++++++++++++++++++ src/services/services.ts | 3 + .../baselines/reference/APISample_compile.js | 1 + .../reference/APISample_compile.types | 3 + tests/baselines/reference/APISample_linter.js | 1 + .../reference/APISample_linter.types | 3 + .../reference/APISample_transform.js | 1 + .../reference/APISample_transform.types | 3 + .../baselines/reference/APISample_watcher.js | 1 + .../reference/APISample_watcher.types | 3 + .../unittests/services/patternMatcher.ts | 532 ++++++++++++ 14 files changed, 1366 insertions(+), 2 deletions(-) create mode 100644 src/services/patternMatcher.ts create mode 100644 tests/cases/unittests/services/patternMatcher.ts diff --git a/Jakefile b/Jakefile index 7b17a83a579..f962a2331ef 100644 --- a/Jakefile +++ b/Jakefile @@ -67,6 +67,7 @@ var servicesSources = [ "breakpoints.ts", "navigationBar.ts", "outliningElementsCollector.ts", + "patternMatcher.ts", "services.ts", "shims.ts", "signatureHelp.ts", @@ -138,7 +139,8 @@ var harnessSources = [ "incrementalParser.ts", "services/colorization.ts", "services/documentRegistry.ts", - "services/preProcessFile.ts" + "services/preProcessFile.ts", + "services/patternMatcher.ts" ].map(function (f) { return path.join(unittestsDirectory, f); })).concat([ diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 029158b989a..2a34d4eacbb 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -225,7 +225,7 @@ module ts { return false; } - function isUnicodeIdentifierStart(code: number, languageVersion: ScriptTarget) { + /* @internal */ export function isUnicodeIdentifierStart(code: number, languageVersion: ScriptTarget) { return languageVersion >= ScriptTarget.ES5 ? lookupInUnicodeMap(code, unicodeES5IdentifierStart) : lookupInUnicodeMap(code, unicodeES3IdentifierStart); diff --git a/src/compiler/types.ts b/src/compiler/types.ts index b396a0673aa..bfc32e2e4c1 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1646,6 +1646,7 @@ module ts { equals = 0x3D, // = exclamation = 0x21, // ! greaterThan = 0x3E, // > + hash = 0x23, lessThan = 0x3C, // < minus = 0x2D, // - openBrace = 0x7B, // { diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts new file mode 100644 index 00000000000..7beb70ad1e8 --- /dev/null +++ b/src/services/patternMatcher.ts @@ -0,0 +1,810 @@ +module ts { + // Note(cyrusn): this enum is ordered from strongest match type to weakest match type. + export enum PatternMatchKind { + Exact, + Prefix, + Substring, + CamelCase + } + + // Information about a match made by the pattern matcher between a candidate and the + // search pattern. + export interface PatternMatch { + // What kind of match this was. Exact matches are better than prefix matches which are + // better than substring matches which are better than CamelCase matches. + kind: PatternMatchKind; + + // If this was a camel case match, how strong the match is. Higher number means + // it was a better match. + camelCaseWeight: number; + + // If this was a match where all consituent parts of the candidate and search pattern + // matched cast sensitively or case insensitively. Case sensitive matches of the kind + // are better matches than insensitive matches. + isCaseSensitive: boolean; + + // Whether or not this match occured with the punctuation from the search pattern stripped + // out or not. Matched without the punctuation stripped are better than ones with punctuation + // stripped. + punctuationStripped: boolean; + } + + // The pattern matcher maintains an internal cache of information as it is used. Therefore, + // you should not keep it around forever and should get and release the matcher appropriately + // once you no longer need it. + export interface PatternMatcher { + // Used to match a candidate against the last segment of a possibly dotted pattern. This + // is useful as a quick check to preven having to compute a container before calling + // "getMatches". + // + // For example, if the search pattern is "ts.c.SK" and the candidate is "SyntaxKind", then + // this will return a successful match, having only tested "SK" against "SyntaxKind". At + // that point a call can be made to 'getMatches("SyntaxKind", "ts.compiler")', with the + // work to create 'ts.compiler' only being done once the first match succeeded. + getMatchesForLastSegmentOfPattern(candidate: string): PatternMatch[]; + + // Fully checks a candidate, with an optional dotted container against the search pattern. + // The candidate must match the last part of the search pattern, and the dotted container + // must match the preceding segments of the pattern. + getMatches(candidate: string, dottedContainer: string): PatternMatch[]; + isDottedPattern: boolean; + } + + // First we break up the pattern given by dots. Each portion of the pattern between the + // dots is a 'Segment'. The 'Segment' contains information about the entire section of + // text between the dots, as well as information about any individual 'Words' that we + // can break the segment into. A 'Word' is simply a contiguous sequence of characters + // that can appear in a typescript identifier. So "GetKeyword" would be one word, while + // "Get Keyword" would be two words. Once we have the individual 'words', we break those + // into constituent 'character spans' of interest. For example, while 'UIElement' is one + // word, it make character spans corresponding to "U", "I" and "Element". These spans + // are then used when doing camel cased matches against candidate patterns. + interface Segment { + // Information about the entire piece of text between the dots. For example, if the + // text between the dots is 'GetKeyword', then TotalTextChunk.Text will be 'GetKeyword' and + // TotalTextChunk.CharacterSpans will correspond to 'Get', 'Keyword'. + totalTextChunk: TextChunk; + + // Information about the subwords compromising the total word. For example, if the + // text between the dots is 'GetFoo KeywordBar', then the subwords will be 'GetFoo' + // and 'KeywordBar'. Those individual words will have CharacterSpans of ('Get' and + // 'Foo') and('Keyword' and 'Bar') respectively. + subWordTextChunks: TextChunk[]; + } + + // Information about a chunk of text from the pattern. The chunk is a piece of text, with + // cached information about the character spans within in. Character spans are used for + // camel case matching. + interface TextChunk { + // The text of the chunk. This should be a contiguous sequence of character that could + // occur in a symbol name. + text: string; + + // The text of a chunk in lower case. Cached because it is needed often to check for + // case insensitive matches. + textLowerCase: string; + + // Whether or not this chunk is entirely lowercase. We have different rules when searching + // for something entirely lowercase or not. + isLowerCase: boolean; + + // The spans in this text chunk that we think are of interest and should be matched + // independently. For example, if the chunk is for "UIElement" the the spans of interest + // correspond to "U", "I" and "Element". If "UIElement" isn't found as an exaxt, prefix. + // or substring match, then the character spans will be used to attempt a camel case match. + characterSpans: TextSpan[]; + } + + function createPatternMatch(kind: PatternMatchKind, punctuationStripped: boolean, isCaseSensitive: boolean, camelCaseWeight?: number): PatternMatch { + return { + kind, + punctuationStripped, + isCaseSensitive, + camelCaseWeight + }; + } + + export function createPatternMatcher(pattern: string): PatternMatcher { + // We'll often see the same candidate string many times when searching (For example, when + // we see the name of a module that is used everywhere, or the name of an overload). As + // such, we cache the information we compute about the candidate for the life of this + // pattern matcher so we don't have to compute it multiple times. + var stringToWordSpans: Map = {}; + + pattern = pattern.trim(); + + var fullPatternSegment = createSegment(pattern); + var dotSeparatedSegments = pattern.split(".").map(p => createSegment(p.trim())); + var invalidPattern = dotSeparatedSegments.length === 0 || forEach(dotSeparatedSegments, segmentIsInvalid); + + return { + getMatches, + getMatchesForLastSegmentOfPattern, + isDottedPattern: dotSeparatedSegments.length > 1 + }; + + // Quick checks so we can bail out when asked to match a candidate. + function skipMatch(candidate: string) { + return invalidPattern || !candidate; + } + + function getMatchesForLastSegmentOfPattern(candidate: string): PatternMatch[] { + if (skipMatch(candidate)) { + return undefined; + } + + return matchSegment(candidate, lastOrUndefined(dotSeparatedSegments)); + } + + function getMatches(candidate: string, dottedContainer: string): PatternMatch[] { + if (skipMatch(candidate)) { + return undefined; + } + + // First, check that the last part of the dot separated pattern matches the name of the + // candidate. If not, then there's no point in proceeding and doing the more + // expensive work. + var candidateMatch = matchSegment(candidate, lastOrUndefined(dotSeparatedSegments)); + if (!candidateMatch) { + return undefined; + } + + dottedContainer = dottedContainer || ""; + var containerParts = dottedContainer.split("."); + + // -1 because the last part was checked against the name, and only the rest + // of the parts are checked against the container. + if (dotSeparatedSegments.length - 1 > containerParts.length) { + // There weren't enough container parts to match against the pattern parts. + // So this definitely doesn't match. + return null; + } + + // So far so good. Now break up the container for the candidate and check if all + // the dotted parts match up correctly. + var totalMatch = candidateMatch; + + for (var i = dotSeparatedSegments.length - 2, j = containerParts.length - 1; + i >= 0; + i--, j--) { + + var segment = dotSeparatedSegments[i]; + var containerName = containerParts[j]; + + var containerMatch = matchSegment(containerName, segment); + if (!containerMatch) { + // This container didn't match the pattern piece. So there's no match at all. + return undefined; + } + + addRange(totalMatch, containerMatch); + } + + // Success, this symbol's full name matched against the dotted name the user was asking + // about. + return totalMatch; + } + + function getWordSpans(word: string): TextSpan[] { + if (!hasProperty(stringToWordSpans, word)) { + stringToWordSpans[word] = breakIntoWordSpans(word); + } + + return stringToWordSpans[word]; + } + + function matchTextChunk(candidate: string, chunk: TextChunk, punctuationStripped: boolean): PatternMatch { + var index = indexOfIgnoringCase(candidate, chunk.textLowerCase); + if (index === 0) { + if (chunk.text.length === candidate.length) { + // a) Check if the part matches the candidate entirely, in an case insensitive or + // sensitive manner. If it does, return that there was an exact match. + return createPatternMatch(PatternMatchKind.Exact, punctuationStripped, /*isCaseSensitive:*/ candidate === chunk.text); + } + else { + // b) Check if the part is a prefix of the candidate, in a case insensitive or sensitive + // manner. If it does, return that there was a prefix match. + return createPatternMatch(PatternMatchKind.Prefix, punctuationStripped, /*isCaseSensitive:*/ startsWith(candidate, chunk.text)); + } + } + + var isLowercase = chunk.isLowerCase; + if (isLowercase) { + if (index > 0) { + // c) If the part is entirely lowercase, then check if it is contained anywhere in the + // candidate in a case insensitive manner. If so, return that there was a substring + // match. + // + // Note: We only have a substring match if the lowercase part is prefix match of some + // word part. That way we don't match something like 'Class' when the user types 'a'. + // But we would match 'FooAttribute' (since 'Attribute' starts with 'a'). + var wordSpans = getWordSpans(candidate); + for (var i = 0, n = wordSpans.length; i < n; i++) { + var span = wordSpans[i] + if (partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ true)) { + return createPatternMatch(PatternMatchKind.Substring, punctuationStripped, + /*isCaseSensitive:*/ partStartsWith(candidate, span, chunk.text, /*ignoreCase:*/ false)); + } + } + } + } + else { + // d) If the part was not entirely lowercase, then check if it is contained in the + // candidate in a case *sensitive* manner. If so, return that there was a substring + // match. + if (candidate.indexOf(chunk.text) > 0) { + return createPatternMatch(PatternMatchKind.Substring, punctuationStripped, /*isCaseSensitive:*/ true); + } + } + + if (!isLowercase) { + // e) If the part was not entirely lowercase, then attempt a camel cased match as well. + if (chunk.characterSpans.length > 0) { + var candidateParts = getWordSpans(candidate); + var camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ false); + if (camelCaseWeight !== undefined) { + return createPatternMatch(PatternMatchKind.CamelCase, punctuationStripped, /*isCaseSensitive:*/ true, /*camelCaseWeight:*/ camelCaseWeight); + } + + camelCaseWeight = tryCamelCaseMatch(candidate, candidateParts, chunk, /*ignoreCase:*/ true); + if (camelCaseWeight !== undefined) { + return createPatternMatch(PatternMatchKind.CamelCase, punctuationStripped, /*isCaseSensitive:*/ false, /*camelCaseWeight:*/ camelCaseWeight); + } + } + } + + if (isLowercase) { + // f) Is the pattern a substring of the candidate starting on one of the candidate's word boundaries? + + // We could check every character boundary start of the candidate for the pattern. However, that's + // an m * n operation in the wost case. Instead, find the first instance of the pattern + // substring, and see if it starts on a capital letter. It seems unlikely that the user will try to + // filter the list based on a substring that starts on a capital letter and also with a lowercase one. + // (Pattern: fogbar, Candidate: quuxfogbarFogBar). + if (chunk.text.length < candidate.length) { + if (index > 0 && isUpperCaseLetter(candidate.charCodeAt(index))) { + return createPatternMatch(PatternMatchKind.Substring, punctuationStripped, /*isCaseSensitive:*/ false); + } + } + } + + return undefined; + } + + function containsSpaceOrAsterisk(text: string): boolean { + for (var i = 0; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (ch === CharacterCodes.space || ch === CharacterCodes.asterisk) { + return true; + } + } + + return false; + } + + function matchSegment(candidate: string, segment: Segment): PatternMatch[] { + // First check if the segment matches as is. This is also useful if the segment contains + // characters we would normally strip when splitting into parts that we also may want to + // match in the candidate. For example if the segment is "@int" and the candidate is + // "@int", then that will show up as an exact match here. + // + // Note: if the segment contains a space or an asterisk then we must assume that it's a + // multi-word segment. + if (!containsSpaceOrAsterisk(segment.totalTextChunk.text)) { + var match = matchTextChunk(candidate, segment.totalTextChunk, /*punctuationStripped:*/ false); + if (match) { + return [match]; + } + } + + // The logic for pattern matching is now as follows: + // + // 1) Break the segment passed in into words. Breaking is rather simple and a + // good way to think about it that if gives you all the individual alphanumeric words + // of the pattern. + // + // 2) For each word try to match the word against the candidate value. + // + // 3) Matching is as follows: + // + // a) Check if the word matches the candidate entirely, in an case insensitive or + // sensitive manner. If it does, return that there was an exact match. + // + // b) Check if the word is a prefix of the candidate, in a case insensitive or + // sensitive manner. If it does, return that there was a prefix match. + // + // c) If the word is entirely lowercase, then check if it is contained anywhere in the + // candidate in a case insensitive manner. If so, return that there was a substring + // match. + // + // Note: We only have a substring match if the lowercase part is prefix match of + // some word part. That way we don't match something like 'Class' when the user + // types 'a'. But we would match 'FooAttribute' (since 'Attribute' starts with + // 'a'). + // + // d) If the word was not entirely lowercase, then check if it is contained in the + // candidate in a case *sensitive* manner. If so, return that there was a substring + // match. + // + // e) If the word was not entirely lowercase, then attempt a camel cased match as + // well. + // + // f) The word is all lower case. Is it a case insensitive substring of the candidate starting + // on a part boundary of the candidate? + // + // Only if all words have some sort of match is the pattern considered matched. + + var subWordTextChunks = segment.subWordTextChunks; + var matches: PatternMatch[] = undefined; + + for (var i = 0, n = subWordTextChunks.length; i < n; i++) { + var subWordTextChunk = subWordTextChunks[i]; + + // Try to match the candidate with this word + var result = matchTextChunk(candidate, subWordTextChunk, /*punctuationStripped:*/ true); + if (!result) { + return undefined; + } + + matches = matches || []; + matches.push(result); + } + + return matches; + } + + function partStartsWith(candidate: string, candidateSpan: TextSpan, pattern: string, ignoreCase: boolean, patternSpan?: TextSpan): boolean { + var patternPartStart = patternSpan ? patternSpan.start : 0; + var patternPartLength = patternSpan ? patternSpan.length : pattern.length; + + if (patternPartLength > candidateSpan.length) { + // Pattern part is longer than the candidate part. There can never be a match. + return false; + } + + if (ignoreCase) { + for (var i = 0; i < patternPartLength; i++) { + var ch1 = pattern.charCodeAt(patternPartStart + i); + var ch2 = candidate.charCodeAt(candidateSpan.start + i); + if (toLowerCase(ch1) !== toLowerCase(ch2)) { + return false; + } + } + } + else { + for (var i = 0; i < patternPartLength; i++) { + var ch1 = pattern.charCodeAt(patternPartStart + i); + var ch2 = candidate.charCodeAt(candidateSpan.start + i); + if (ch1 !== ch2) { + return false; + } + } + } + + return true; + } + + function tryCamelCaseMatch(candidate: string, candidateParts: TextSpan[], chunk: TextChunk, ignoreCase: boolean): number { + var chunkCharacterSpans = chunk.characterSpans; + + // Note: we may have more pattern parts than candidate parts. This is because multiple + // pattern parts may match a candidate part. For example "SiUI" against "SimpleUI". + // We'll have 3 pattern parts Si/U/I against two candidate parts Simple/UI. However, U + // and I will both match in UI. + + var currentCandidate = 0; + var currentChunkSpan = 0; + var firstMatch: number = undefined; + var contiguous: boolean = undefined; + + while (true) { + // Let's consider our termination cases + if (currentChunkSpan === chunkCharacterSpans.length) { + // We did match! We shall assign a weight to this + var weight = 0; + + // Was this contiguous? + if (contiguous) { + weight += 1; + } + + // Did we start at the beginning of the candidate? + if (firstMatch === 0) { + weight += 2; + } + + return weight; + } + else if (currentCandidate === candidateParts.length) { + // No match, since we still have more of the pattern to hit + return undefined; + } + + var candidatePart = candidateParts[currentCandidate]; + var gotOneMatchThisCandidate = false; + + // Consider the case of matching SiUI against SimpleUIElement. The candidate parts + // will be Simple/UI/Element, and the pattern parts will be Si/U/I. We'll match 'Si' + // against 'Simple' first. Then we'll match 'U' against 'UI'. However, we want to + // still keep matching pattern parts against that candidate part. + for (; currentChunkSpan < chunkCharacterSpans.length; currentChunkSpan++) { + var chunkCharacterSpan = chunkCharacterSpans[currentChunkSpan]; + + if (gotOneMatchThisCandidate) { + // We've already gotten one pattern part match in this candidate. We will + // only continue trying to consumer pattern parts if the last part and this + // part are both upper case. + if (!isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan - 1].start)) || + !isUpperCaseLetter(chunk.text.charCodeAt(chunkCharacterSpans[currentChunkSpan].start))) { + break; + } + } + + if (!partStartsWith(candidate, candidatePart, chunk.text, ignoreCase, chunkCharacterSpan)) { + break; + } + + gotOneMatchThisCandidate = true; + + firstMatch = firstMatch === undefined ? currentCandidate : firstMatch; + + // If we were contiguous, then keep that value. If we weren't, then keep that + // value. If we don't know, then set the value to 'true' as an initial match is + // obviously contiguous. + contiguous = contiguous === undefined ? true : contiguous; + + candidatePart = createTextSpan(candidatePart.start + chunkCharacterSpan.length, candidatePart.length - chunkCharacterSpan.length); + } + + // Check if we matched anything at all. If we didn't, then we need to unset the + // contiguous bit if we currently had it set. + // If we haven't set the bit yet, then that means we haven't matched anything so + // far, and we don't want to change that. + if (!gotOneMatchThisCandidate && contiguous !== undefined) { + contiguous = false; + } + + // Move onto the next candidate. + currentCandidate++; + } + } + } + + // Helper function to compare two matches to determine which is better. Matches are first + // ordered by kind (so all prefix matches always beat all substring matches). Then, if the + // match is a camel case match, the relative weights of hte match are used to determine + // which is better (with a greater weight being better). Then if the match is of the same + // type, then a case sensitive match is considered better than an insensitive one. + function patternMatchCompareTo(match1: PatternMatch, match2: PatternMatch): number { + return compareType(match1, match2) || + compareCamelCase(match1, match2) || + compareCase(match1, match2) || + comparePunctuation(match1, match2); + } + + function comparePunctuation(result1: PatternMatch, result2: PatternMatch) { + // Consider a match to be better if it was successful without stripping punctuation + // versus a match that had to strip punctuation to succeed. + if (result1.punctuationStripped !== result2.punctuationStripped) { + return result1.punctuationStripped ? 1 : -1; + } + + return 0; + } + + function compareCase(result1: PatternMatch, result2: PatternMatch) { + if (result1.isCaseSensitive !== result2.isCaseSensitive) { + return result1.isCaseSensitive ? -1 : 1; + } + + return 0; + } + + function compareType(result1: PatternMatch, result2: PatternMatch) { + return result1.kind - result2.kind; + } + + function compareCamelCase(result1: PatternMatch, result2: PatternMatch) { + if (result1.kind === PatternMatchKind.CamelCase && result2.kind === PatternMatchKind.CamelCase) { + // Swap the values here. If result1 has a higher weight, then we want it to come + // first. + return result2.camelCaseWeight - result1.camelCaseWeight; + } + + return 0; + } + + function createSegment(text: string): Segment { + return { + totalTextChunk: createTextChunk(text), + subWordTextChunks: breakPatternIntoTextChunks(text) + } + } + + // A segment is considered invalid if we couldn't find any words in it. + function segmentIsInvalid(segment: Segment) { + return segment.subWordTextChunks.length === 0; + } + + function isUpperCaseLetter(ch: number) { + // Fast check for the ascii range. + if (ch >= CharacterCodes.A && ch <= CharacterCodes.Z) { + return true; + } + + if (ch < CharacterCodes.maxAsciiCharacter || !isUnicodeIdentifierStart(ch, ScriptTarget.Latest)) { + return false; + } + + // TODO: find a way to determine this for any unicode characters in a + // non-allocating manner. + var str = String.fromCharCode(ch); + return str === str.toUpperCase(); + } + + function isLowerCaseLetter(ch: number) { + // Fast check for the ascii range. + if (ch >= CharacterCodes.a && ch <= CharacterCodes.z) { + return true; + } + + if (ch < CharacterCodes.maxAsciiCharacter || !isUnicodeIdentifierStart(ch, ScriptTarget.Latest)) { + return false; + } + + + // TODO: find a way to determine this for any unicode characters in a + // non-allocating manner. + var str = String.fromCharCode(ch); + return str === str.toLowerCase(); + } + + function containsUpperCaseLetter(string: string): boolean { + for (var i = 0, n = string.length; i < n; i++) { + if (isUpperCaseLetter(string.charCodeAt(i))) { + return true; + } + } + + return false; + } + + function startsWith(string: string, search: string) { + for (var i = 0, n = search.length; i < n; i++) { + if (string.charCodeAt(i) !== search.charCodeAt(i)) { + return false; + } + } + + return true; + } + + // Assumes 'value' is already lowercase. + function indexOfIgnoringCase(string: string, value: string): number { + for (var i = 0, n = string.length - value.length; i <= n; i++) { + if (startsWithIgnoringCase(string, value, i)) { + return i; + } + } + + return -1; + } + + // Assumes 'value' is already lowercase. + function startsWithIgnoringCase(string: string, value: string, start: number): boolean { + for (var i = 0, n = value.length; i < n; i++) { + var ch1 = toLowerCase(string.charCodeAt(i + start)); + var ch2 = value.charCodeAt(i); + + if (ch1 !== ch2) { + return false; + } + } + + return true; + } + + function toLowerCase(ch: number): number { + // Fast convert for the ascii range. + if (ch >= CharacterCodes.A && ch <= CharacterCodes.Z) { + return CharacterCodes.a + (ch - CharacterCodes.A); + } + + if (ch < CharacterCodes.maxAsciiCharacter) { + return ch; + } + + // TODO: find a way to compute this for any unicode characters in a + // non-allocating manner. + return String.fromCharCode(ch).toLowerCase().charCodeAt(0); + } + + function isDigit(ch: number) { + // TODO(cyrusn): Find a way to support this for unicode digits. + return ch >= CharacterCodes._0 && ch <= CharacterCodes._9; + } + + function isWordChar(ch: number) { + return isUpperCaseLetter(ch) || isLowerCaseLetter(ch) || isDigit(ch) || ch === CharacterCodes._ || ch === CharacterCodes.$; + } + + function breakPatternIntoTextChunks(pattern: string): TextChunk[] { + var result: TextChunk[] = []; + var wordStart = 0; + var wordLength = 0; + + for (var i = 0; i < pattern.length; i++) { + var ch = pattern.charCodeAt(i); + if (isWordChar(ch)) { + if (wordLength++ === 0) { + wordStart = i; + } + } + else { + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + wordLength = 0; + } + } + } + + if (wordLength > 0) { + result.push(createTextChunk(pattern.substr(wordStart, wordLength))); + } + + return result; + } + + function createTextChunk(text: string): TextChunk { + var textLowerCase = text.toLowerCase(); + return { + text, + textLowerCase, + isLowerCase: text === textLowerCase, + characterSpans: breakIntoCharacterSpans(text) + } + } + + /* @internal */ export function breakIntoCharacterSpans(identifier: string): TextSpan[] { + return breakIntoSpans(identifier, /*word:*/ false); + } + + /* @internal */ export function breakIntoWordSpans(identifier: string): TextSpan[] { + return breakIntoSpans(identifier, /*word:*/ true); + } + + function breakIntoSpans(identifier: string, word: boolean): TextSpan[] { + var result: TextSpan[] = []; + + var wordStart = 0; + for (var i = 1, n = identifier.length; i < n; i++) { + var lastIsDigit = isDigit(identifier.charCodeAt(i - 1)); + var currentIsDigit = isDigit(identifier.charCodeAt(i)); + + var hasTransitionFromLowerToUpper = transitionFromLowerToUpper(identifier, word, i); + var hasTransitionFromUpperToLower = transitionFromUpperToLower(identifier, word, i, wordStart); + + if (charIsPunctuation(identifier.charCodeAt(i - 1)) || + charIsPunctuation(identifier.charCodeAt(i)) || + lastIsDigit != currentIsDigit || + hasTransitionFromLowerToUpper || + hasTransitionFromUpperToLower) { + + if (!isAllPunctuation(identifier, wordStart, i)) { + result.push(createTextSpan(wordStart, i - wordStart)); + } + + wordStart = i; + } + } + + if (!isAllPunctuation(identifier, wordStart, identifier.length)) { + result.push(createTextSpan(wordStart, identifier.length - wordStart)); + } + + return result; + } + + function charIsPunctuation(ch: number) { + switch (ch) { + case CharacterCodes.exclamation: + case CharacterCodes.doubleQuote: + case CharacterCodes.hash: + case CharacterCodes.percent: + case CharacterCodes.ampersand: + case CharacterCodes.singleQuote: + case CharacterCodes.openParen: + case CharacterCodes.closeParen: + case CharacterCodes.asterisk: + case CharacterCodes.comma: + case CharacterCodes.minus: + case CharacterCodes.dot: + case CharacterCodes.slash: + case CharacterCodes.colon: + case CharacterCodes.semicolon: + case CharacterCodes.question: + case CharacterCodes.at: + case CharacterCodes.openBracket: + case CharacterCodes.backslash: + case CharacterCodes.closeBracket: + case CharacterCodes._: + case CharacterCodes.openBrace: + case CharacterCodes.closeBrace: + return true; + } + + return false; + } + + function isAllPunctuation(identifier: string, start: number, end: number): boolean { + for (var i = start; i < end; i++) { + var ch = identifier.charCodeAt(i); + + // We don't consider _ or $ as punctuation as there may be things with that name. + if (!charIsPunctuation(ch) || ch === CharacterCodes._ || ch === CharacterCodes.$) { + return false; + } + } + + return true; + } + + function transitionFromUpperToLower(identifier: string, word: boolean, index: number, wordStart: number): boolean { + if (word) { + // Cases this supports: + // 1) IDisposable -> I, Disposable + // 2) UIElement -> UI, Element + // 3) HTMLDocument -> HTML, Document + // + // etc. + if (index != wordStart && + index + 1 < identifier.length) { + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + var nextIsLower = isLowerCaseLetter(identifier.charCodeAt(index + 1)); + + if (currentIsUpper && nextIsLower) { + // We have a transition from an upper to a lower letter here. But we only + // want to break if all the letters that preceded are uppercase. i.e. if we + // have "Foo" we don't want to break that into "F, oo". But if we have + // "IFoo" or "UIFoo", then we want to break that into "I, Foo" and "UI, + // Foo". i.e. the last uppercase letter belongs to the lowercase letters + // that follows. Note: this will make the following not split properly: + // "HELLOthere". However, these sorts of names do not show up in .Net + // programs. + for (var i = wordStart; i < index; i++) { + if (!isUpperCaseLetter(identifier.charCodeAt(i))) { + return false; + } + } + + return true; + } + } + } + + return false; + } + + function transitionFromLowerToUpper(identifier: string, word: boolean, index: number): boolean { + var lastIsUpper = isUpperCaseLetter(identifier.charCodeAt(index - 1)); + var currentIsUpper = isUpperCaseLetter(identifier.charCodeAt(index)); + + // See if the casing indicates we're starting a new word. Note: if we're breaking on + // words, then just seeing an upper case character isn't enough. Instead, it has to + // be uppercase and the previous character can't be uppercase. + // + // For example, breaking "AddMetadata" on words would make: Add Metadata + // + // on characters would be: A dd M etadata + // + // Break "AM" on words would be: AM + // + // on characters would be: A M + // + // We break the search string on characters. But we break the symbol name on words. + var transition = word + ? (currentIsUpper && !lastIsUpper) + : currentIsUpper; + return transition; + } +} \ No newline at end of file diff --git a/src/services/services.ts b/src/services/services.ts index 6f7eefc49eb..da12349ea2b 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -3,6 +3,7 @@ /// /// /// +/// /// /// /// @@ -4666,6 +4667,8 @@ module ts { function getNavigateToItems(searchValue: string): NavigateToItem[] { synchronizeHostData(); + + // Split search value in terms array var terms = searchValue.split(" "); diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index a1d695f5105..6b88594b04e 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -1326,6 +1326,7 @@ declare module "typescript" { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index e2e75843311..15b8f52e50e 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -4188,6 +4188,9 @@ declare module "typescript" { greaterThan = 62, >greaterThan : CharacterCodes + hash = 35, +>hash : CharacterCodes + lessThan = 60, >lessThan : CharacterCodes diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index f7c81601bc8..60dea0e949a 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -1357,6 +1357,7 @@ declare module "typescript" { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 722fa806346..f70515d6687 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -4332,6 +4332,9 @@ declare module "typescript" { greaterThan = 62, >greaterThan : CharacterCodes + hash = 35, +>hash : CharacterCodes + lessThan = 60, >lessThan : CharacterCodes diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index daa00de9cb3..df643470c4b 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -1358,6 +1358,7 @@ declare module "typescript" { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 157691c6818..efb773c16e5 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -4284,6 +4284,9 @@ declare module "typescript" { greaterThan = 62, >greaterThan : CharacterCodes + hash = 35, +>hash : CharacterCodes + lessThan = 60, >lessThan : CharacterCodes diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index 177f08f381f..e5fffa9637a 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -1395,6 +1395,7 @@ declare module "typescript" { equals = 61, exclamation = 33, greaterThan = 62, + hash = 35, lessThan = 60, minus = 45, openBrace = 123, diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 1c153bfac39..59e1ade8ce9 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -4457,6 +4457,9 @@ declare module "typescript" { greaterThan = 62, >greaterThan : CharacterCodes + hash = 35, +>hash : CharacterCodes + lessThan = 60, >lessThan : CharacterCodes diff --git a/tests/cases/unittests/services/patternMatcher.ts b/tests/cases/unittests/services/patternMatcher.ts new file mode 100644 index 00000000000..ddf1f9fe344 --- /dev/null +++ b/tests/cases/unittests/services/patternMatcher.ts @@ -0,0 +1,532 @@ +/// +/// + +describe('PatternMatcher', function () { + describe("BreakIntoCharacterSpans", function () { + it("EmptyIdentifier", () => { + verifyBreakIntoCharacterSpans("") + }); + + it("SimpleIdentifier", () => { + verifyBreakIntoCharacterSpans("foo", "foo"); + }); + + it("PrefixUnderscoredIdentifier", () => { + verifyBreakIntoCharacterSpans("_foo", "_", "foo"); + }); + + it("UnderscoredIdentifier", () => { + verifyBreakIntoCharacterSpans("f_oo", "f", "_", "oo"); + }); + + it("PostfixUnderscoredIdentifier", () => { + verifyBreakIntoCharacterSpans("foo_", "foo", "_"); + }); + + it("PrefixUnderscoredIdentifierWithCapital", () => { + verifyBreakIntoCharacterSpans("_Foo", "_", "Foo"); + }); + + it("MUnderscorePrefixed", () => { + verifyBreakIntoCharacterSpans("m_foo", "m", "_", "foo"); + }); + + it("CamelCaseIdentifier", () => { + verifyBreakIntoCharacterSpans("FogBar", "Fog", "Bar"); + }); + + it("MixedCaseIdentifier", () => { + verifyBreakIntoCharacterSpans("fogBar", "fog", "Bar"); + }); + + it("TwoCharacterCapitalIdentifier", () => { + verifyBreakIntoCharacterSpans("UIElement", "U", "I", "Element"); + }); + + it("NumberSuffixedIdentifier", () => { + verifyBreakIntoCharacterSpans("Foo42", "Foo", "42"); + }); + + it("NumberContainingIdentifier", () => { + verifyBreakIntoCharacterSpans("Fog42Bar", "Fog", "42", "Bar"); + }); + + it("NumberPrefixedIdentifier", () => { + verifyBreakIntoCharacterSpans("42Bar", "42", "Bar"); + }); + }); + + describe("BreakIntoWordSpans", function () { + it("VarbatimIdentifier", () => { + verifyBreakIntoWordSpans("@int:", "int"); + }); + + it("AllCapsConstant", () => { + verifyBreakIntoWordSpans("C_STYLE_CONSTANT", "C", "_", "STYLE", "_", "CONSTANT"); + }); + + it("SingleLetterPrefix1", () => { + verifyBreakIntoWordSpans("UInteger", "U", "Integer"); + }); + + it("SingleLetterPrefix2", () => { + verifyBreakIntoWordSpans("IDisposable", "I", "Disposable"); + }); + + it("TwoCharacterCapitalIdentifier", () => { + verifyBreakIntoWordSpans("UIElement", "UI", "Element"); + }); + + it("XDocument", () => { + verifyBreakIntoWordSpans("XDocument", "X", "Document"); + }); + + it("XMLDocument1", () => { + verifyBreakIntoWordSpans("XMLDocument", "XML", "Document"); + }); + + it("XMLDocument2", () => { + verifyBreakIntoWordSpans("XmlDocument", "Xml", "Document"); + }); + + it("TwoUppercaseCharacters", () => { + verifyBreakIntoWordSpans("SimpleUIElement", "Simple", "UI", "Element"); + }); + }); + + describe("SingleWordPattern", () => { + it("PreferCaseSensitiveExact", () => { + debugger; + var match = getFirstMatch("Foo", "Foo"); + + assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveExactInsensitive", () => { + var match = getFirstMatch("foo", "Foo"); + + assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitivePrefix", () => { + var match = getFirstMatch("Foo", "Fo"); + + assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitivePrefixCaseInsensitive", () => { + var match = getFirstMatch("Foo", "fo"); + + assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveCamelCaseMatchSimple", () => { + debugger; + var match = getFirstMatch("FogBar", "FB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + assertInRange(match.camelCaseWeight, 1, 1 << 30); + }); + + it("PreferCaseSensitiveCamelCaseMatchPartialPattern", () => { + var match = getFirstMatch("FogBar", "FoB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveCamelCaseMatchToLongPattern1", () => { + var match = getFirstMatch("FogBar", "FBB"); + + assert.isTrue(match === undefined); + }); + + it("PreferCaseSensitiveCamelCaseMatchToLongPattern2", () => { + var match = getFirstMatch("FogBar", "FoooB"); + + assert.isTrue(match === undefined); + }); + + it("CamelCaseMatchPartiallyUnmatched", () => { + var match = getFirstMatch("FogBarBaz", "FZ"); + + assert.isTrue(match === undefined); + }); + + it("CamelCaseMatchCompletelyUnmatched", () => { + var match = getFirstMatch("FogBarBaz", "ZZ"); + + assert.isTrue(match === undefined); + }); + + it("TwoUppercaseCharacters", () => { + var match = getFirstMatch("SimpleUIElement", "SiUI"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveLowercasePattern", () => { + debugger; + var match = getFirstMatch("FogBar", "b"); + + assert.equal(ts.PatternMatchKind.Substring, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveLowercasePattern2", () => { + var match = getFirstMatch("FogBar", "fB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveTryUnderscoredName", () => { + var match = getFirstMatch("_fogBar", "_fB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveTryUnderscoredName2", () => { + var match = getFirstMatch("_fogBar", "fB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveTryUnderscoredNameInsensitive", () => { + var match = getFirstMatch("_FogBar", "_fB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveMiddleUnderscore", () => { + var match = getFirstMatch("Fog_Bar", "FB"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveMiddleUnderscore2", () => { + var match = getFirstMatch("Fog_Bar", "F_B"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveMiddleUnderscore3", () => { + var match = getFirstMatch("Fog_Bar", "F__B"); + + assert.isTrue(undefined === match); + }); + + it("PreferCaseSensitiveMiddleUnderscore4", () => { + var match = getFirstMatch("Fog_Bar", "f_B"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveMiddleUnderscore5", () => { + var match = getFirstMatch("Fog_Bar", "F_b"); + + assert.equal(ts.PatternMatchKind.CamelCase, match.kind); + assert.equal(false, match.isCaseSensitive); + }); + + it("PreferCaseSensitiveRelativeWeights1", () => { + var match1 = getFirstMatch("FogBarBaz", "FB"); + var match2 = getFirstMatch("FooFlobBaz", "FB"); + + // We should prefer something that starts at the beginning if possible + assertInRange(match1.camelCaseWeight, match2.camelCaseWeight + 1, 1 << 30); + }); + + it("PreferCaseSensitiveRelativeWeights2", () => { + var match1 = getFirstMatch("BazBarFooFooFoo", "FFF"); + var match2 = getFirstMatch("BazFogBarFooFoo", "FFF"); + + // Contiguous things should also be preferred + assertInRange(match1.camelCaseWeight, match2.camelCaseWeight + 1, 1 << 30); + }); + + it("PreferCaseSensitiveRelativeWeights3", () => { + var match1 = getFirstMatch("FogBarFooFoo", "FFF"); + var match2 = getFirstMatch("BarFooFooFoo", "FFF"); + + // The weight of being first should be greater than the weight of being contiguous + assertInRange(match1.camelCaseWeight, match2.camelCaseWeight + 1, 1 << 30); + }); + + it("AllLowerPattern1", () => { + debugger; + var match = getFirstMatch("FogBarChangedEventArgs", "changedeventargs"); + + assert.isTrue(undefined !== match); + }); + + it("AllLowerPattern2", () => { + var match = getFirstMatch("FogBarChangedEventArgs", "changedeventarrrgh"); + + assert.isTrue(undefined === match); + }); + + it("AllLowerPattern3", () => { + var match = getFirstMatch("ABCDEFGH", "bcd"); + + assert.isTrue(undefined !== match); + }); + + it("AllLowerPattern4", () => { + var match = getFirstMatch("AbcdefghijEfgHij", "efghij"); + + assert.isTrue(undefined === match); + }); + }); + + describe("MultiWordPattern", () => { + it("ExactWithLowercase", () => { + var matches = getAllMatches("AddMetadataReference", "addmetadatareference"); + + assertContainsKind(ts.PatternMatchKind.Exact, matches); + }); + + it("SingleLowercasedSearchWord1", () => { + var matches = getAllMatches("AddMetadataReference", "add"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + }); + + it("SingleLowercasedSearchWord2", () => { + var matches = getAllMatches("AddMetadataReference", "metadata"); + + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("SingleUppercaseSearchWord1", () => { + var matches = getAllMatches("AddMetadataReference", "Add"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + }); + + it("SingleUppercaseSearchWord2", () => { + var matches = getAllMatches("AddMetadataReference", "Metadata"); + + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("SingleUppercaseSearchLetter1", () => { + var matches = getAllMatches("AddMetadataReference", "A"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + }); + + it("SingleUppercaseSearchLetter2", () => { + var matches = getAllMatches("AddMetadataReference", "M"); + + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "add metadata"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "A M"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "AM"); + + assertContainsKind(ts.PatternMatchKind.CamelCase, matches); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "ref Metadata") + + assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.Substring, ts.PatternMatchKind.Substring]); + }); + + it("TwoLowercaseWords", () => { + var matches = getAllMatches("AddMetadataReference", "ref M") + + assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.Substring, ts.PatternMatchKind.Substring]); + }); + + it("MixedCamelCase", () => { + var matches = getAllMatches("AddMetadataReference", "AMRe"); + + assertContainsKind(ts.PatternMatchKind.CamelCase, matches); + }); + + it("BlankPattern", () => { + var matches = getAllMatches("AddMetadataReference", ""); + + assert.isTrue(matches === undefined); + }); + + it("WhitespaceOnlyPattern", () => { + var matches = getAllMatches("AddMetadataReference", " "); + + assert.isTrue(matches === undefined); + }); + + it("EachWordSeparately1", () => { + var matches = getAllMatches("AddMetadataReference", "add Meta"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("EachWordSeparately2", () => { + var matches = getAllMatches("AddMetadataReference", "Add meta"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("EachWordSeparately3", () => { + var matches = getAllMatches("AddMetadataReference", "Add Meta"); + + assertContainsKind(ts.PatternMatchKind.Prefix, matches); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + }); + + it("MixedCasing", () => { + var matches = getAllMatches("AddMetadataReference", "mEta"); + + assert.isTrue(matches === undefined); + }); + + it("MixedCasing2", () => { + var matches = getAllMatches("AddMetadataReference", "Data"); + + assert.isTrue(matches === undefined); + }); + + it("AsteriskSplit", () => { + var matches = getAllMatches("GetKeyWord", "K*W"); + + assertArrayEquals(ts.map(matches, m => m.kind), [ts.PatternMatchKind.Substring, ts.PatternMatchKind.Substring]); + }); + + it("LowercaseSubstring1", () => { + var matches = getAllMatches("Operator", "a"); + + assert.isTrue(matches === undefined); + }); + + it("LowercaseSubstring2", () => { + var matches = getAllMatches("FooAttribute", "a"); + assertContainsKind(ts.PatternMatchKind.Substring, matches); + assert.isFalse(matches[0].isCaseSensitive); + }); + }); + + describe("DottedPattern", () => { + it("DottedPattern1", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "B.Q"); + + assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("DottedPattern2", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "C.Q"); + assert.isTrue(match === undefined); + }); + + it("DottedPattern3", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "B.B.Q"); + assert.equal(ts.PatternMatchKind.Prefix, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("DottedPattern4", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "Baz.Quux"); + assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("DottedPattern5", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "F.B.B.Quux"); + assert.equal(ts.PatternMatchKind.Exact, match.kind); + assert.equal(true, match.isCaseSensitive); + }); + + it("DottedPattern6", () => { + var match = getFirstMatchForDottedPattern("Foo.Bar.Baz", "Quux", "F.F.B.B.Quux"); + assert.isTrue(match === undefined); + }); + + it("DottedPattern7", () => { + debugger; + var match = getFirstMatch("UIElement", "UIElement"); + var match = getFirstMatch("GetKeyword", "UIElement"); + assert.isTrue(match === undefined); + }); + }); + + function getFirstMatch(candidate: string, pattern: string): ts.PatternMatch { + var matches = ts.createPatternMatcher(pattern).getMatchesForLastSegmentOfPattern(candidate); + return matches ? matches[0] : undefined; + } + + function getAllMatches(candidate: string, pattern: string): ts.PatternMatch[] { + return ts.createPatternMatcher(pattern).getMatchesForLastSegmentOfPattern(candidate); + } + + function getFirstMatchForDottedPattern(dottedContainer: string, candidate: string, pattern: string): ts.PatternMatch { + var matches = ts.createPatternMatcher(pattern).getMatches(candidate, dottedContainer); + return matches ? matches[0] : undefined; + } + + function spanListToSubstrings(identifier: string, spans: ts.TextSpan[]) { + return ts.map(spans, s => identifier.substr(s.start, s.length)); + } + + function breakIntoCharacterSpans(identifier: string) { + return spanListToSubstrings(identifier, ts.breakIntoCharacterSpans(identifier)); + } + + function breakIntoWordSpans(identifier: string) { + return spanListToSubstrings(identifier, ts.breakIntoWordSpans(identifier)); + } + function assertArrayEquals(array1: T[], array2: T[]) { + assert.equal(array1.length, array2.length); + + for (var i = 0, n = array1.length; i < n; i++) { + assert.equal(array1[i], array2[i]); + } + } + + function assertInRange(val: number, low: number, high: number) { + assert.isTrue(val >= low); + assert.isTrue(val <= high); + } + + function verifyBreakIntoCharacterSpans(original: string, ...parts: string[]): void { + assertArrayEquals(parts, breakIntoCharacterSpans(original)); + } + + function verifyBreakIntoWordSpans(original: string, ...parts: string[]): void { + assertArrayEquals(parts, breakIntoWordSpans(original)); + } + + function assertContainsKind(kind: ts.PatternMatchKind, results: ts.PatternMatch[]) { + assert.isTrue(ts.forEach(results, r => r.kind === kind)); + } +}); \ No newline at end of file From 49c78968a32ab1be74dde85d64ec1f95ee03f193 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 20 Feb 2015 11:25:42 -0800 Subject: [PATCH 143/162] CR feedback. --- src/compiler/types.ts | 2 +- src/services/patternMatcher.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index bfc32e2e4c1..4142dfe8874 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -1646,7 +1646,7 @@ module ts { equals = 0x3D, // = exclamation = 0x21, // ! greaterThan = 0x3E, // > - hash = 0x23, + hash = 0x23, // # lessThan = 0x3C, // < minus = 0x2D, // - openBrace = 0x7B, // { diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts index 7beb70ad1e8..98a9ad98a2e 100644 --- a/src/services/patternMatcher.ts +++ b/src/services/patternMatcher.ts @@ -19,12 +19,12 @@ module ts { camelCaseWeight: number; // If this was a match where all consituent parts of the candidate and search pattern - // matched cast sensitively or case insensitively. Case sensitive matches of the kind + // matched case sensitively or case insensitively. Case sensitive matches of the kind // are better matches than insensitive matches. isCaseSensitive: boolean; // Whether or not this match occured with the punctuation from the search pattern stripped - // out or not. Matched without the punctuation stripped are better than ones with punctuation + // out or not. Matches without the punctuation stripped are better than ones with punctuation // stripped. punctuationStripped: boolean; } @@ -34,7 +34,7 @@ module ts { // once you no longer need it. export interface PatternMatcher { // Used to match a candidate against the last segment of a possibly dotted pattern. This - // is useful as a quick check to preven having to compute a container before calling + // is useful as a quick check to prevent having to compute a container before calling // "getMatches". // // For example, if the search pattern is "ts.c.SK" and the candidate is "SyntaxKind", then From 566e4fb2dd00f834ee119288f932280f0c2ffa7d Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Fri, 20 Feb 2015 11:58:50 -0800 Subject: [PATCH 144/162] Formatting around 'of' keyword --- src/services/formatting/rules.ts | 3 +++ src/services/formatting/tokenRange.ts | 2 +- tests/cases/fourslash/formattingForOfKeyword.ts | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 tests/cases/fourslash/formattingForOfKeyword.ts diff --git a/src/services/formatting/rules.ts b/src/services/formatting/rules.ts index bf7e3f3988a..b5470579787 100644 --- a/src/services/formatting/rules.ts +++ b/src/services/formatting/rules.ts @@ -464,6 +464,9 @@ module ts.formatting { // "in" keyword in for (var x in []) { } case SyntaxKind.ForInStatement: return context.currentTokenSpan.kind === SyntaxKind.InKeyword || context.nextTokenSpan.kind === SyntaxKind.InKeyword; + // Technically, "of" is not a binary operator, but format it the same way as "in" + case SyntaxKind.ForOfStatement: + return context.currentTokenSpan.kind === SyntaxKind.OfKeyword || context.nextTokenSpan.kind === SyntaxKind.OfKeyword; } return false; } diff --git a/src/services/formatting/tokenRange.ts b/src/services/formatting/tokenRange.ts index 6dace543eab..ff9cb91ce68 100644 --- a/src/services/formatting/tokenRange.ts +++ b/src/services/formatting/tokenRange.ts @@ -126,7 +126,7 @@ module ts.formatting { static AnyIncludingMultilineComments = TokenRange.FromTokens(TokenRange.Any.GetTokens().concat([SyntaxKind.MultiLineCommentTrivia])); static Keywords = TokenRange.FromRange(SyntaxKind.FirstKeyword, SyntaxKind.LastKeyword); static BinaryOperators = TokenRange.FromRange(SyntaxKind.FirstBinaryOperator, SyntaxKind.LastBinaryOperator); - static BinaryKeywordOperators = TokenRange.FromTokens([SyntaxKind.InKeyword, SyntaxKind.InstanceOfKeyword]); + static BinaryKeywordOperators = TokenRange.FromTokens([SyntaxKind.InKeyword, SyntaxKind.InstanceOfKeyword, SyntaxKind.OfKeyword]); static UnaryPrefixOperators = TokenRange.FromTokens([SyntaxKind.PlusPlusToken, SyntaxKind.MinusMinusToken, SyntaxKind.TildeToken, SyntaxKind.ExclamationToken]); static UnaryPrefixExpressions = TokenRange.FromTokens([SyntaxKind.NumericLiteral, SyntaxKind.Identifier, SyntaxKind.OpenParenToken, SyntaxKind.OpenBracketToken, SyntaxKind.OpenBraceToken, SyntaxKind.ThisKeyword, SyntaxKind.NewKeyword]); static UnaryPreincrementExpressions = TokenRange.FromTokens([SyntaxKind.Identifier, SyntaxKind.OpenParenToken, SyntaxKind.ThisKeyword, SyntaxKind.NewKeyword]); diff --git a/tests/cases/fourslash/formattingForOfKeyword.ts b/tests/cases/fourslash/formattingForOfKeyword.ts new file mode 100644 index 00000000000..33b3d83c00f --- /dev/null +++ b/tests/cases/fourslash/formattingForOfKeyword.ts @@ -0,0 +1,8 @@ +/// + +/////**/for ([]of[]) { } + + +format.document(); +goTo.marker(); +verify.currentLineContentIs('for ([] of []) { }'); \ No newline at end of file From 580d0a6331e973f6bbd28017924001bd46207594 Mon Sep 17 00:00:00 2001 From: Jason Freeman Date: Fri, 20 Feb 2015 12:15:37 -0800 Subject: [PATCH 145/162] More tests --- .../syntacticClassificationsForOfKeyword2.ts | 16 ++++++++++++++++ .../syntacticClassificationsForOfKeyword3.ts | 18 ++++++++++++++++++ tests/cases/unittests/services/colorization.ts | 15 +++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 tests/cases/fourslash/syntacticClassificationsForOfKeyword2.ts create mode 100644 tests/cases/fourslash/syntacticClassificationsForOfKeyword3.ts diff --git a/tests/cases/fourslash/syntacticClassificationsForOfKeyword2.ts b/tests/cases/fourslash/syntacticClassificationsForOfKeyword2.ts new file mode 100644 index 00000000000..30cfaea51e0 --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsForOfKeyword2.ts @@ -0,0 +1,16 @@ +/// + +//// for (var of in of) { } + +var c = classification; +verify.syntacticClassificationsAre( + c.keyword("for"), + c.punctuation("("), + c.keyword("var"), + c.text("of"), + c.keyword("in"), + c.text("of"), + c.punctuation(")"), + c.punctuation("{"), + c.punctuation("}") + ); \ No newline at end of file diff --git a/tests/cases/fourslash/syntacticClassificationsForOfKeyword3.ts b/tests/cases/fourslash/syntacticClassificationsForOfKeyword3.ts new file mode 100644 index 00000000000..3af4733f3b2 --- /dev/null +++ b/tests/cases/fourslash/syntacticClassificationsForOfKeyword3.ts @@ -0,0 +1,18 @@ +/// + +//// for (var of; of; of) { } + +var c = classification; +verify.syntacticClassificationsAre( + c.keyword("for"), + c.punctuation("("), + c.keyword("var"), + c.text("of"), + c.punctuation(";"), + c.text("of"), + c.punctuation(";"), + c.text("of"), + c.punctuation(")"), + c.punctuation("{"), + c.punctuation("}") + ); \ No newline at end of file diff --git a/tests/cases/unittests/services/colorization.ts b/tests/cases/unittests/services/colorization.ts index 890ced3b891..6c685cdb174 100644 --- a/tests/cases/unittests/services/colorization.ts +++ b/tests/cases/unittests/services/colorization.ts @@ -430,5 +430,20 @@ class D { }\r\n\ comment(">>>>>>> Branch - a"), finalEndOfLineState(ts.EndOfLineState.Start)); }); + + it("'of' keyword", function () { + testLexicalClassification("for (var of of of) { }", + ts.EndOfLineState.Start, + keyword("for"), + punctuation("("), + keyword("var"), + keyword("of"), + keyword("of"), + keyword("of"), + punctuation(")"), + punctuation("{"), + punctuation("}"), + finalEndOfLineState(ts.EndOfLineState.Start)); + }); }); }); \ No newline at end of file From 128295dea9e99a9a7efcf12c559353607309fe2c Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 20 Feb 2015 13:55:45 -0800 Subject: [PATCH 146/162] CR feedback. --- src/services/patternMatcher.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/services/patternMatcher.ts b/src/services/patternMatcher.ts index 98a9ad98a2e..da07c4400bc 100644 --- a/src/services/patternMatcher.ts +++ b/src/services/patternMatcher.ts @@ -16,14 +16,14 @@ module ts { // If this was a camel case match, how strong the match is. Higher number means // it was a better match. - camelCaseWeight: number; + camelCaseWeight?: number; - // If this was a match where all consituent parts of the candidate and search pattern + // If this was a match where all constituent parts of the candidate and search pattern // matched case sensitively or case insensitively. Case sensitive matches of the kind // are better matches than insensitive matches. isCaseSensitive: boolean; - // Whether or not this match occured with the punctuation from the search pattern stripped + // Whether or not this match occurred with the punctuation from the search pattern stripped // out or not. Matches without the punctuation stripped are better than ones with punctuation // stripped. punctuationStripped: boolean; @@ -43,11 +43,14 @@ module ts { // work to create 'ts.compiler' only being done once the first match succeeded. getMatchesForLastSegmentOfPattern(candidate: string): PatternMatch[]; - // Fully checks a candidate, with an optional dotted container against the search pattern. + // Fully checks a candidate, with an dotted container, against the search pattern. // The candidate must match the last part of the search pattern, and the dotted container // must match the preceding segments of the pattern. getMatches(candidate: string, dottedContainer: string): PatternMatch[]; - isDottedPattern: boolean; + + // Whether or not the pattern contained dots or not. Clients can use this to determine + // If they should call getMatches, or if getMatchesForLastSegmentOfPattern is sufficient. + patternContainsDots: boolean; } // First we break up the pattern given by dots. Each portion of the pattern between the @@ -120,7 +123,7 @@ module ts { return { getMatches, getMatchesForLastSegmentOfPattern, - isDottedPattern: dotSeparatedSegments.length > 1 + patternContainsDots: dotSeparatedSegments.length > 1 }; // Quick checks so we can bail out when asked to match a candidate. From 51129a704d45edd75897d1160da0eb0d8870cb04 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 20 Feb 2015 14:16:09 -0800 Subject: [PATCH 147/162] Rewrite the tree instead of hacking text together for downlevel object literals with computed properties. --- src/compiler/emitter.ts | 201 +++++++++++++++++- .../FunctionPropertyAssignments5_es6.js | 2 +- .../reference/computedPropertyNames10_ES5.js | 15 +- .../reference/computedPropertyNames11_ES5.js | 83 ++------ .../reference/computedPropertyNames18_ES5.js | 5 +- .../reference/computedPropertyNames19_ES5.js | 5 +- .../reference/computedPropertyNames1_ES5.js | 19 +- .../reference/computedPropertyNames20_ES5.js | 5 +- .../reference/computedPropertyNames22_ES5.js | 5 +- .../reference/computedPropertyNames25_ES5.js | 5 +- .../reference/computedPropertyNames28_ES5.js | 5 +- .../reference/computedPropertyNames29_ES5.js | 5 +- .../reference/computedPropertyNames30_ES5.js | 8 +- .../reference/computedPropertyNames31_ES5.js | 5 +- .../reference/computedPropertyNames33_ES5.js | 5 +- .../reference/computedPropertyNames34_ES5.js | 5 +- .../reference/computedPropertyNames46_ES5.js | 5 +- .../reference/computedPropertyNames47_ES5.js | 5 +- .../reference/computedPropertyNames48_ES5.js | 15 +- .../reference/computedPropertyNames49_ES5.js | 50 ++--- .../reference/computedPropertyNames4_ES5.js | 15 +- .../reference/computedPropertyNames50_ES5.js | 49 ++--- .../reference/computedPropertyNames5_ES5.js | 10 +- .../reference/computedPropertyNames6_ES5.js | 7 +- .../reference/computedPropertyNames7_ES5.js | 5 +- .../reference/computedPropertyNames8_ES5.js | 6 +- .../reference/computedPropertyNames9_ES5.js | 7 +- ...mputedPropertyNamesContextualType10_ES5.js | 6 +- ...omputedPropertyNamesContextualType1_ES5.js | 10 +- ...omputedPropertyNamesContextualType2_ES5.js | 10 +- ...omputedPropertyNamesContextualType3_ES5.js | 10 +- ...omputedPropertyNamesContextualType4_ES5.js | 6 +- ...omputedPropertyNamesContextualType5_ES5.js | 6 +- ...omputedPropertyNamesContextualType6_ES5.js | 11 +- ...omputedPropertyNamesContextualType7_ES5.js | 11 +- ...omputedPropertyNamesContextualType8_ES5.js | 6 +- ...omputedPropertyNamesContextualType9_ES5.js | 6 +- ...mputedPropertyNamesDeclarationEmit5_ES5.js | 20 +- .../computedPropertyNamesSourceMap2_ES5.js | 9 +- ...computedPropertyNamesSourceMap2_ES5.js.map | 2 +- ...dPropertyNamesSourceMap2_ES5.sourcemap.txt | 188 +++++++++------- .../parserES5ComputedPropertyName3.js | 2 +- .../parserES5ComputedPropertyName4.js | 6 +- tests/baselines/reference/privateIndexer2.js | 6 +- 44 files changed, 412 insertions(+), 455 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index edd6be126d5..89c39cdc36b 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -21,6 +21,12 @@ module ts { diagnosticMessage: DiagnosticMessage; typeName?: DeclarationName; } + + interface SynthesizedNode extends Node { + leadingCommentRanges?: CommentRange[]; + trailingCommentRanges?: CommentRange[]; + } + type GetSymbolAccessibilityDiagnostic = (symbolAccesibilityResult: SymbolAccessiblityResult) => SymbolAccessibilityDiagnostic; interface EmitTextWriterWithSymbolWriter extends EmitTextWriter, SymbolWriter { @@ -2514,7 +2520,198 @@ module ts { write("}"); } - function emitDownlevelObjectLiteralWithComputedProperties(node: ObjectLiteralExpression, firstComputedPropertyIndex: number) { + function createSynthesizedNode(kind: SyntaxKind): Node { + var node = createNode(kind); + node.pos = -1; + node.end = -1; + return node; + } + + function emitDownlevelObjectLiteralWithComputedProperties(node: ObjectLiteralExpression, firstComputedPropertyIndex: number): void { + var parenthesizedObjectLiteral = createDownlevelObjectLiteralWithComputedProperties(node, firstComputedPropertyIndex); + return emit(parenthesizedObjectLiteral); + } + + function createDownlevelObjectLiteralWithComputedProperties(originalObjectLiteral: ObjectLiteralExpression, firstComputedPropertyIndex: number): ParenthesizedExpression { + // For computed properties, we need to create a unique handle to the object + // literal so we can modify it without risking internal assignments tainting the object. + var tempVar = createAndRecordTempVariable(originalObjectLiteral); + + // Hold onto the initial non-computed properties in a new object literal, + // then create the rest through property accesses on the temp variable. + var initialObjectLiteral = createSynthesizedNode(SyntaxKind.ObjectLiteralExpression); + initialObjectLiteral.properties = >originalObjectLiteral.properties.slice(0, firstComputedPropertyIndex); + initialObjectLiteral.flags |= NodeFlags.MultiLine; + + // The comma expressions that will patch the object literal. + var propertyPatches = createBinaryExpression(SyntaxKind.EqualsToken, tempVar, initialObjectLiteral); + + ts.forEach(originalObjectLiteral.properties, property => { + var patchedProperty = tryCreatePatchingPropertyAssignment(originalObjectLiteral, tempVar, property); + if (patchedProperty) { + // TODO(drosen): Preserve comments + //var leadingComments = getLeadingCommentRanges(currentSourceFile.text, property.pos); + //var trailingComments = getTrailingCommentRanges(currentSourceFile.text, property.end); + //addCommentsToSynthesizedNode(patchedProperty, leadingComments, trailingComments); + + propertyPatches = createBinaryExpression(SyntaxKind.CommaToken, propertyPatches, patchedProperty); + } + }); + + propertyPatches = createBinaryExpression(SyntaxKind.CommaToken, propertyPatches, tempVar); + + var result = createParenthesizedExpression(propertyPatches); + + // TODO(drosen): Preserve comments + // var leadingComments = getLeadingCommentRanges(currentSourceFile.text, originalObjectLiteral.pos); + // var trailingComments = getTrailingCommentRanges(currentSourceFile.text, originalObjectLiteral.end); + //addCommentsToSynthesizedNode(result, leadingComments, trailingComments); + + return result; + } + + function addCommentsToSynthesizedNode(node: SynthesizedNode, leadingCommentRanges: CommentRange[], trailingCommentRanges: CommentRange[]): void { + node.leadingCommentRanges = leadingCommentRanges; + node.trailingCommentRanges = trailingCommentRanges; + } + + // Returns 'undefined' if a property has already been accounted for. + function tryCreatePatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, tempVar: Identifier, property: ObjectLiteralElement): Expression { + var leftHandSide = createMemberAccessForPropertyName(tempVar, property.name); + var rightHandSide: Expression; + + if (property.kind === SyntaxKind.PropertyAssignment) { + rightHandSide = (property).initializer; + } + else if (property.kind === SyntaxKind.ShorthandPropertyAssignment) { + var prefix = createIdentifier(resolver.getExpressionNamePrefix((property).name)); + rightHandSide = createPropertyAccessExpression(prefix, (property).name); + } + else if (property.kind === SyntaxKind.MethodDeclaration) { + emitFunctionDeclaration(property); + } + else if (property.kind === SyntaxKind.GetAccessor || property.kind === SyntaxKind.SetAccessor) { + var accessors = getAllAccessorDeclarations(objectLiteral.properties, property); + + // Only emit the first accessor. + if (accessors.firstAccessor !== property) { + return undefined; + } + + var propertyDescriptor = createSynthesizedNode(SyntaxKind.ObjectLiteralExpression); + + var descriptorProperties = >[]; + if (accessors.getAccessor) { + var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpressionForAccessor(accessors.getAccessor)); + descriptorProperties.push(getProperty); + } + if (accessors.setAccessor) { + var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpressionForAccessor(accessors.setAccessor)); + descriptorProperties.push(setProperty); + } + + var trueExpr = createSynthesizedNode(SyntaxKind.TrueKeyword); + + var enumerableTrue = createPropertyAssignment(createIdentifier("enumerable"), trueExpr); + descriptorProperties.push(enumerableTrue); + + var configurableTrue = createPropertyAssignment(createIdentifier("configurable"), trueExpr); + descriptorProperties.push(configurableTrue); + + propertyDescriptor.properties = descriptorProperties; + + var objectDotDefineProperty = createPropertyAccessExpression(createIdentifier("Object"), createIdentifier("defineProperty")); + rightHandSide = createCallExpression(objectDotDefineProperty, createNodeArray(propertyDescriptor)); + } + else { + Debug.fail(`ObjectLiteralElement kind ${property.kind} not accounted for.`); + } + + return createBinaryExpression(SyntaxKind.EqualsToken, leftHandSide, rightHandSide); + } + + function createParenthesizedExpression(expression: Expression) { + var result = createSynthesizedNode(SyntaxKind.ParenthesizedExpression); + result.expression = expression; + return result; + } + + function createNodeArray(...elements: T[]): NodeArray { + return >elements; + } + + function createBinaryExpression(operator: SyntaxKind, left: Expression, right: Expression): BinaryExpression { + var result = createSynthesizedNode(SyntaxKind.BinaryExpression); + result.operator = operator; + result.left = left; + result.right = right; + + return result; + } + + function createMemberAccessForPropertyName(expression: LeftHandSideExpression, memberName: DeclarationName): PropertyAccessExpression | ElementAccessExpression { + if (memberName.kind === SyntaxKind.Identifier) { + return createPropertyAccessExpression(expression, memberName); + } + else if (memberName.kind === SyntaxKind.StringLiteral || memberName.kind === SyntaxKind.NumericLiteral) { + return createElementAccessExpression(expression, memberName); + } + else if (memberName.kind === SyntaxKind.ComputedPropertyName) { + return createElementAccessExpression(expression, (memberName).expression); + } + else { + Debug.fail(`Kind '${memberName.kind}' not accounted for.`); + } + } + + function createPropertyAssignment(name: LiteralExpression | Identifier, initializer: Expression) { + var result = createSynthesizedNode(SyntaxKind.PropertyAssignment); + + result.name = name; + result.initializer = initializer; + + return result; + } + + function createFunctionExpressionForAccessor(accessor: AccessorDeclaration): FunctionExpression { + var result = createSynthesizedNode(SyntaxKind.FunctionExpression); + result.parameters = accessor.parameters; + result.body = accessor.body; + + return result; + } + + function createPropertyAccessExpression(expression: LeftHandSideExpression, name: Identifier): PropertyAccessExpression { + var result = createSynthesizedNode(SyntaxKind.PropertyAccessExpression); + result.expression = expression; + result.name = name; + + return result; + } + + function createElementAccessExpression(expression: LeftHandSideExpression, argumentExpression: Expression): ElementAccessExpression { + var result = createSynthesizedNode(SyntaxKind.ElementAccessExpression); + result.expression = expression; + result.argumentExpression = argumentExpression; + + return result; + } + + function createIdentifier(name: string) { + var result = createSynthesizedNode(SyntaxKind.Identifier); + result.text = name; + return result; + } + + function createCallExpression(invokedExpression: MemberExpression, arguments: NodeArray) { + var result = createSynthesizedNode(SyntaxKind.CallExpression); + result.expression = invokedExpression; + result.arguments = arguments; + + return result; + } + + function emitDownlevelObjectLiteralWithComputedProperties2(node: ObjectLiteralExpression, firstComputedPropertyIndex: number) { var multiLine = (node.flags & NodeFlags.MultiLine) !== 0; var properties = node.properties; @@ -2587,7 +2784,7 @@ module ts { write("})"); emitEnd(property); } - else { + else { emitLeadingComments(property); emitStart(property.name); emit(tempVar); diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js index 188a843f751..9cf09c0b96e 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js @@ -2,5 +2,5 @@ var v = { *[foo()]() { } } //// [FunctionPropertyAssignments5_es6.js] -var v = (_a = {}, _a[foo()] = function () { }, _a); +var v = function () { }(_a = {}, _a[foo()] = , _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.js b/tests/baselines/reference/computedPropertyNames10_ES5.js index 14d9235b12b..bebc2b3a537 100644 --- a/tests/baselines/reference/computedPropertyNames10_ES5.js +++ b/tests/baselines/reference/computedPropertyNames10_ES5.js @@ -20,18 +20,5 @@ var v = { var s; var n; var a; -var v = (_a = {}, - _a[s] = function () { }, - _a[n] = function () { }, - _a[s + s] = function () { }, - _a[s + n] = function () { }, - _a[+s] = function () { }, - _a[""] = function () { }, - _a[0] = function () { }, - _a[a] = function () { }, - _a[true] = function () { }, - _a["hello bye"] = function () { }, - _a["hello " + a + " bye"] = function () { }, - _a -); +var v = function () { }function () { }function () { }function () { }function () { }function () { }function () { }function () { }function () { }function () { }function () { }(_a = {}, _a[s] = , _a[n] = , _a[s + s] = , _a[s + n] = , _a[+s] = , _a[""] = , _a[0] = , _a[a] = , _a[true] = , _a["hello bye"] = , _a["hello " + a + " bye"] = , _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.js b/tests/baselines/reference/computedPropertyNames11_ES5.js index 5716f2722ac..213b30b1a59 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES5.js +++ b/tests/baselines/reference/computedPropertyNames11_ES5.js @@ -20,74 +20,17 @@ var v = { var s; var n; var a; -var v = (_a = {}, - Object.defineProperty(_a, s, { - get: function () { - return 0; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, n, { - set: function (v) { }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, s + s, { - get: function () { - return 0; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, s + n, { - set: function (v) { }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, +s, { - get: function () { - return 0; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, "", { - set: function (v) { }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, 0, { - get: function () { - return 0; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, a, { - set: function (v) { }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, true, { - get: function () { - return 0; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, "hello bye", { - set: function (v) { }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, "hello " + a + " bye", { - get: function () { - return 0; - }, - enumerable: true, - configurable: true - }), - _a -); +var v = (_a = {}, _a[s] = Object.defineProperty({ get: function () { + return 0; +}, enumerable: true, configurable: true }), _a[n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[s + s] = Object.defineProperty({ get: function () { + return 0; +}, enumerable: true, configurable: true }), _a[s + n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[+s] = Object.defineProperty({ get: function () { + return 0; +}, enumerable: true, configurable: true }), _a[""] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[0] = Object.defineProperty({ get: function () { + return 0; +}, enumerable: true, configurable: true }), _a[a] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[true] = Object.defineProperty({ get: function () { + return 0; +}, enumerable: true, configurable: true }), _a["hello bye"] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a["hello " + a + " bye"] = Object.defineProperty({ get: function () { + return 0; +}, enumerable: true, configurable: true }), _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames18_ES5.js b/tests/baselines/reference/computedPropertyNames18_ES5.js index b65c7fd4f7d..6e61d587f63 100644 --- a/tests/baselines/reference/computedPropertyNames18_ES5.js +++ b/tests/baselines/reference/computedPropertyNames18_ES5.js @@ -7,9 +7,6 @@ function foo() { //// [computedPropertyNames18_ES5.js] function foo() { - var obj = (_a = {}, - _a[this.bar] = 0, - _a - ); + var obj = (_a = {}, _a[this.bar] = 0, _a); var _a; } diff --git a/tests/baselines/reference/computedPropertyNames19_ES5.js b/tests/baselines/reference/computedPropertyNames19_ES5.js index 36f3e66c7c2..33d0b25817c 100644 --- a/tests/baselines/reference/computedPropertyNames19_ES5.js +++ b/tests/baselines/reference/computedPropertyNames19_ES5.js @@ -8,9 +8,6 @@ module M { //// [computedPropertyNames19_ES5.js] var M; (function (M) { - var obj = (_a = {}, - _a[this.bar] = 0, - _a - ); + var obj = (_a = {}, _a[this.bar] = 0, _a); var _a; })(M || (M = {})); diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.js b/tests/baselines/reference/computedPropertyNames1_ES5.js index ca5149928e6..f31abf71051 100644 --- a/tests/baselines/reference/computedPropertyNames1_ES5.js +++ b/tests/baselines/reference/computedPropertyNames1_ES5.js @@ -5,20 +5,7 @@ var v = { } //// [computedPropertyNames1_ES5.js] -var v = (_a = {}, - Object.defineProperty(_a, 0 + 1, { - get: function () { - return 0; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, 0 + 1, { - set: function (v) { } //No error - , - enumerable: true, - configurable: true - }), - _a -); +var v = (_a = {}, _a[0 + 1] = Object.defineProperty({ get: function () { + return 0; +}, enumerable: true, configurable: true }), _a[0 + 1] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames20_ES5.js b/tests/baselines/reference/computedPropertyNames20_ES5.js index 65acd7fa08f..d9fad19e826 100644 --- a/tests/baselines/reference/computedPropertyNames20_ES5.js +++ b/tests/baselines/reference/computedPropertyNames20_ES5.js @@ -4,8 +4,5 @@ var obj = { } //// [computedPropertyNames20_ES5.js] -var obj = (_a = {}, - _a[this.bar] = 0, - _a -); +var obj = (_a = {}, _a[this.bar] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.js b/tests/baselines/reference/computedPropertyNames22_ES5.js index e82bf673b52..bcea64253ee 100644 --- a/tests/baselines/reference/computedPropertyNames22_ES5.js +++ b/tests/baselines/reference/computedPropertyNames22_ES5.js @@ -13,10 +13,7 @@ var C = (function () { function C() { } C.prototype.bar = function () { - var obj = (_a = {}, - _a[this.bar()] = function () { }, - _a - ); + var obj = function () { }(_a = {}, _a[this.bar()] = , _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js index b6a8d254b26..4bc609ca727 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.js +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -34,10 +34,7 @@ var C = (function (_super) { _super.apply(this, arguments); } C.prototype.foo = function () { - var obj = (_a = {}, - _a[_super.prototype.bar.call(this)] = function () { }, - _a - ); + var obj = function () { }(_a = {}, _a[_super.prototype.bar.call(this)] = , _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js index 5940c498db8..c918d2f693e 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES5.js +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -26,10 +26,7 @@ var C = (function (_super) { __extends(C, _super); function C() { _super.call(this); - var obj = (_a = {}, - _a[(_super.call(this), "prop")] = function () { }, - _a - ); + var obj = function () { }(_a = {}, _a[(_super.call(this), "prop")] = , _a); var _a; } return C; diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.js b/tests/baselines/reference/computedPropertyNames29_ES5.js index 4682ae9105e..475b5947b44 100644 --- a/tests/baselines/reference/computedPropertyNames29_ES5.js +++ b/tests/baselines/reference/computedPropertyNames29_ES5.js @@ -17,10 +17,7 @@ var C = (function () { C.prototype.bar = function () { var _this = this; (function () { - var obj = (_a = {}, - _a[_this.bar()] = function () { }, - _a - ); + var obj = function () { }(_a = {}, _a[_this.bar()] = , _a); var _a; }); return 0; diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js index 05196e23c5b..bb1f2f1a4cd 100644 --- a/tests/baselines/reference/computedPropertyNames30_ES5.js +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -32,13 +32,7 @@ var C = (function (_super) { function C() { _super.call(this); (function () { - var obj = (_a = {}, - // Ideally, we would capture this. But the reference is - // illegal, and not capturing this is consistent with - //treatment of other similar violations. - _a[(_super.call(this), "prop")] = function () { }, - _a - ); + var obj = function () { }(_a = {}, _a[(_super.call(this), "prop")] = , _a); var _a; }); } diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js index 173e3c7222b..1d2340acc0c 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.js +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -38,10 +38,7 @@ var C = (function (_super) { C.prototype.foo = function () { var _this = this; (function () { - var obj = (_a = {}, - _a[_super.prototype.bar.call(_this)] = function () { }, - _a - ); + var obj = function () { }(_a = {}, _a[_super.prototype.bar.call(_this)] = , _a); var _a; }); return 0; diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.js b/tests/baselines/reference/computedPropertyNames33_ES5.js index bf1c0f063e3..606d286114a 100644 --- a/tests/baselines/reference/computedPropertyNames33_ES5.js +++ b/tests/baselines/reference/computedPropertyNames33_ES5.js @@ -17,10 +17,7 @@ var C = (function () { function C() { } C.prototype.bar = function () { - var obj = (_a = {}, - _a[foo()] = function () { }, - _a - ); + var obj = function () { }(_a = {}, _a[foo()] = , _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames34_ES5.js b/tests/baselines/reference/computedPropertyNames34_ES5.js index b43bee9f117..b1bea64123f 100644 --- a/tests/baselines/reference/computedPropertyNames34_ES5.js +++ b/tests/baselines/reference/computedPropertyNames34_ES5.js @@ -17,10 +17,7 @@ var C = (function () { function C() { } C.bar = function () { - var obj = (_a = {}, - _a[foo()] = function () { }, - _a - ); + var obj = function () { }(_a = {}, _a[foo()] = , _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames46_ES5.js b/tests/baselines/reference/computedPropertyNames46_ES5.js index 307dadcbe91..8919b0389aa 100644 --- a/tests/baselines/reference/computedPropertyNames46_ES5.js +++ b/tests/baselines/reference/computedPropertyNames46_ES5.js @@ -4,8 +4,5 @@ var o = { }; //// [computedPropertyNames46_ES5.js] -var o = (_a = {}, - _a["" || 0] = 0, - _a -); +var o = (_a = {}, _a["" || 0] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames47_ES5.js b/tests/baselines/reference/computedPropertyNames47_ES5.js index 6ba31fe3b06..26add5173a9 100644 --- a/tests/baselines/reference/computedPropertyNames47_ES5.js +++ b/tests/baselines/reference/computedPropertyNames47_ES5.js @@ -14,8 +14,5 @@ var E2; (function (E2) { E2[E2["x"] = 0] = "x"; })(E2 || (E2 = {})); -var o = (_a = {}, - _a[0 /* x */ || 0 /* x */] = 0, - _a -); +var o = (_a = {}, _a[0 /* x */ || 0 /* x */] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.js b/tests/baselines/reference/computedPropertyNames48_ES5.js index 859fb7a179c..66c0336767f 100644 --- a/tests/baselines/reference/computedPropertyNames48_ES5.js +++ b/tests/baselines/reference/computedPropertyNames48_ES5.js @@ -23,16 +23,7 @@ var E; E[E["x"] = 0] = "x"; })(E || (E = {})); var a; -extractIndexer((_a = {}, - _a[a] = "", - _a -)); // Should return string -extractIndexer((_b = {}, - _b[0 /* x */] = "", - _b -)); // Should return string -extractIndexer((_c = {}, - _c["" || 0] = "", - _c -)); // Should return any (widened form of undefined) +extractIndexer((_a = {}, _a[a] = "", _a)); // Should return string +extractIndexer((_b = {}, _b[0 /* x */] = "", _b)); // Should return string +extractIndexer((_c = {}, _c["" || 0] = "", _c)); // Should return any (widened form of undefined) var _a, _b, _c; diff --git a/tests/baselines/reference/computedPropertyNames49_ES5.js b/tests/baselines/reference/computedPropertyNames49_ES5.js index 3427ea665a0..418bd070457 100644 --- a/tests/baselines/reference/computedPropertyNames49_ES5.js +++ b/tests/baselines/reference/computedPropertyNames49_ES5.js @@ -27,41 +27,17 @@ var x = { //// [computedPropertyNames49_ES5.js] var x = (_a = { - p1: 10 - }, - Object.defineProperty(_a, 1 + 1, { - get: function () { - throw 10; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, 1 + 1, { - get: function () { - return 10; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, 1 + 1, { - set: function () { - // just throw - throw 10; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, "foo", { - get: function () { - if (1 == 1) { - return 10; - } - }, - enumerable: true, - configurable: true - }), - , - _a.p2 = 20, - _a -); + p1: 10 +}, _a.p1 = 10, _a[1 + 1] = Object.defineProperty({ get: function () { + throw 10; +}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { + return 10; +}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ set: function () { + // just throw + throw 10; +}, enumerable: true, configurable: true }), _a.foo = Object.defineProperty({ get: function () { + if (1 == 1) { + return 10; + } +}, enumerable: true, configurable: true }), _a.p2 = 20, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.js b/tests/baselines/reference/computedPropertyNames4_ES5.js index f91476c79c1..60cdefc36ee 100644 --- a/tests/baselines/reference/computedPropertyNames4_ES5.js +++ b/tests/baselines/reference/computedPropertyNames4_ES5.js @@ -20,18 +20,5 @@ var v = { var s; var n; var a; -var v = (_a = {}, - _a[s] = 0, - _a[n] = n, - _a[s + s] = 1, - _a[s + n] = 2, - _a[+s] = s, - _a[""] = 0, - _a[0] = 0, - _a[a] = 1, - _a[true] = 0, - _a["hello bye"] = 0, - _a["hello " + a + " bye"] = 0, - _a -); +var v = (_a = {}, _a[s] = 0, _a[n] = n, _a[s + s] = 1, _a[s + n] = 2, _a[+s] = s, _a[""] = 0, _a[0] = 0, _a[a] = 1, _a[true] = 0, _a["hello bye"] = 0, _a["hello " + a + " bye"] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames50_ES5.js b/tests/baselines/reference/computedPropertyNames50_ES5.js index a74561295be..90c2d2668d7 100644 --- a/tests/baselines/reference/computedPropertyNames50_ES5.js +++ b/tests/baselines/reference/computedPropertyNames50_ES5.js @@ -27,37 +27,22 @@ var x = { //// [computedPropertyNames50_ES5.js] var x = (_a = { - p1: 10, - get foo() { - if (1 == 1) { - return 10; - } - } - }, - Object.defineProperty(_a, 1 + 1, { - get: function () { - throw 10; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, 1 + 1, { - set: function () { - // just throw - throw 10; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, 1 + 1, { - get: function () { + p1: 10, + get foo() { + if (1 == 1) { return 10; - }, - enumerable: true, - configurable: true - }), - , - _a.p2 = 20, - _a -); + } + } +}, _a.p1 = 10, _a.foo = Object.defineProperty({ get: function () { + if (1 == 1) { + return 10; + } +}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { + throw 10; +}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ set: function () { + // just throw + throw 10; +}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { + return 10; +}, enumerable: true, configurable: true }), _a.p2 = 20, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames5_ES5.js b/tests/baselines/reference/computedPropertyNames5_ES5.js index 58c5af2efa3..adf9b86aa1b 100644 --- a/tests/baselines/reference/computedPropertyNames5_ES5.js +++ b/tests/baselines/reference/computedPropertyNames5_ES5.js @@ -11,13 +11,5 @@ var v = { //// [computedPropertyNames5_ES5.js] var b; -var v = (_a = {}, - _a[b] = 0, - _a[true] = 1, - _a[[]] = 0, - _a[{}] = 0, - _a[undefined] = undefined, - _a[null] = null, - _a -); +var v = (_a = {}, _a[b] = 0, _a[true] = 1, _a[[]] = 0, _a[{}] = 0, _a[undefined] = undefined, _a[null] = null, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames6_ES5.js b/tests/baselines/reference/computedPropertyNames6_ES5.js index 7e9c6202940..b42b2091c22 100644 --- a/tests/baselines/reference/computedPropertyNames6_ES5.js +++ b/tests/baselines/reference/computedPropertyNames6_ES5.js @@ -12,10 +12,5 @@ var v = { var p1; var p2; var p3; -var v = (_a = {}, - _a[p1] = 0, - _a[p2] = 1, - _a[p3] = 2, - _a -); +var v = (_a = {}, _a[p1] = 0, _a[p2] = 1, _a[p3] = 2, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames7_ES5.js b/tests/baselines/reference/computedPropertyNames7_ES5.js index 886cd8d85eb..9d9ac41ace1 100644 --- a/tests/baselines/reference/computedPropertyNames7_ES5.js +++ b/tests/baselines/reference/computedPropertyNames7_ES5.js @@ -11,8 +11,5 @@ var E; (function (E) { E[E["member"] = 0] = "member"; })(E || (E = {})); -var v = (_a = {}, - _a[0 /* member */] = 0, - _a -); +var v = (_a = {}, _a[0 /* member */] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames8_ES5.js b/tests/baselines/reference/computedPropertyNames8_ES5.js index 6eceee81adb..0c5b5047d85 100644 --- a/tests/baselines/reference/computedPropertyNames8_ES5.js +++ b/tests/baselines/reference/computedPropertyNames8_ES5.js @@ -12,10 +12,6 @@ function f() { function f() { var t; var u; - var v = (_a = {}, - _a[t] = 0, - _a[u] = 1, - _a - ); + var v = (_a = {}, _a[t] = 0, _a[u] = 1, _a); var _a; } diff --git a/tests/baselines/reference/computedPropertyNames9_ES5.js b/tests/baselines/reference/computedPropertyNames9_ES5.js index 6c1d7bcb4d0..f52a7d51f25 100644 --- a/tests/baselines/reference/computedPropertyNames9_ES5.js +++ b/tests/baselines/reference/computedPropertyNames9_ES5.js @@ -12,10 +12,5 @@ var v = { //// [computedPropertyNames9_ES5.js] function f(x) { } -var v = (_a = {}, - _a[f("")] = 0, - _a[f(0)] = 0, - _a[f(true)] = 0, - _a -); +var v = (_a = {}, _a[f("")] = 0, _a[f(0)] = 0, _a[f(true)] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js index 1f7a3ae123e..416e4746bee 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js @@ -9,9 +9,5 @@ var o: I = { } //// [computedPropertyNamesContextualType10_ES5.js] -var o = (_a = {}, - _a[+"foo"] = "", - _a[+"bar"] = 0, - _a -); +var o = (_a = {}, _a[+"foo"] = "", _a[+"bar"] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js index 844e498bdf6..f7d95e560d2 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js @@ -10,11 +10,7 @@ var o: I = { } //// [computedPropertyNamesContextualType1_ES5.js] -var o = (_a = {}, - _a["" + 0] = function (y) { - return y.length; - }, - _a["" + 1] = function (y) { return y.length; }, - _a -); +var o = function (y) { + return y.length; +}(_a = {}, _a["" + 0] = , _a["" + 1] = function (y) { return y.length; }, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js index b047b4ad1ba..7ff1a5f9768 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js @@ -10,11 +10,7 @@ var o: I = { } //// [computedPropertyNamesContextualType2_ES5.js] -var o = (_a = {}, - _a[+"foo"] = function (y) { - return y.length; - }, - _a[+"bar"] = function (y) { return y.length; }, - _a -); +var o = function (y) { + return y.length; +}(_a = {}, _a[+"foo"] = , _a[+"bar"] = function (y) { return y.length; }, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js index 7083d7d52e7..8aef840065b 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js @@ -9,11 +9,7 @@ var o: I = { } //// [computedPropertyNamesContextualType3_ES5.js] -var o = (_a = {}, - _a[+"foo"] = function (y) { - return y.length; - }, - _a[+"bar"] = function (y) { return y.length; }, - _a -); +var o = function (y) { + return y.length; +}(_a = {}, _a[+"foo"] = , _a[+"bar"] = function (y) { return y.length; }, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js index b17f91be38b..11d43546b89 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js @@ -10,9 +10,5 @@ var o: I = { } //// [computedPropertyNamesContextualType4_ES5.js] -var o = (_a = {}, - _a["" + "foo"] = "", - _a["" + "bar"] = 0, - _a -); +var o = (_a = {}, _a["" + "foo"] = "", _a["" + "bar"] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js index c7a728e5ef8..313bb87e402 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js @@ -10,9 +10,5 @@ var o: I = { } //// [computedPropertyNamesContextualType5_ES5.js] -var o = (_a = {}, - _a[+"foo"] = "", - _a[+"bar"] = 0, - _a -); +var o = (_a = {}, _a[+"foo"] = "", _a[+"bar"] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js index c97b7c5b1f8..5500ac0863b 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js @@ -15,12 +15,7 @@ foo({ //// [computedPropertyNamesContextualType6_ES5.js] foo((_a = { - p: "", - 0: function () { } - }, - _a["hi" + "bye"] = true, - _a[0 + 1] = 0, - _a[+"hi"] = [0], - _a -)); + p: "", + 0: function () { } +}, _a.p = "", _a[0] = function () { }, _a["hi" + "bye"] = true, _a[0 + 1] = 0, _a[+"hi"] = [0], _a)); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js index 9ca7e826aa7..f87c5151ab3 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js @@ -15,12 +15,7 @@ foo({ //// [computedPropertyNamesContextualType7_ES5.js] foo((_a = { - p: "", - 0: function () { } - }, - _a["hi" + "bye"] = true, - _a[0 + 1] = 0, - _a[+"hi"] = [0], - _a -)); + p: "", + 0: function () { } +}, _a.p = "", _a[0] = function () { }, _a["hi" + "bye"] = true, _a[0 + 1] = 0, _a[+"hi"] = [0], _a)); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js index 419ea906550..ed6bc81cebb 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js @@ -10,9 +10,5 @@ var o: I = { } //// [computedPropertyNamesContextualType8_ES5.js] -var o = (_a = {}, - _a["" + "foo"] = "", - _a["" + "bar"] = 0, - _a -); +var o = (_a = {}, _a["" + "foo"] = "", _a["" + "bar"] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js index d3beb8b8deb..7194742f1d2 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js @@ -10,9 +10,5 @@ var o: I = { } //// [computedPropertyNamesContextualType9_ES5.js] -var o = (_a = {}, - _a[+"foo"] = "", - _a[+"bar"] = 0, - _a -); +var o = (_a = {}, _a[+"foo"] = "", _a[+"bar"] = 0, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js index d31e4d94070..ddf9786ba16 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js @@ -7,23 +7,9 @@ var v = { } //// [computedPropertyNamesDeclarationEmit5_ES5.js] -var v = (_a = {}, - _a["" + ""] = 0, - _a["" + ""] = function () { }, - Object.defineProperty(_a, "" + "", { - get: function () { - return 0; - }, - enumerable: true, - configurable: true - }), - Object.defineProperty(_a, "" + "", { - set: function (x) { }, - enumerable: true, - configurable: true - }), - _a -); +var v = function () { }(_a = {}, _a["" + ""] = 0, _a["" + ""] = , _a["" + ""] = Object.defineProperty({ get: function () { + return 0; +}, enumerable: true, configurable: true }), _a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }), _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js index 39e393c46cc..9c45a3f7862 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js @@ -6,11 +6,8 @@ var v = { } //// [computedPropertyNamesSourceMap2_ES5.js] -var v = (_a = {}, - _a["hello"] = function () { - debugger; - }, - _a -); +var v = function () { + debugger; +}(_a = {}, _a["hello"] = , _a); var _a; //# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map index 2d9d4ea3088..c07389c568f 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map @@ -1,2 +1,2 @@ //// [computedPropertyNamesSourceMap2_ES5.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG,CAAR,EAAA;IACI,AADJ,EAAA,CACK,OAAO,CAAC;QACLA,QAAQA,CAACA;IACbA,CAACA;IAHL,EAAA;CAIC,CAAA;IAJD,EAAA"} \ No newline at end of file +{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IAEAA,QAAQA,CAACA;AACbA,CAACA,AAJA,CACA,EAAA,GADA,EAAA,EACA,EAAA,CACK,OAAO,CAFA,GAAA,EACA,EAAA,AADA,CAKA,CAAA;IAJD,EAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt index 4c49c91499b..cf074242624 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt @@ -8,100 +8,138 @@ sources: computedPropertyNamesSourceMap2_ES5.ts emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.js sourceFile:computedPropertyNamesSourceMap2_ES5.ts ------------------------------------------------------------------- ->>>var v = (_a = {}, +>>>var v = function () { 1 > 2 >^^^^ 3 > ^ 4 > ^^^ -5 > ^ -6 > ^^ -7 > ^^^^^^^^^^^^^^^^^^^^^-> +5 > ^^^^^^-> 1 > 2 >var 3 > v 4 > = -5 > -6 > 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) 3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) 4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) -5 >Emitted(1, 10) Source(1, 1) + SourceIndex(0) -6 >Emitted(1, 12) Source(1, 1) + SourceIndex(0) --- ->>> _a["hello"] = function () { +>>> debugger; 1->^^^^ -2 > -3 > ^^ -4 > ^ -5 > ^^^^^^^ -6 > ^ -7 > ^^^-> -1->var v = { - > -2 > -3 > -4 > var v = { - > [ -5 > "hello" -6 > ] -1->Emitted(2, 5) Source(2, 5) + SourceIndex(0) -2 >Emitted(2, 5) Source(1, 1) + SourceIndex(0) -3 >Emitted(2, 7) Source(1, 1) + SourceIndex(0) -4 >Emitted(2, 8) Source(2, 6) + SourceIndex(0) -5 >Emitted(2, 15) Source(2, 13) + SourceIndex(0) -6 >Emitted(2, 16) Source(2, 14) + SourceIndex(0) ---- ->>> debugger; -1->^^^^^^^^ -2 > ^^^^^^^^ -3 > ^ -1->() { - > -2 > debugger -3 > ; -1->Emitted(3, 9) Source(3, 9) + SourceIndex(0) name (["hello"]) -2 >Emitted(3, 17) Source(3, 17) + SourceIndex(0) name (["hello"]) -3 >Emitted(3, 18) Source(3, 18) + SourceIndex(0) name (["hello"]) ---- ->>> }, -1 >^^^^ -2 > ^ -3 > ^^-> -1 > - > -2 > } -1 >Emitted(4, 5) Source(4, 5) + SourceIndex(0) name (["hello"]) -2 >Emitted(4, 6) Source(4, 6) + SourceIndex(0) name (["hello"]) ---- ->>> _a -1->^^^^ -2 > ^^ -1-> -2 > -1->Emitted(5, 5) Source(1, 1) + SourceIndex(0) -2 >Emitted(5, 7) Source(1, 1) + SourceIndex(0) ---- ->>>); -1 >^ -2 > ^ -3 > ^^^^^^-> -1 >var v = { +2 > ^^^^^^^^ +3 > ^ +4 > ^^^^^^^^^^^^^^^^^^^-> +1->{ > ["hello"]() { - > debugger; - > } - >} -2 > -1 >Emitted(6, 2) Source(5, 2) + SourceIndex(0) -2 >Emitted(6, 3) Source(5, 2) + SourceIndex(0) + > +2 > debugger +3 > ; +1->Emitted(2, 5) Source(3, 9) + SourceIndex(0) name (["hello"]) +2 >Emitted(2, 13) Source(3, 17) + SourceIndex(0) name (["hello"]) +3 >Emitted(2, 14) Source(3, 18) + SourceIndex(0) name (["hello"]) +--- +>>>}(_a = {}, _a["hello"] = , _a); +1-> +2 >^ +3 > +4 > ^ +5 > ^^ +6 > ^^^ +7 > ^^ +8 > ^^ +9 > ^^ +10> ^ +11> ^^^^^^^ +12> ^ +13> ^^^ +14> ^^ +15> ^^ +16> +17> ^ +18> ^ +1-> + > +2 >} +3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 6) + SourceIndex(0) name (["hello"]) Span encoded by the emitter:Emitted(3, 2) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +3 > +4 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 6) + SourceIndex(0) name (["hello"]) Span encoded by the emitter:Emitted(3, 3) Source(1, 1) + SourceIndex(0) nameIndex (-1) +4 > +5 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 3) Source(1, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) +5 > +6 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 5) Source(1, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 8) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +6 > +7 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +7 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 8) Source(0, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 10) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +7 > +8 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +8 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 8) Source(0, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 12) Source(1, 1) + SourceIndex(0) nameIndex (-1) +8 > +9 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +9 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 10) Source(0, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 14) Source(1, 1) + SourceIndex(0) nameIndex (-1) +9 > +10> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +10> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 10) Source(0, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 15) Source(2, 6) + SourceIndex(0) nameIndex (-1) +10> var v = { + > [ +11> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +11> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 12) Source(1, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 22) Source(2, 13) + SourceIndex(0) nameIndex (-1) +11> "hello" +12> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +12> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 14) Source(1, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 23) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +12> +13> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +13> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 15) Source(2, 11) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 26) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +13> +14> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +14> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 22) Source(2, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 28) Source(1, 1) + SourceIndex(0) nameIndex (-1) +14> +15> !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +15> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 23) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 30) Source(1, 1) + SourceIndex(0) nameIndex (-1) +15> +16> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +16> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 23) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 30) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +16> +17> !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +17> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 26) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 31) Source(5, 2) + SourceIndex(0) nameIndex (-1) +17> +18> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +18> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 26) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 32) Source(5, 2) + SourceIndex(0) nameIndex (-1) +18> +1->Emitted(3, 1) Source(4, 5) + SourceIndex(0) name (["hello"]) +2 >Emitted(3, 2) Source(4, 6) + SourceIndex(0) name (["hello"]) +3 >Emitted(3, 2) Source(0, NaN) + SourceIndex(0) +4 >Emitted(3, 3) Source(1, 1) + SourceIndex(0) +5 >Emitted(3, 5) Source(1, 1) + SourceIndex(0) +6 >Emitted(3, 8) Source(0, NaN) + SourceIndex(0) +7 >Emitted(3, 10) Source(0, NaN) + SourceIndex(0) +8 >Emitted(3, 12) Source(1, 1) + SourceIndex(0) +9 >Emitted(3, 14) Source(1, 1) + SourceIndex(0) +10>Emitted(3, 15) Source(2, 6) + SourceIndex(0) +11>Emitted(3, 22) Source(2, 13) + SourceIndex(0) +12>Emitted(3, 23) Source(0, NaN) + SourceIndex(0) +13>Emitted(3, 26) Source(0, NaN) + SourceIndex(0) +14>Emitted(3, 28) Source(1, 1) + SourceIndex(0) +15>Emitted(3, 30) Source(1, 1) + SourceIndex(0) +16>Emitted(3, 30) Source(0, NaN) + SourceIndex(0) +17>Emitted(3, 31) Source(5, 2) + SourceIndex(0) +18>Emitted(3, 32) Source(5, 2) + SourceIndex(0) --- >>>var _a; -1->^^^^ +1 >^^^^ 2 > ^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1-> +1 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 28) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) +1 > +2 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 30) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1) 2 > -1->Emitted(7, 5) Source(1, 1) + SourceIndex(0) -2 >Emitted(7, 7) Source(1, 1) + SourceIndex(0) +1 >Emitted(4, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(4, 7) Source(1, 1) + SourceIndex(0) --- +!!!! **** There are more source map entries in the sourceMap's mapping than what was encoded +!!!! **** Remaining decoded string: ,AADA,CAKA,CAAA;IAJD,EAAA >>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.js b/tests/baselines/reference/parserES5ComputedPropertyName3.js index 1fdb5ced65d..b6fcff6630c 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName3.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName3.js @@ -2,5 +2,5 @@ var v = { [e]() { } }; //// [parserES5ComputedPropertyName3.js] -var v = (_a = {}, _a[e] = function () { }, _a); +var v = function () { }(_a = {}, _a[e] = , _a); var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.js b/tests/baselines/reference/parserES5ComputedPropertyName4.js index 499e9a426d9..3271fa41207 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName4.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.js @@ -2,9 +2,5 @@ var v = { get [e]() { } }; //// [parserES5ComputedPropertyName4.js] -var v = (_a = {}, Object.defineProperty(_a, e, { - get: function () { }, - enumerable: true, - configurable: true -}), _a); +var v = (_a = {}, _a[e] = Object.defineProperty({ get: function () { }, enumerable: true, configurable: true }), _a); var _a; diff --git a/tests/baselines/reference/privateIndexer2.js b/tests/baselines/reference/privateIndexer2.js index 1268c6e4c25..f8e07d8aeb4 100644 --- a/tests/baselines/reference/privateIndexer2.js +++ b/tests/baselines/reference/privateIndexer2.js @@ -11,10 +11,6 @@ var y: { //// [privateIndexer2.js] // private indexers not allowed -var x = (_a = {}, - _a[x] = string, - _a.string = , - _a -); +var x = (_a = {}, _a[x] = string, _a.string = , _a); var y; var _a; From 78425d6e0f0cbc04a94b9500ff14bb9895e50fc3 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 20 Feb 2015 14:17:26 -0800 Subject: [PATCH 148/162] Removed unused text-concatenating emit. --- src/compiler/emitter.ts | 120 ---------------------------------------- 1 file changed, 120 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 89c39cdc36b..b10c8acb7ef 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2711,126 +2711,6 @@ module ts { return result; } - function emitDownlevelObjectLiteralWithComputedProperties2(node: ObjectLiteralExpression, firstComputedPropertyIndex: number) { - var multiLine = (node.flags & NodeFlags.MultiLine) !== 0; - var properties = node.properties; - - write("("); - - if (multiLine) { - increaseIndent(); - } - - // For computed properties, we need to create a unique handle to the object - // literal so we can modify it without risking internal assignments tainting the object. - var tempVar = createAndRecordTempVariable(node); - - // Write out the first non-computed properties - // (or all properties if none of them are computed), - // then emit the rest through indexing on the temp variable. - emit(tempVar) - write(" = "); - emitObjectLiteralBody(node, firstComputedPropertyIndex); - - - for (var i = firstComputedPropertyIndex, n = properties.length; i < n; i++) { - writeComma(); - - var property = properties[i]; - - emitStart(property) - if (property.kind === SyntaxKind.GetAccessor || property.kind === SyntaxKind.SetAccessor) { - // TODO (drosen): Reconcile with 'emitMemberFunctions'. - var accessors = getAllAccessorDeclarations(node.properties, property); - if (property !== accessors.firstAccessor) { - continue; - } - write("Object.defineProperty("); - emit(tempVar); - write(", "); - emitStart(node.name); - emitExpressionForPropertyName(property.name); - emitEnd(property.name); - write(", {"); - increaseIndent(); - if (accessors.getAccessor) { - writeLine() - emitLeadingComments(accessors.getAccessor); - write("get: "); - emitStart(accessors.getAccessor); - write("function "); - emitSignatureAndBody(accessors.getAccessor); - emitEnd(accessors.getAccessor); - emitTrailingComments(accessors.getAccessor); - write(","); - } - if (accessors.setAccessor) { - writeLine(); - emitLeadingComments(accessors.setAccessor); - write("set: "); - emitStart(accessors.setAccessor); - write("function "); - emitSignatureAndBody(accessors.setAccessor); - emitEnd(accessors.setAccessor); - emitTrailingComments(accessors.setAccessor); - write(","); - } - writeLine(); - write("enumerable: true,"); - writeLine(); - write("configurable: true"); - decreaseIndent(); - writeLine(); - write("})"); - emitEnd(property); - } - else { - emitLeadingComments(property); - emitStart(property.name); - emit(tempVar); - emitMemberAccessForPropertyName(property.name); - emitEnd(property.name); - - write(" = "); - - if (property.kind === SyntaxKind.PropertyAssignment) { - emit((property).initializer); - } - else if (property.kind === SyntaxKind.ShorthandPropertyAssignment) { - emitExpressionIdentifier((property).name); - } - else if (property.kind === SyntaxKind.MethodDeclaration) { - emitFunctionDeclaration(property); - } - else { - Debug.fail("ObjectLiteralElement type not accounted for: " + property.kind); - } - } - - emitEnd(property); - } - - writeComma(); - emit(tempVar); - - if (multiLine) { - decreaseIndent(); - writeLine(); - } - - write(")"); - - function writeComma() { - if (multiLine) { - write(","); - writeLine(); - } - else { - write(", "); - } - } - } - function emitObjectLiteral(node: ObjectLiteralExpression): void { var properties = node.properties; From 4b271d2d2301225d318991a0153b2d842aeb2d91 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 20 Feb 2015 16:28:33 -0800 Subject: [PATCH 149/162] Address code review feedback. --- Jakefile | 1 + src/services/navigateTo.ts | 105 ++++++++++++++++++ src/services/services.ts | 211 ++++++++++--------------------------- 3 files changed, 164 insertions(+), 153 deletions(-) create mode 100644 src/services/navigateTo.ts diff --git a/Jakefile b/Jakefile index 7b17a83a579..acbc29b808e 100644 --- a/Jakefile +++ b/Jakefile @@ -65,6 +65,7 @@ var servicesSources = [ return path.join(compilerDirectory, f); }).concat([ "breakpoints.ts", + "navigateTo.ts", "navigationBar.ts", "outliningElementsCollector.ts", "services.ts", diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts new file mode 100644 index 00000000000..059259eec9d --- /dev/null +++ b/src/services/navigateTo.ts @@ -0,0 +1,105 @@ +module ts.NavigateTo { + type RawNavigateToItem = { name: string; fileName: string; matchKind: MatchKind; declaration: Declaration }; + + enum MatchKind { + none = 0, + exact = 1, + substring = 2, + prefix = 3 + } + + export function getNavigateToItems(program: Program, cancellationToken: CancellationTokenObject, searchValue: string, maxResultCount: number): NavigateToItem[]{ + // Split search value in terms array + var terms = searchValue.split(" "); + + // default NavigateTo approach: if search term contains only lower-case chars - use case-insensitive search, otherwise switch to case-sensitive version + var searchTerms = map(terms, t => ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t })); + + var rawItems: RawNavigateToItem[] = []; + + // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] + forEach(program.getSourceFiles(), sourceFile => { + cancellationToken.throwIfCancellationRequested(); + + var fileName = sourceFile.fileName; + var declarations = sourceFile.getNamedDeclarations(); + for (var i = 0, n = declarations.length; i < n; i++) { + var declaration = declarations[i]; + // TODO(jfreeman): Skip this declaration if it has a computed name + var name = (declaration.name).text; + var matchKind = getMatchKind(searchTerms, name); + if (matchKind !== MatchKind.none) { + rawItems.push({ name, fileName, matchKind, declaration }); + } + } + }); + + rawItems.sort((i1, i2) => i1.matchKind - i2.matchKind); + if (maxResultCount !== undefined) { + rawItems = rawItems.slice(0, maxResultCount); + } + + var items = map(rawItems, createNavigateToItem); + + return items; + + function createNavigateToItem(rawItem: RawNavigateToItem): NavigateToItem { + var declaration = rawItem.declaration; + var container = getContainerNode(declaration); + return { + name: rawItem.name, + kind: getNodeKind(declaration), + kindModifiers: getNodeModifiers(declaration), + matchKind: MatchKind[rawItem.matchKind], + fileName: rawItem.fileName, + textSpan: createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), + // TODO(jfreeman): What should be the containerName when the container has a computed name? + containerName: container && container.name ? (container.name).text : "", + containerKind: container && container.name ? getNodeKind(container) : "" + }; + } + + function hasAnyUpperCaseCharacter(s: string): boolean { + for (var i = 0, n = s.length; i < n; i++) { + var c = s.charCodeAt(i); + if ((CharacterCodes.A <= c && c <= CharacterCodes.Z) || + (c >= CharacterCodes.maxAsciiCharacter && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) { + return true; + } + } + + return false; + } + + function getMatchKind(searchTerms: { caseSensitive: boolean; term: string }[], name: string): MatchKind { + var matchKind = MatchKind.none; + + if (name) { + for (var j = 0, n = searchTerms.length; j < n; j++) { + var searchTerm = searchTerms[j]; + var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase(); + // in case of case-insensitive search searchTerm.term will already be lower-cased + var index = nameToSearch.indexOf(searchTerm.term); + if (index < 0) { + // Didn't match. + return MatchKind.none; + } + + var termKind = MatchKind.substring; + if (index === 0) { + // here we know that match occur at the beginning of the string. + // if search term and declName has the same length - we have an exact match, otherwise declName have longer length and this will be prefix match + termKind = name.length === searchTerm.term.length ? MatchKind.exact : MatchKind.prefix; + } + + // Update our match kind if we don't have one, or if this match is better. + if (matchKind === MatchKind.none || termKind < matchKind) { + matchKind = termKind; + } + } + } + + return matchKind; + } + } +} \ No newline at end of file diff --git a/src/services/services.ts b/src/services/services.ts index 76c2bd80984..7c77b8c5cd0 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2,6 +2,7 @@ /// /// +/// /// /// /// @@ -1378,13 +1379,6 @@ module ts { public static typeAlias = "type alias name"; } - enum MatchKind { - none = 0, - exact = 1, - prefix = 2, - substring = 3, - } - /// Language Service interface CompletionSession { @@ -1992,6 +1986,62 @@ module ts { }); } + /* @internal */ export function getContainerNode(node: Node): Node { + while (true) { + node = node.parent; + if (!node) { + return undefined; + } + switch (node.kind) { + case SyntaxKind.SourceFile: + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.ClassDeclaration: + case SyntaxKind.InterfaceDeclaration: + case SyntaxKind.EnumDeclaration: + case SyntaxKind.ModuleDeclaration: + return node; + } + } + } + + /* @internal */ export function getNodeKind(node: Node): string { + switch (node.kind) { + case SyntaxKind.ModuleDeclaration: return ScriptElementKind.moduleElement; + case SyntaxKind.ClassDeclaration: return ScriptElementKind.classElement; + case SyntaxKind.InterfaceDeclaration: return ScriptElementKind.interfaceElement; + case SyntaxKind.TypeAliasDeclaration: return ScriptElementKind.typeElement; + case SyntaxKind.EnumDeclaration: return ScriptElementKind.enumElement; + case SyntaxKind.VariableDeclaration: + return isConst(node) + ? ScriptElementKind.constElement + : isLet(node) + ? ScriptElementKind.letElement + : ScriptElementKind.variableElement; + case SyntaxKind.FunctionDeclaration: return ScriptElementKind.functionElement; + case SyntaxKind.GetAccessor: return ScriptElementKind.memberGetAccessorElement; + case SyntaxKind.SetAccessor: return ScriptElementKind.memberSetAccessorElement; + case SyntaxKind.MethodDeclaration: + case SyntaxKind.MethodSignature: + return ScriptElementKind.memberFunctionElement; + case SyntaxKind.PropertyDeclaration: + case SyntaxKind.PropertySignature: + return ScriptElementKind.memberVariableElement; + case SyntaxKind.IndexSignature: return ScriptElementKind.indexSignatureElement; + case SyntaxKind.ConstructSignature: return ScriptElementKind.constructSignatureElement; + case SyntaxKind.CallSignature: return ScriptElementKind.callSignatureElement; + case SyntaxKind.Constructor: return ScriptElementKind.constructorImplementationElement; + case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement; + case SyntaxKind.EnumMember: return ScriptElementKind.variableElement; + case SyntaxKind.Parameter: return (node.flags & NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; + } + return ScriptElementKind.unknown; + } + export function createLanguageService(host: LanguageServiceHost, documentRegistry: DocumentRegistry = createDocumentRegistry()): LanguageService { var syntaxTreeCache: SyntaxTreeCache = new SyntaxTreeCache(host); var ruleProvider: formatting.RulesProvider; @@ -2722,29 +2772,6 @@ module ts { } } - function getContainerNode(node: Node): Node { - while (true) { - node = node.parent; - if (!node) { - return undefined; - } - switch (node.kind) { - case SyntaxKind.SourceFile: - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: - case SyntaxKind.FunctionDeclaration: - case SyntaxKind.FunctionExpression: - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.ClassDeclaration: - case SyntaxKind.InterfaceDeclaration: - case SyntaxKind.EnumDeclaration: - case SyntaxKind.ModuleDeclaration: - return node; - } - } - } - // TODO(drosen): use contextual SemanticMeaning. function getSymbolKind(symbol: Symbol, typeResolver: TypeChecker, location: Node): string { var flags = symbol.getFlags(); @@ -2831,39 +2858,6 @@ module ts { return ScriptElementKind.unknown; } - function getNodeKind(node: Node): string { - switch (node.kind) { - case SyntaxKind.ModuleDeclaration: return ScriptElementKind.moduleElement; - case SyntaxKind.ClassDeclaration: return ScriptElementKind.classElement; - case SyntaxKind.InterfaceDeclaration: return ScriptElementKind.interfaceElement; - case SyntaxKind.TypeAliasDeclaration: return ScriptElementKind.typeElement; - case SyntaxKind.EnumDeclaration: return ScriptElementKind.enumElement; - case SyntaxKind.VariableDeclaration: - return isConst(node) - ? ScriptElementKind.constElement - : isLet(node) - ? ScriptElementKind.letElement - : ScriptElementKind.variableElement; - case SyntaxKind.FunctionDeclaration: return ScriptElementKind.functionElement; - case SyntaxKind.GetAccessor: return ScriptElementKind.memberGetAccessorElement; - case SyntaxKind.SetAccessor: return ScriptElementKind.memberSetAccessorElement; - case SyntaxKind.MethodDeclaration: - case SyntaxKind.MethodSignature: - return ScriptElementKind.memberFunctionElement; - case SyntaxKind.PropertyDeclaration: - case SyntaxKind.PropertySignature: - return ScriptElementKind.memberVariableElement; - case SyntaxKind.IndexSignature: return ScriptElementKind.indexSignatureElement; - case SyntaxKind.ConstructSignature: return ScriptElementKind.constructSignatureElement; - case SyntaxKind.CallSignature: return ScriptElementKind.callSignatureElement; - case SyntaxKind.Constructor: return ScriptElementKind.constructorImplementationElement; - case SyntaxKind.TypeParameter: return ScriptElementKind.typeParameterElement; - case SyntaxKind.EnumMember: return ScriptElementKind.variableElement; - case SyntaxKind.Parameter: return (node.flags & NodeFlags.AccessibilityModifier) ? ScriptElementKind.memberVariableElement : ScriptElementKind.parameterElement; - } - return ScriptElementKind.unknown; - } - function getSymbolModifiers(symbol: Symbol): string { return symbol && symbol.declarations && symbol.declarations.length > 0 ? getNodeModifiers(symbol.declarations[0]) @@ -4666,96 +4660,7 @@ module ts { function getNavigateToItems(searchValue: string, maxResultCount?: number): NavigateToItem[] { synchronizeHostData(); - // Split search value in terms array - var terms = searchValue.split(" "); - - // default NavigateTo approach: if search term contains only lower-case chars - use case-insensitive search, otherwise switch to case-sensitive version - var searchTerms = map(terms, t => ({ caseSensitive: hasAnyUpperCaseCharacter(t), term: t })); - - var rawItems: { name: string; fileName: string; matchKind: MatchKind; declaration: Declaration }[] = []; - - // Search the declarations in all files and output matched NavigateToItem into array of NavigateToItem[] - forEach(program.getSourceFiles(), sourceFile => { - cancellationToken.throwIfCancellationRequested(); - - var fileName = sourceFile.fileName; - var declarations = sourceFile.getNamedDeclarations(); - for (var i = 0, n = declarations.length; i < n; i++) { - var declaration = declarations[i]; - // TODO(jfreeman): Skip this declaration if it has a computed name - var name = (declaration.name).text; - var matchKind = getMatchKind(searchTerms, name); - if (matchKind !== MatchKind.none) { - rawItems.push({ name, fileName, matchKind, declaration }); - } - } - }); - - rawItems.sort((i1, i2) => i1.matchKind - i2.matchKind); - if (maxResultCount !== undefined) { - rawItems = rawItems.slice(0, maxResultCount); - } - - var items = map(rawItems, i => { - var declaration = i.declaration; - var container = getContainerNode(declaration); - return { - name: i.name, - kind: getNodeKind(declaration), - kindModifiers: getNodeModifiers(declaration), - matchKind: MatchKind[i.matchKind], - fileName: i.fileName, - textSpan: createTextSpanFromBounds(declaration.getStart(), declaration.getEnd()), - // TODO(jfreeman): What should be the containerName when the container has a computed name? - containerName: container && container.name ? (container.name).text : "", - containerKind: container && container.name ? getNodeKind(container) : "" - }; - }); - - return items; - - function hasAnyUpperCaseCharacter(s: string): boolean { - for (var i = 0, n = s.length; i < n; i++) { - var c = s.charCodeAt(i); - if ((CharacterCodes.A <= c && c <= CharacterCodes.Z) || - (c >= CharacterCodes.maxAsciiCharacter && s.charAt(i).toLocaleLowerCase() !== s.charAt(i))) { - return true; - } - } - - return false; - } - - function getMatchKind(searchTerms: { caseSensitive: boolean; term: string }[], name: string): MatchKind { - var matchKind = MatchKind.none; - - if (name) { - for (var j = 0, n = searchTerms.length; j < n; j++) { - var searchTerm = searchTerms[j]; - var nameToSearch = searchTerm.caseSensitive ? name : name.toLocaleLowerCase(); - // in case of case-insensitive search searchTerm.term will already be lower-cased - var index = nameToSearch.indexOf(searchTerm.term); - if (index < 0) { - // Didn't match. - return MatchKind.none; - } - - var termKind = MatchKind.substring; - if (index === 0) { - // here we know that match occur at the beginning of the string. - // if search term and declName has the same length - we have an exact match, otherwise declName have longer length and this will be prefix match - termKind = name.length === searchTerm.term.length ? MatchKind.exact : MatchKind.prefix; - } - - // Update our match kind if we don't have one, or if this match is better. - if (matchKind === MatchKind.none || termKind < matchKind) { - matchKind = termKind; - } - } - } - - return matchKind; - } + return ts.NavigateTo.getNavigateToItems(program, cancellationToken, searchValue, maxResultCount); } function containErrors(diagnostics: Diagnostic[]): boolean { From 93c6ac091660561e255631778ab4d4df78c32903 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 20 Feb 2015 16:54:07 -0800 Subject: [PATCH 150/162] This is why we need an IO type constructor. --- src/compiler/emitter.ts | 12 +- .../FunctionPropertyAssignments5_es6.js | 2 +- .../reference/computedPropertyNames10_ES5.js | 2 +- .../reference/computedPropertyNames22_ES5.js | 2 +- .../reference/computedPropertyNames25_ES5.js | 2 +- .../reference/computedPropertyNames28_ES5.js | 2 +- .../reference/computedPropertyNames29_ES5.js | 2 +- .../reference/computedPropertyNames30_ES5.js | 2 +- .../reference/computedPropertyNames31_ES5.js | 2 +- .../reference/computedPropertyNames33_ES5.js | 2 +- .../reference/computedPropertyNames34_ES5.js | 2 +- ...omputedPropertyNamesContextualType1_ES5.js | 4 +- ...omputedPropertyNamesContextualType2_ES5.js | 4 +- ...omputedPropertyNamesContextualType3_ES5.js | 4 +- ...mputedPropertyNamesDeclarationEmit5_ES5.js | 2 +- .../computedPropertyNamesSourceMap2_ES5.js | 4 +- ...computedPropertyNamesSourceMap2_ES5.js.map | 2 +- ...dPropertyNamesSourceMap2_ES5.sourcemap.txt | 210 +++++++++--------- .../parserES5ComputedPropertyName3.js | 2 +- 19 files changed, 138 insertions(+), 126 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index f1df624e8f7..971efb2ea5f 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2592,7 +2592,7 @@ module ts { rightHandSide = createPropertyAccessExpression(prefix, (property).name); } else if (property.kind === SyntaxKind.MethodDeclaration) { - emitFunctionDeclaration(property); + rightHandSide = createFunctionExpressionForFunctionLikeDeclaration((property)); } else if (property.kind === SyntaxKind.GetAccessor || property.kind === SyntaxKind.SetAccessor) { var accessors = getAllAccessorDeclarations(objectLiteral.properties, property); @@ -2606,11 +2606,11 @@ module ts { var descriptorProperties = >[]; if (accessors.getAccessor) { - var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpressionForAccessor(accessors.getAccessor)); + var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpressionForFunctionLikeDeclaration(accessors.getAccessor)); descriptorProperties.push(getProperty); } if (accessors.setAccessor) { - var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpressionForAccessor(accessors.setAccessor)); + var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpressionForFunctionLikeDeclaration(accessors.setAccessor)); descriptorProperties.push(setProperty); } @@ -2677,10 +2677,10 @@ module ts { return result; } - function createFunctionExpressionForAccessor(accessor: AccessorDeclaration): FunctionExpression { + function createFunctionExpressionForFunctionLikeDeclaration(func: FunctionLikeDeclaration): FunctionExpression { var result = createSynthesizedNode(SyntaxKind.FunctionExpression); - result.parameters = accessor.parameters; - result.body = accessor.body; + result.parameters = func.parameters; + result.body = func.body; return result; } diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js index 9cf09c0b96e..188a843f751 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js @@ -2,5 +2,5 @@ var v = { *[foo()]() { } } //// [FunctionPropertyAssignments5_es6.js] -var v = function () { }(_a = {}, _a[foo()] = , _a); +var v = (_a = {}, _a[foo()] = function () { }, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.js b/tests/baselines/reference/computedPropertyNames10_ES5.js index bebc2b3a537..e330db87075 100644 --- a/tests/baselines/reference/computedPropertyNames10_ES5.js +++ b/tests/baselines/reference/computedPropertyNames10_ES5.js @@ -20,5 +20,5 @@ var v = { var s; var n; var a; -var v = function () { }function () { }function () { }function () { }function () { }function () { }function () { }function () { }function () { }function () { }function () { }(_a = {}, _a[s] = , _a[n] = , _a[s + s] = , _a[s + n] = , _a[+s] = , _a[""] = , _a[0] = , _a[a] = , _a[true] = , _a["hello bye"] = , _a["hello " + a + " bye"] = , _a); +var v = (_a = {}, _a[s] = function () { }, _a[n] = function () { }, _a[s + s] = function () { }, _a[s + n] = function () { }, _a[+s] = function () { }, _a[""] = function () { }, _a[0] = function () { }, _a[a] = function () { }, _a[true] = function () { }, _a["hello bye"] = function () { }, _a["hello " + a + " bye"] = function () { }, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.js b/tests/baselines/reference/computedPropertyNames22_ES5.js index bcea64253ee..4dfd1286b06 100644 --- a/tests/baselines/reference/computedPropertyNames22_ES5.js +++ b/tests/baselines/reference/computedPropertyNames22_ES5.js @@ -13,7 +13,7 @@ var C = (function () { function C() { } C.prototype.bar = function () { - var obj = function () { }(_a = {}, _a[this.bar()] = , _a); + var obj = (_a = {}, _a[this.bar()] = function () { }, _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js index 4bc609ca727..97a43c7cacb 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.js +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -34,7 +34,7 @@ var C = (function (_super) { _super.apply(this, arguments); } C.prototype.foo = function () { - var obj = function () { }(_a = {}, _a[_super.prototype.bar.call(this)] = , _a); + var obj = (_a = {}, _a[_super.prototype.bar.call(this)] = function () { }, _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js index c918d2f693e..3d9a343fcdb 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES5.js +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -26,7 +26,7 @@ var C = (function (_super) { __extends(C, _super); function C() { _super.call(this); - var obj = function () { }(_a = {}, _a[(_super.call(this), "prop")] = , _a); + var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, _a); var _a; } return C; diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.js b/tests/baselines/reference/computedPropertyNames29_ES5.js index 475b5947b44..ea9a9b1b635 100644 --- a/tests/baselines/reference/computedPropertyNames29_ES5.js +++ b/tests/baselines/reference/computedPropertyNames29_ES5.js @@ -17,7 +17,7 @@ var C = (function () { C.prototype.bar = function () { var _this = this; (function () { - var obj = function () { }(_a = {}, _a[_this.bar()] = , _a); + var obj = (_a = {}, _a[_this.bar()] = function () { }, _a); var _a; }); return 0; diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js index bb1f2f1a4cd..06a63dd7565 100644 --- a/tests/baselines/reference/computedPropertyNames30_ES5.js +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -32,7 +32,7 @@ var C = (function (_super) { function C() { _super.call(this); (function () { - var obj = function () { }(_a = {}, _a[(_super.call(this), "prop")] = , _a); + var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, _a); var _a; }); } diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js index 1d2340acc0c..a6db55259d5 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.js +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -38,7 +38,7 @@ var C = (function (_super) { C.prototype.foo = function () { var _this = this; (function () { - var obj = function () { }(_a = {}, _a[_super.prototype.bar.call(_this)] = , _a); + var obj = (_a = {}, _a[_super.prototype.bar.call(_this)] = function () { }, _a); var _a; }); return 0; diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.js b/tests/baselines/reference/computedPropertyNames33_ES5.js index 606d286114a..92e6456f3ba 100644 --- a/tests/baselines/reference/computedPropertyNames33_ES5.js +++ b/tests/baselines/reference/computedPropertyNames33_ES5.js @@ -17,7 +17,7 @@ var C = (function () { function C() { } C.prototype.bar = function () { - var obj = function () { }(_a = {}, _a[foo()] = , _a); + var obj = (_a = {}, _a[foo()] = function () { }, _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames34_ES5.js b/tests/baselines/reference/computedPropertyNames34_ES5.js index b1bea64123f..da9789c0d70 100644 --- a/tests/baselines/reference/computedPropertyNames34_ES5.js +++ b/tests/baselines/reference/computedPropertyNames34_ES5.js @@ -17,7 +17,7 @@ var C = (function () { function C() { } C.bar = function () { - var obj = function () { }(_a = {}, _a[foo()] = , _a); + var obj = (_a = {}, _a[foo()] = function () { }, _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js index f7d95e560d2..67121a627d1 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js @@ -10,7 +10,7 @@ var o: I = { } //// [computedPropertyNamesContextualType1_ES5.js] -var o = function (y) { +var o = (_a = {}, _a["" + 0] = function (y) { return y.length; -}(_a = {}, _a["" + 0] = , _a["" + 1] = function (y) { return y.length; }, _a); +}, _a["" + 1] = function (y) { return y.length; }, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js index 7ff1a5f9768..3bea2d75ee0 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js @@ -10,7 +10,7 @@ var o: I = { } //// [computedPropertyNamesContextualType2_ES5.js] -var o = function (y) { +var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; -}(_a = {}, _a[+"foo"] = , _a[+"bar"] = function (y) { return y.length; }, _a); +}, _a[+"bar"] = function (y) { return y.length; }, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js index 8aef840065b..320a4cf1063 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js @@ -9,7 +9,7 @@ var o: I = { } //// [computedPropertyNamesContextualType3_ES5.js] -var o = function (y) { +var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; -}(_a = {}, _a[+"foo"] = , _a[+"bar"] = function (y) { return y.length; }, _a); +}, _a[+"bar"] = function (y) { return y.length; }, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js index ddf9786ba16..4ffdca51f09 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js @@ -7,7 +7,7 @@ var v = { } //// [computedPropertyNamesDeclarationEmit5_ES5.js] -var v = function () { }(_a = {}, _a["" + ""] = 0, _a["" + ""] = , _a["" + ""] = Object.defineProperty({ get: function () { +var v = (_a = {}, _a["" + ""] = 0, _a["" + ""] = function () { }, _a["" + ""] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }), _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js index 9c45a3f7862..d01778ff90d 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js @@ -6,8 +6,8 @@ var v = { } //// [computedPropertyNamesSourceMap2_ES5.js] -var v = function () { +var v = (_a = {}, _a["hello"] = function () { debugger; -}(_a = {}, _a["hello"] = , _a); +}, _a); var _a; //# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map index c07389c568f..9a6e38deda4 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map @@ -1,2 +1,2 @@ //// [computedPropertyNamesSourceMap2_ES5.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":["[\"hello\"]"],"mappings":"AAAA,IAAI,CAAC,GAAG;IAEAA,QAAQA,CAACA;AACbA,CAACA,AAJA,CACA,EAAA,GADA,EAAA,EACA,EAAA,CACK,OAAO,CAFA,GAAA,EACA,EAAA,AADA,CAKA,CAAA;IAJD,EAAA"} \ No newline at end of file +{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CACA,EAAA,GADA,EAAA,EACA,EAAA,CACK,OAAO,CAFA,GAAA;IAGA,QAAQ,CAAC;AACb,CAAC,AAJA,EACA,EAAA,AADA,CAKA,CAAA;IAJD,EAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt index cf074242624..068eded06cd 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt @@ -8,138 +8,150 @@ sources: computedPropertyNamesSourceMap2_ES5.ts emittedFile:tests/cases/conformance/es6/computedProperties/computedPropertyNamesSourceMap2_ES5.js sourceFile:computedPropertyNamesSourceMap2_ES5.ts ------------------------------------------------------------------- ->>>var v = function () { +>>>var v = (_a = {}, _a["hello"] = function () { 1 > 2 >^^^^ 3 > ^ 4 > ^^^ -5 > ^^^^^^-> +5 > +6 > ^ +7 > ^^ +8 > ^^^ +9 > ^^ +10> ^^ +11> ^^ +12> ^ +13> ^^^^^^^ +14> ^ +15> ^^^ 1 > 2 >var 3 > v 4 > = +5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 9) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +5 > +6 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 9) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 10) Source(1, 1) + SourceIndex(0) nameIndex (-1) +6 > +7 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +7 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 10) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 12) Source(1, 1) + SourceIndex(0) nameIndex (-1) +7 > +8 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +8 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 12) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 15) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +8 > +9 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +9 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 17) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +9 > +10> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +10> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 15) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 19) Source(1, 1) + SourceIndex(0) nameIndex (-1) +10> +11> !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +11> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 21) Source(1, 1) + SourceIndex(0) nameIndex (-1) +11> +12> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +12> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 17) Source(0, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 22) Source(2, 6) + SourceIndex(0) nameIndex (-1) +12> var v = { + > [ +13> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +13> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 19) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 29) Source(2, 13) + SourceIndex(0) nameIndex (-1) +13> "hello" +14> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +14> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 21) Source(1, 9) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 30) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +14> +15> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +15> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 22) Source(2, 14) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(1, 33) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +15> 1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) 2 >Emitted(1, 5) Source(1, 5) + SourceIndex(0) 3 >Emitted(1, 6) Source(1, 6) + SourceIndex(0) 4 >Emitted(1, 9) Source(1, 9) + SourceIndex(0) +5 >Emitted(1, 9) Source(0, NaN) + SourceIndex(0) +6 >Emitted(1, 10) Source(1, 1) + SourceIndex(0) +7 >Emitted(1, 12) Source(1, 1) + SourceIndex(0) +8 >Emitted(1, 15) Source(0, NaN) + SourceIndex(0) +9 >Emitted(1, 17) Source(0, NaN) + SourceIndex(0) +10>Emitted(1, 19) Source(1, 1) + SourceIndex(0) +11>Emitted(1, 21) Source(1, 1) + SourceIndex(0) +12>Emitted(1, 22) Source(2, 6) + SourceIndex(0) +13>Emitted(1, 29) Source(2, 13) + SourceIndex(0) +14>Emitted(1, 30) Source(0, NaN) + SourceIndex(0) +15>Emitted(1, 33) Source(0, NaN) + SourceIndex(0) --- >>> debugger; -1->^^^^ +1 >^^^^ 2 > ^^^^^^^^ 3 > ^ -4 > ^^^^^^^^^^^^^^^^^^^-> -1->{ - > ["hello"]() { - > +1 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 29) Source(2, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 5) Source(3, 9) + SourceIndex(0) nameIndex (-1) +1 > +2 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 30) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 13) Source(3, 17) + SourceIndex(0) nameIndex (-1) 2 > debugger +3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 30) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(2, 14) Source(3, 18) + SourceIndex(0) nameIndex (-1) 3 > ; -1->Emitted(2, 5) Source(3, 9) + SourceIndex(0) name (["hello"]) -2 >Emitted(2, 13) Source(3, 17) + SourceIndex(0) name (["hello"]) -3 >Emitted(2, 14) Source(3, 18) + SourceIndex(0) name (["hello"]) +1 >Emitted(2, 5) Source(3, 9) + SourceIndex(0) +2 >Emitted(2, 13) Source(3, 17) + SourceIndex(0) +3 >Emitted(2, 14) Source(3, 18) + SourceIndex(0) --- ->>>}(_a = {}, _a["hello"] = , _a); -1-> +>>>}, _a); +1 > 2 >^ 3 > -4 > ^ -5 > ^^ -6 > ^^^ -7 > ^^ -8 > ^^ -9 > ^^ -10> ^ -11> ^^^^^^^ -12> ^ -13> ^^^ -14> ^^ -15> ^^ -16> -17> ^ -18> ^ -1-> +4 > ^^ +5 > ^^ +6 > +7 > ^ +8 > ^ +9 > ^-> +1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 33) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 1) Source(4, 5) + SourceIndex(0) nameIndex (-1) +1 > > +2 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +2 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 33) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 2) Source(4, 6) + SourceIndex(0) nameIndex (-1) 2 >} -3 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 6) + SourceIndex(0) name (["hello"]) Span encoded by the emitter:Emitted(3, 2) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 5) Source(3, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 2) Source(0, NaN) + SourceIndex(0) nameIndex (-1) 3 > -4 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 6) + SourceIndex(0) name (["hello"]) Span encoded by the emitter:Emitted(3, 3) Source(1, 1) + SourceIndex(0) nameIndex (-1) +4 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 13) Source(3, 29) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 4) Source(1, 1) + SourceIndex(0) nameIndex (-1) 4 > -5 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 3) Source(1, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) -5 > -6 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 5) Source(1, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 8) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -6 > -7 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -7 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 8) Source(0, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 10) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -7 > -8 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -8 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 8) Source(0, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 12) Source(1, 1) + SourceIndex(0) nameIndex (-1) -8 > -9 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -9 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 10) Source(0, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 14) Source(1, 1) + SourceIndex(0) nameIndex (-1) -9 > -10> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -10> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 10) Source(0, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 15) Source(2, 6) + SourceIndex(0) nameIndex (-1) -10> var v = { - > [ -11> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -11> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 12) Source(1, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 22) Source(2, 13) + SourceIndex(0) nameIndex (-1) -11> "hello" -12> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -12> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 14) Source(1, 6) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 23) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -12> -13> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -13> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 15) Source(2, 11) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 26) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -13> -14> !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -14> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 22) Source(2, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 28) Source(1, 1) + SourceIndex(0) nameIndex (-1) -14> -15> !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -15> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 23) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 30) Source(1, 1) + SourceIndex(0) nameIndex (-1) -15> -16> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -16> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 23) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 30) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -16> -17> !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -17> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 26) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 31) Source(5, 2) + SourceIndex(0) nameIndex (-1) -17> -18> !!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -18> !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 26) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 32) Source(5, 2) + SourceIndex(0) nameIndex (-1) -18> -1->Emitted(3, 1) Source(4, 5) + SourceIndex(0) name (["hello"]) -2 >Emitted(3, 2) Source(4, 6) + SourceIndex(0) name (["hello"]) +5 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 14) Source(3, 30) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 6) Source(1, 1) + SourceIndex(0) nameIndex (-1) +5 > +6 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 1) Source(4, 17) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 6) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +6 > +7 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +7 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(4, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 7) Source(5, 2) + SourceIndex(0) nameIndex (-1) +7 > +8 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +8 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 8) Source(5, 2) + SourceIndex(0) nameIndex (-1) +8 > +1 >Emitted(3, 1) Source(4, 5) + SourceIndex(0) +2 >Emitted(3, 2) Source(4, 6) + SourceIndex(0) 3 >Emitted(3, 2) Source(0, NaN) + SourceIndex(0) -4 >Emitted(3, 3) Source(1, 1) + SourceIndex(0) -5 >Emitted(3, 5) Source(1, 1) + SourceIndex(0) -6 >Emitted(3, 8) Source(0, NaN) + SourceIndex(0) -7 >Emitted(3, 10) Source(0, NaN) + SourceIndex(0) -8 >Emitted(3, 12) Source(1, 1) + SourceIndex(0) -9 >Emitted(3, 14) Source(1, 1) + SourceIndex(0) -10>Emitted(3, 15) Source(2, 6) + SourceIndex(0) -11>Emitted(3, 22) Source(2, 13) + SourceIndex(0) -12>Emitted(3, 23) Source(0, NaN) + SourceIndex(0) -13>Emitted(3, 26) Source(0, NaN) + SourceIndex(0) -14>Emitted(3, 28) Source(1, 1) + SourceIndex(0) -15>Emitted(3, 30) Source(1, 1) + SourceIndex(0) -16>Emitted(3, 30) Source(0, NaN) + SourceIndex(0) -17>Emitted(3, 31) Source(5, 2) + SourceIndex(0) -18>Emitted(3, 32) Source(5, 2) + SourceIndex(0) +4 >Emitted(3, 4) Source(1, 1) + SourceIndex(0) +5 >Emitted(3, 6) Source(1, 1) + SourceIndex(0) +6 >Emitted(3, 6) Source(0, NaN) + SourceIndex(0) +7 >Emitted(3, 7) Source(5, 2) + SourceIndex(0) +8 >Emitted(3, 8) Source(5, 2) + SourceIndex(0) --- >>>var _a; -1 >^^^^ +1->^^^^ 2 > ^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> -1 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 28) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) -1 > +1->!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column +1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) +1-> 2 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 30) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1) +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 4) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1) 2 > -1 >Emitted(4, 5) Source(1, 1) + SourceIndex(0) +1->Emitted(4, 5) Source(1, 1) + SourceIndex(0) 2 >Emitted(4, 7) Source(1, 1) + SourceIndex(0) --- !!!! **** There are more source map entries in the sourceMap's mapping than what was encoded -!!!! **** Remaining decoded string: ,AADA,CAKA,CAAA;IAJD,EAAA +!!!! **** Remaining decoded string: ,EAAA,AADA,CAKA,CAAA;IAJD,EAAA >>>//# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.js b/tests/baselines/reference/parserES5ComputedPropertyName3.js index b6fcff6630c..1fdb5ced65d 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName3.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName3.js @@ -2,5 +2,5 @@ var v = { [e]() { } }; //// [parserES5ComputedPropertyName3.js] -var v = function () { }(_a = {}, _a[e] = , _a); +var v = (_a = {}, _a[e] = function () { }, _a); var _a; From 88c61e89a8c67dacfdcb382ce7815195d3c38558 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 20 Feb 2015 18:02:14 -0800 Subject: [PATCH 151/162] Addressed CR comments. --- src/compiler/emitter.ts | 45 ++++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 971efb2ea5f..1df706c60f7 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2528,6 +2528,7 @@ module ts { var node = createNode(kind); node.pos = -1; node.end = -1; + return node; } @@ -2548,7 +2549,8 @@ module ts { initialObjectLiteral.flags |= NodeFlags.MultiLine; // The comma expressions that will patch the object literal. - var propertyPatches = createBinaryExpression(SyntaxKind.EqualsToken, tempVar, initialObjectLiteral); + // This will end up being something like '_a = { ... }, _a.x = 10, _a.y = 20, _a'. + var propertyPatches = createBinaryExpression(tempVar, SyntaxKind.EqualsToken, initialObjectLiteral); ts.forEach(originalObjectLiteral.properties, property => { var patchedProperty = tryCreatePatchingPropertyAssignment(originalObjectLiteral, tempVar, property); @@ -2558,11 +2560,12 @@ module ts { //var trailingComments = getTrailingCommentRanges(currentSourceFile.text, property.end); //addCommentsToSynthesizedNode(patchedProperty, leadingComments, trailingComments); - propertyPatches = createBinaryExpression(SyntaxKind.CommaToken, propertyPatches, patchedProperty); + propertyPatches = createBinaryExpression(propertyPatches, SyntaxKind.CommaToken, patchedProperty); } }); - propertyPatches = createBinaryExpression(SyntaxKind.CommaToken, propertyPatches, tempVar); + // Finally, return the temp variable. + propertyPatches = createBinaryExpression(propertyPatches, SyntaxKind.CommaToken, tempVar); var result = createParenthesizedExpression(propertyPatches); @@ -2579,7 +2582,8 @@ module ts { node.trailingCommentRanges = trailingCommentRanges; } - // Returns 'undefined' if a property has already been accounted for. + // Returns 'undefined' if a property has already been accounted for + // (e.g. a 'get' accessor which has already been emitted along with its 'set' accessor). function tryCreatePatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, tempVar: Identifier, property: ObjectLiteralElement): Expression { var leftHandSide = createMemberAccessForPropertyName(tempVar, property.name); var rightHandSide: Expression; @@ -2592,25 +2596,25 @@ module ts { rightHandSide = createPropertyAccessExpression(prefix, (property).name); } else if (property.kind === SyntaxKind.MethodDeclaration) { - rightHandSide = createFunctionExpressionForFunctionLikeDeclaration((property)); + rightHandSide = createFunctionExpressionForFunctionLikeDeclaration((property).parameters, (property).body); } else if (property.kind === SyntaxKind.GetAccessor || property.kind === SyntaxKind.SetAccessor) { - var accessors = getAllAccessorDeclarations(objectLiteral.properties, property); + var { firstAccessor, setAccessor, getAccessor } = getAllAccessorDeclarations(objectLiteral.properties, property); // Only emit the first accessor. - if (accessors.firstAccessor !== property) { + if (firstAccessor !== property) { return undefined; } var propertyDescriptor = createSynthesizedNode(SyntaxKind.ObjectLiteralExpression); var descriptorProperties = >[]; - if (accessors.getAccessor) { - var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpressionForFunctionLikeDeclaration(accessors.getAccessor)); + if (getAccessor) { + var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpressionForFunctionLikeDeclaration(getAccessor.parameters, getAccessor.body)); descriptorProperties.push(getProperty); } - if (accessors.setAccessor) { - var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpressionForFunctionLikeDeclaration(accessors.setAccessor)); + if (setAccessor) { + var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpressionForFunctionLikeDeclaration(setAccessor.parameters, setAccessor.body)); descriptorProperties.push(setProperty); } @@ -2631,20 +2635,25 @@ module ts { Debug.fail(`ObjectLiteralElement kind ${property.kind} not accounted for.`); } - return createBinaryExpression(SyntaxKind.EqualsToken, leftHandSide, rightHandSide); + return createBinaryExpression(leftHandSide, SyntaxKind.EqualsToken, rightHandSide); } function createParenthesizedExpression(expression: Expression) { var result = createSynthesizedNode(SyntaxKind.ParenthesizedExpression); result.expression = expression; + return result; } function createNodeArray(...elements: T[]): NodeArray { - return >elements; + var result = >elements; + result.pos = -1; + result.end = -1; + + return result; } - function createBinaryExpression(operator: SyntaxKind, left: Expression, right: Expression): BinaryExpression { + function createBinaryExpression(left: Expression, operator: SyntaxKind, right: Expression): BinaryExpression { var result = createSynthesizedNode(SyntaxKind.BinaryExpression); result.operator = operator; result.left = left; @@ -2670,17 +2679,16 @@ module ts { function createPropertyAssignment(name: LiteralExpression | Identifier, initializer: Expression) { var result = createSynthesizedNode(SyntaxKind.PropertyAssignment); - result.name = name; result.initializer = initializer; return result; } - function createFunctionExpressionForFunctionLikeDeclaration(func: FunctionLikeDeclaration): FunctionExpression { + function createFunctionExpressionForFunctionLikeDeclaration(parameters: NodeArray, body: Block): FunctionExpression { var result = createSynthesizedNode(SyntaxKind.FunctionExpression); - result.parameters = func.parameters; - result.body = func.body; + result.parameters = parameters; + result.body = body; return result; } @@ -2704,6 +2712,7 @@ module ts { function createIdentifier(name: string) { var result = createSynthesizedNode(SyntaxKind.Identifier); result.text = name; + return result; } From bebdd73e13560c5bc28cf7b548d2ccd800fb30c7 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 20 Feb 2015 18:16:52 -0800 Subject: [PATCH 152/162] Extracted out RHS patching property logic to function. --- src/compiler/emitter.ts | 102 +++++++++++++++++++++------------------- 1 file changed, 53 insertions(+), 49 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 1df706c60f7..ec5a0fba730 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2586,58 +2586,62 @@ module ts { // (e.g. a 'get' accessor which has already been emitted along with its 'set' accessor). function tryCreatePatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, tempVar: Identifier, property: ObjectLiteralElement): Expression { var leftHandSide = createMemberAccessForPropertyName(tempVar, property.name); - var rightHandSide: Expression; - - if (property.kind === SyntaxKind.PropertyAssignment) { - rightHandSide = (property).initializer; - } - else if (property.kind === SyntaxKind.ShorthandPropertyAssignment) { - var prefix = createIdentifier(resolver.getExpressionNamePrefix((property).name)); - rightHandSide = createPropertyAccessExpression(prefix, (property).name); - } - else if (property.kind === SyntaxKind.MethodDeclaration) { - rightHandSide = createFunctionExpressionForFunctionLikeDeclaration((property).parameters, (property).body); - } - else if (property.kind === SyntaxKind.GetAccessor || property.kind === SyntaxKind.SetAccessor) { - var { firstAccessor, setAccessor, getAccessor } = getAllAccessorDeclarations(objectLiteral.properties, property); - - // Only emit the first accessor. - if (firstAccessor !== property) { - return undefined; - } - - var propertyDescriptor = createSynthesizedNode(SyntaxKind.ObjectLiteralExpression); - - var descriptorProperties = >[]; - if (getAccessor) { - var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpressionForFunctionLikeDeclaration(getAccessor.parameters, getAccessor.body)); - descriptorProperties.push(getProperty); - } - if (setAccessor) { - var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpressionForFunctionLikeDeclaration(setAccessor.parameters, setAccessor.body)); - descriptorProperties.push(setProperty); - } - - var trueExpr = createSynthesizedNode(SyntaxKind.TrueKeyword); - - var enumerableTrue = createPropertyAssignment(createIdentifier("enumerable"), trueExpr); - descriptorProperties.push(enumerableTrue); - - var configurableTrue = createPropertyAssignment(createIdentifier("configurable"), trueExpr); - descriptorProperties.push(configurableTrue); - - propertyDescriptor.properties = descriptorProperties; - - var objectDotDefineProperty = createPropertyAccessExpression(createIdentifier("Object"), createIdentifier("defineProperty")); - rightHandSide = createCallExpression(objectDotDefineProperty, createNodeArray(propertyDescriptor)); - } - else { - Debug.fail(`ObjectLiteralElement kind ${property.kind} not accounted for.`); - } + var rightHandSide = getRightHandSideOfPatchingPropertyAssignment(objectLiteral, property); return createBinaryExpression(leftHandSide, SyntaxKind.EqualsToken, rightHandSide); } + function getRightHandSideOfPatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, property: ObjectLiteralElement) { + switch (property.kind) { + case SyntaxKind.PropertyAssignment: + return (property).initializer; + + case SyntaxKind.ShorthandPropertyAssignment: + var prefix = createIdentifier(resolver.getExpressionNamePrefix((property).name)); + return createPropertyAccessExpression(prefix, (property).name); + + case SyntaxKind.MethodDeclaration: + return createFunctionExpression((property).parameters, (property).body); + + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + var { firstAccessor, getAccessor, setAccessor } = getAllAccessorDeclarations(objectLiteral.properties, property); + + // Only emit the first accessor. + if (firstAccessor !== property) { + return undefined; + } + + var propertyDescriptor = createSynthesizedNode(SyntaxKind.ObjectLiteralExpression); + + var descriptorProperties = >[]; + if (getAccessor) { + var getProperty = createPropertyAssignment(createIdentifier("get"), createFunctionExpression(getAccessor.parameters, getAccessor.body)); + descriptorProperties.push(getProperty); + } + if (setAccessor) { + var setProperty = createPropertyAssignment(createIdentifier("set"), createFunctionExpression(setAccessor.parameters, setAccessor.body)); + descriptorProperties.push(setProperty); + } + + var trueExpr = createSynthesizedNode(SyntaxKind.TrueKeyword); + + var enumerableTrue = createPropertyAssignment(createIdentifier("enumerable"), trueExpr); + descriptorProperties.push(enumerableTrue); + + var configurableTrue = createPropertyAssignment(createIdentifier("configurable"), trueExpr); + descriptorProperties.push(configurableTrue); + + propertyDescriptor.properties = descriptorProperties; + + var objectDotDefineProperty = createPropertyAccessExpression(createIdentifier("Object"), createIdentifier("defineProperty")); + return createCallExpression(objectDotDefineProperty, createNodeArray(propertyDescriptor)); + + default: + Debug.fail(`ObjectLiteralElement kind ${property.kind} not accounted for.`); + } + } + function createParenthesizedExpression(expression: Expression) { var result = createSynthesizedNode(SyntaxKind.ParenthesizedExpression); result.expression = expression; @@ -2685,7 +2689,7 @@ module ts { return result; } - function createFunctionExpressionForFunctionLikeDeclaration(parameters: NodeArray, body: Block): FunctionExpression { + function createFunctionExpression(parameters: NodeArray, body: Block): FunctionExpression { var result = createSynthesizedNode(SyntaxKind.FunctionExpression); result.parameters = parameters; result.body = body; From 4138fed1d751c617139419ec0f71d289ffbf7fff Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 20 Feb 2015 18:36:31 -0800 Subject: [PATCH 153/162] Fixed case where property should not be emitted. --- src/compiler/emitter.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index ec5a0fba730..b5826c5aa5a 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2586,12 +2586,12 @@ module ts { // (e.g. a 'get' accessor which has already been emitted along with its 'set' accessor). function tryCreatePatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, tempVar: Identifier, property: ObjectLiteralElement): Expression { var leftHandSide = createMemberAccessForPropertyName(tempVar, property.name); - var rightHandSide = getRightHandSideOfPatchingPropertyAssignment(objectLiteral, property); + var maybeRightHandSide = tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral, property); - return createBinaryExpression(leftHandSide, SyntaxKind.EqualsToken, rightHandSide); + return maybeRightHandSide && createBinaryExpression(leftHandSide, SyntaxKind.EqualsToken, maybeRightHandSide); } - function getRightHandSideOfPatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, property: ObjectLiteralElement) { + function tryGetRightHandSideOfPatchingPropertyAssignment(objectLiteral: ObjectLiteralExpression, property: ObjectLiteralElement) { switch (property.kind) { case SyntaxKind.PropertyAssignment: return (property).initializer; From fc229368d15fbc24d19e59b48ca9d64bb624e65a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 20 Feb 2015 18:56:42 -0800 Subject: [PATCH 154/162] Include the binary expression's operator in the AST. --- src/compiler/checker.ts | 32 +++++++++---------- src/compiler/emitter.ts | 12 +++---- src/compiler/parser.ts | 32 ++++++++----------- src/compiler/types.ts | 2 +- src/services/breakpoints.ts | 2 +- src/services/formatting/formattingScanner.ts | 26 ++++++++------- src/services/services.ts | 2 +- .../baselines/reference/APISample_compile.js | 2 +- .../reference/APISample_compile.types | 6 ++-- tests/baselines/reference/APISample_linter.js | 6 ++-- .../reference/APISample_linter.types | 14 ++++---- .../reference/APISample_transform.js | 2 +- .../reference/APISample_transform.types | 6 ++-- .../baselines/reference/APISample_watcher.js | 2 +- .../reference/APISample_watcher.types | 6 ++-- tests/cases/compiler/APISample_linter.ts | 2 +- tests/cases/unittests/incrementalParser.ts | 2 +- 17 files changed, 78 insertions(+), 78 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 5f93fe82786..489f84cfcea 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -3409,7 +3409,7 @@ module ts { return isContextSensitive((node).whenTrue) || isContextSensitive((node).whenFalse); case SyntaxKind.BinaryExpression: - return (node).operator === SyntaxKind.BarBarToken && + return (node).operatorToken.kind === SyntaxKind.BarBarToken && (isContextSensitive((node).left) || isContextSensitive((node).right)); case SyntaxKind.PropertyAssignment: return isContextSensitive((node).initializer); @@ -4591,7 +4591,7 @@ module ts { return links.assignmentChecks[symbol.id] = isAssignedIn(node); function isAssignedInBinaryExpression(node: BinaryExpression) { - if (node.operator >= SyntaxKind.FirstAssignment && node.operator <= SyntaxKind.LastAssignment) { + if (node.operatorToken.kind >= SyntaxKind.FirstAssignment && node.operatorToken.kind <= SyntaxKind.LastAssignment) { var n = node.left; while (n.kind === SyntaxKind.ParenthesizedExpression) { n = (n).expression; @@ -4724,10 +4724,10 @@ module ts { case SyntaxKind.BinaryExpression: // In the right operand of an && or ||, narrow based on left operand if (child === (node).right) { - if ((node).operator === SyntaxKind.AmpersandAmpersandToken) { + if ((node).operatorToken.kind === SyntaxKind.AmpersandAmpersandToken) { narrowedType = narrowType(type, (node).left, /*assumeTrue*/ true); } - else if ((node).operator === SyntaxKind.BarBarToken) { + else if ((node).operatorToken.kind === SyntaxKind.BarBarToken) { narrowedType = narrowType(type, (node).left, /*assumeTrue*/ false); } } @@ -4765,7 +4765,7 @@ module ts { return type; } var typeInfo = primitiveTypeInfo[right.text]; - if (expr.operator === SyntaxKind.ExclamationEqualsEqualsToken) { + if (expr.operatorToken.kind === SyntaxKind.ExclamationEqualsEqualsToken) { assumeTrue = !assumeTrue; } if (assumeTrue) { @@ -4855,7 +4855,7 @@ module ts { case SyntaxKind.ParenthesizedExpression: return narrowType(type, (expr).expression, assumeTrue); case SyntaxKind.BinaryExpression: - var operator = (expr).operator; + var operator = (expr).operatorToken.kind; if (operator === SyntaxKind.EqualsEqualsEqualsToken || operator === SyntaxKind.ExclamationEqualsEqualsToken) { return narrowTypeByEquality(type, expr, assumeTrue); } @@ -5202,7 +5202,7 @@ module ts { function getContextualTypeForBinaryOperand(node: Expression): Type { var binaryExpression = node.parent; - var operator = binaryExpression.operator; + var operator = binaryExpression.operatorToken.kind; if (operator >= SyntaxKind.FirstAssignment && operator <= SyntaxKind.LastAssignment) { // In an assignment expression, the right operand is contextually typed by the type of the left operand. if (node === binaryExpression.right) { @@ -5452,7 +5452,7 @@ module ts { // an assignment target. Examples include 'a = xxx', '{ p: a } = xxx', '[{ p: a}] = xxx'. function isAssignmentTarget(node: Node): boolean { var parent = node.parent; - if (parent.kind === SyntaxKind.BinaryExpression && (parent).operator === SyntaxKind.EqualsToken && (parent).left === node) { + if (parent.kind === SyntaxKind.BinaryExpression && (parent).operatorToken.kind === SyntaxKind.EqualsToken && (parent).left === node) { return true; } if (parent.kind === SyntaxKind.PropertyAssignment) { @@ -7108,7 +7108,7 @@ module ts { } function checkDestructuringAssignment(target: Expression, sourceType: Type, contextualMapper?: TypeMapper): Type { - if (target.kind === SyntaxKind.BinaryExpression && (target).operator === SyntaxKind.EqualsToken) { + if (target.kind === SyntaxKind.BinaryExpression && (target).operatorToken.kind === SyntaxKind.EqualsToken) { checkBinaryExpression(target, contextualMapper); target = (target).left; } @@ -7131,13 +7131,13 @@ module ts { function checkBinaryExpression(node: BinaryExpression, contextualMapper?: TypeMapper) { // Grammar checking - if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operator)) { + if (isLeftHandSideExpression(node.left) && isAssignmentOperator(node.operatorToken.kind)) { // ECMA 262 (Annex C) The identifier eval or arguments may not appear as the LeftHandSideExpression of an // Assignment operator(11.13) or of a PostfixExpression(11.3) checkGrammarEvalOrArgumentsInStrictMode(node, node.left); } - var operator = node.operator; + var operator = node.operatorToken.kind; if (operator === SyntaxKind.EqualsToken && (node.left.kind === SyntaxKind.ObjectLiteralExpression || node.left.kind === SyntaxKind.ArrayLiteralExpression)) { return checkDestructuringAssignment(node.left, checkExpression(node.right, contextualMapper), contextualMapper); } @@ -7178,8 +7178,8 @@ module ts { // try and return them a helpful suggestion if ((leftType.flags & TypeFlags.Boolean) && (rightType.flags & TypeFlags.Boolean) && - (suggestedOperator = getSuggestedBooleanOperator(node.operator)) !== undefined) { - error(node, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(node.operator), tokenToString(suggestedOperator)); + (suggestedOperator = getSuggestedBooleanOperator(node.operatorToken.kind)) !== undefined) { + error(node, Diagnostics.The_0_operator_is_not_allowed_for_boolean_types_Consider_using_1_instead, tokenToString(node.operatorToken.kind), tokenToString(suggestedOperator)); } else { // otherwise just check each operand separately and report errors as normal @@ -7312,7 +7312,7 @@ module ts { } function reportOperatorError() { - error(node, Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, tokenToString(node.operator), typeToString(leftType), typeToString(rightType)); + error(node, Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, tokenToString(node.operatorToken.kind), typeToString(leftType), typeToString(rightType)); } } @@ -9252,7 +9252,7 @@ module ts { if (right === undefined) { return undefined; } - switch ((e).operator) { + switch ((e).operatorToken.kind) { case SyntaxKind.BarToken: return left | right; case SyntaxKind.AmpersandToken: return left & right; case SyntaxKind.GreaterThanGreaterThanToken: return left >> right; @@ -10830,7 +10830,7 @@ module ts { if (languageVersion < ScriptTarget.ES6) { return grammarErrorOnNode(node, Diagnostics.Computed_property_names_are_only_available_when_targeting_ECMAScript_6_and_higher); } - else if (computedPropertyName.expression.kind === SyntaxKind.BinaryExpression && (computedPropertyName.expression).operator === SyntaxKind.CommaToken) { + else if (computedPropertyName.expression.kind === SyntaxKind.BinaryExpression && (computedPropertyName.expression).operatorToken.kind === SyntaxKind.CommaToken) { return grammarErrorOnNode(computedPropertyName.expression, Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name); } } diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 62910c184aa..3a7f6248389 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2252,7 +2252,7 @@ module ts { // spread ('...') unary operators that are anticipated for ES6. switch (expression.kind) { case SyntaxKind.BinaryExpression: - switch ((expression).operator) { + switch ((expression).operatorToken.kind) { case SyntaxKind.AsteriskToken: case SyntaxKind.SlashToken: case SyntaxKind.PercentToken: @@ -2773,14 +2773,14 @@ module ts { } function emitBinaryExpression(node: BinaryExpression) { - if (languageVersion < ScriptTarget.ES6 && node.operator === SyntaxKind.EqualsToken && + if (languageVersion < ScriptTarget.ES6 && node.operatorToken.kind === SyntaxKind.EqualsToken && (node.left.kind === SyntaxKind.ObjectLiteralExpression || node.left.kind === SyntaxKind.ArrayLiteralExpression)) { emitDestructuring(node); } else { emit(node.left); - if (node.operator !== SyntaxKind.CommaToken) write(" "); - write(tokenToString(node.operator)); + if (node.operatorToken.kind !== SyntaxKind.CommaToken) write(" "); + write(tokenToString(node.operatorToken.kind)); write(" "); emit(node.right); } @@ -3122,7 +3122,7 @@ module ts { // Return the expression 'value === void 0 ? defaultValue : value' var equals = createNode(SyntaxKind.BinaryExpression); equals.left = value; - equals.operator = SyntaxKind.EqualsEqualsEqualsToken; + equals.operatorToken = createNode(SyntaxKind.EqualsEqualsEqualsToken); equals.right = createVoidZero(); var cond = createNode(SyntaxKind.ConditionalExpression); cond.condition = equals; @@ -3205,7 +3205,7 @@ module ts { } function emitDestructuringAssignment(target: Expression, value: Expression) { - if (target.kind === SyntaxKind.BinaryExpression && (target).operator === SyntaxKind.EqualsToken) { + if (target.kind === SyntaxKind.BinaryExpression && (target).operatorToken.kind === SyntaxKind.EqualsToken) { value = createDefaultValueCheck(value,(target).right); target = (target).left; } diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 95e1ea5de00..aaa19e4c801 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -152,6 +152,7 @@ module ts { return visitNode(cbNode, (node).operand); case SyntaxKind.BinaryExpression: return visitNode(cbNode, (node).left) || + visitNode(cbNode, (node).operatorToken) || visitNode(cbNode, (node).right); case SyntaxKind.ConditionalExpression: return visitNode(cbNode, (node).condition) || @@ -1311,6 +1312,12 @@ module ts { return undefined; } + function parseTokenNode(): T { + var node = createNode(token); + nextToken(); + return finishNode(node); + } + function canParseSemicolon() { // If there's a real semicolon, then we can always parse it out. if (token === SyntaxKind.SemicolonToken) { @@ -2084,14 +2091,6 @@ module ts { return allowIdentifierNames ? parseIdentifierName() : parseIdentifier(); } - - - function parseTokenNode(): T { - var node = createNode(token); - nextToken(); - return finishNode(node); - } - function parseTemplateExpression(): TemplateExpression { var template = createNode(SyntaxKind.TemplateExpression); @@ -2801,8 +2800,9 @@ module ts { // Expression[in] , AssignmentExpression[in] var expr = parseAssignmentExpressionOrHigher(); - while (parseOptional(SyntaxKind.CommaToken)) { - expr = makeBinaryExpression(expr, SyntaxKind.CommaToken, parseAssignmentExpressionOrHigher()); + var operatorToken: Node; + while ((operatorToken = parseOptionalToken(SyntaxKind.CommaToken))) { + expr = makeBinaryExpression(expr, operatorToken, parseAssignmentExpressionOrHigher()); } return expr; } @@ -2881,9 +2881,7 @@ module ts { // Note: we call reScanGreaterToken so that we get an appropriately merged token // for cases like > > = becoming >>= if (isLeftHandSideExpression(expr) && isAssignmentOperator(reScanGreaterToken())) { - var operator = token; - nextToken(); - return makeBinaryExpression(expr, operator, parseAssignmentExpressionOrHigher()); + return makeBinaryExpression(expr, parseTokenNode(), parseAssignmentExpressionOrHigher()); } // It wasn't an assignment or a lambda. This is a conditional expression: @@ -3187,9 +3185,7 @@ module ts { break; } - var operator = token; - nextToken(); - leftOperand = makeBinaryExpression(leftOperand, operator, parseBinaryExpressionOrHigher(newPrecedence)); + leftOperand = makeBinaryExpression(leftOperand, parseTokenNode(), parseBinaryExpressionOrHigher(newPrecedence)); } return leftOperand; @@ -3245,10 +3241,10 @@ module ts { return -1; } - function makeBinaryExpression(left: Expression, operator: SyntaxKind, right: Expression): BinaryExpression { + function makeBinaryExpression(left: Expression, operatorToken: Node, right: Expression): BinaryExpression { var node = createNode(SyntaxKind.BinaryExpression, left.pos); node.left = left; - node.operator = operator; + node.operatorToken = operatorToken; node.right = right; return finishNode(node); } diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 0133c83c422..ccae04ae156 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -623,7 +623,7 @@ module ts { export interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } diff --git a/src/services/breakpoints.ts b/src/services/breakpoints.ts index 86b72b711c1..07ab359f18d 100644 --- a/src/services/breakpoints.ts +++ b/src/services/breakpoints.ts @@ -69,7 +69,7 @@ module ts.BreakpointResolver { return textSpan(node); } - if (node.parent.kind === SyntaxKind.BinaryExpression && (node.parent).operator === SyntaxKind.CommaToken) { + if (node.parent.kind === SyntaxKind.BinaryExpression && (node.parent).operatorToken.kind === SyntaxKind.CommaToken) { // if this is comma expression, the breakpoint is possible in this expression return textSpan(node); } diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts index e9485158aba..4ce463ec383 100644 --- a/src/services/formatting/formattingScanner.ts +++ b/src/services/formatting/formattingScanner.ts @@ -93,17 +93,19 @@ module ts.formatting { savedPos = scanner.getStartPos(); } - function shouldRescanGreaterThanToken(container: Node): boolean { - if (container.kind !== SyntaxKind.BinaryExpression) { - return false; - } - switch ((container).operator) { - case SyntaxKind.GreaterThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: - case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case SyntaxKind.GreaterThanGreaterThanToken: - return true; + function shouldRescanGreaterThanToken(node: Node): boolean { + //if (container.kind !== SyntaxKind.BinaryExpression) { + // return false; + //} + if (node) { + switch (node.kind) { + case SyntaxKind.GreaterThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken: + case SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case SyntaxKind.GreaterThanGreaterThanToken: + return true; + } } return false; @@ -164,7 +166,7 @@ module ts.formatting { if (expectedScanAction === ScanAction.RescanGreaterThanToken && currentToken === SyntaxKind.GreaterThanToken) { currentToken = scanner.reScanGreaterToken(); - Debug.assert((n).operator === currentToken); + Debug.assert(n.kind === currentToken); lastScanAction = ScanAction.RescanGreaterThanToken; } else if (expectedScanAction === ScanAction.RescanSlashToken && startsWithSlashToken(currentToken)) { diff --git a/src/services/services.ts b/src/services/services.ts index 7c77b8c5cd0..9b187f19848 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -4648,7 +4648,7 @@ module ts { return true; } else if (parent.kind === SyntaxKind.BinaryExpression && (parent).left === node) { - var operator = (parent).operator; + var operator = (parent).operatorToken.kind; return SyntaxKind.FirstAssignment <= operator && operator <= SyntaxKind.LastAssignment; } } diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index 2d18228b12b..0e57a0db2c2 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -527,7 +527,7 @@ declare module "typescript" { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { diff --git a/tests/baselines/reference/APISample_compile.types b/tests/baselines/reference/APISample_compile.types index e31c895ccf7..1f70294c918 100644 --- a/tests/baselines/reference/APISample_compile.types +++ b/tests/baselines/reference/APISample_compile.types @@ -1585,9 +1585,9 @@ declare module "typescript" { >left : Expression >Expression : Expression - operator: SyntaxKind; ->operator : SyntaxKind ->SyntaxKind : SyntaxKind + operatorToken: Node; +>operatorToken : Node +>Node : Node right: Expression; >right : Expression diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 8bd19aaf26d..3b21fee8fdc 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -39,7 +39,7 @@ export function delint(sourceFile: ts.SourceFile) { break; case ts.SyntaxKind.BinaryExpression: - var op = (node).operator; + var op = (node).operatorToken.kind; if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) { report(node, "Use '===' and '!=='.") @@ -558,7 +558,7 @@ declare module "typescript" { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { @@ -2003,7 +2003,7 @@ function delint(sourceFile) { } break; case 165 /* BinaryExpression */: - var op = node.operator; + var op = node.operatorToken.kind; if (op === 28 /* EqualsEqualsToken */ || op === 29 /* ExclamationEqualsToken */) { report(node, "Use '===' and '!=='."); } diff --git a/tests/baselines/reference/APISample_linter.types b/tests/baselines/reference/APISample_linter.types index 1b32e59e8cb..838a09e484a 100644 --- a/tests/baselines/reference/APISample_linter.types +++ b/tests/baselines/reference/APISample_linter.types @@ -173,15 +173,17 @@ export function delint(sourceFile: ts.SourceFile) { >SyntaxKind : typeof ts.SyntaxKind >BinaryExpression : ts.SyntaxKind - var op = (node).operator; + var op = (node).operatorToken.kind; >op : ts.SyntaxKind ->(node).operator : ts.SyntaxKind +>(node).operatorToken.kind : ts.SyntaxKind +>(node).operatorToken : ts.Node >(node) : ts.BinaryExpression >node : ts.BinaryExpression >ts : unknown >BinaryExpression : ts.BinaryExpression >node : ts.Node ->operator : ts.SyntaxKind +>operatorToken : ts.Node +>kind : ts.SyntaxKind if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) { >op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken : boolean @@ -1729,9 +1731,9 @@ declare module "typescript" { >left : Expression >Expression : Expression - operator: SyntaxKind; ->operator : SyntaxKind ->SyntaxKind : SyntaxKind + operatorToken: Node; +>operatorToken : Node +>Node : Node right: Expression; >right : Expression diff --git a/tests/baselines/reference/APISample_transform.js b/tests/baselines/reference/APISample_transform.js index 1a3fe20fa9a..edb1fcff2cd 100644 --- a/tests/baselines/reference/APISample_transform.js +++ b/tests/baselines/reference/APISample_transform.js @@ -559,7 +559,7 @@ declare module "typescript" { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { diff --git a/tests/baselines/reference/APISample_transform.types b/tests/baselines/reference/APISample_transform.types index 59ce6e8c2b7..2bede1d6047 100644 --- a/tests/baselines/reference/APISample_transform.types +++ b/tests/baselines/reference/APISample_transform.types @@ -1681,9 +1681,9 @@ declare module "typescript" { >left : Expression >Expression : Expression - operator: SyntaxKind; ->operator : SyntaxKind ->SyntaxKind : SyntaxKind + operatorToken: Node; +>operatorToken : Node +>Node : Node right: Expression; >right : Expression diff --git a/tests/baselines/reference/APISample_watcher.js b/tests/baselines/reference/APISample_watcher.js index ce86fbdeb52..89c8a4a5a6a 100644 --- a/tests/baselines/reference/APISample_watcher.js +++ b/tests/baselines/reference/APISample_watcher.js @@ -596,7 +596,7 @@ declare module "typescript" { } interface BinaryExpression extends Expression { left: Expression; - operator: SyntaxKind; + operatorToken: Node; right: Expression; } interface ConditionalExpression extends Expression { diff --git a/tests/baselines/reference/APISample_watcher.types b/tests/baselines/reference/APISample_watcher.types index 8348d7360c1..338e91b167d 100644 --- a/tests/baselines/reference/APISample_watcher.types +++ b/tests/baselines/reference/APISample_watcher.types @@ -1854,9 +1854,9 @@ declare module "typescript" { >left : Expression >Expression : Expression - operator: SyntaxKind; ->operator : SyntaxKind ->SyntaxKind : SyntaxKind + operatorToken: Node; +>operatorToken : Node +>Node : Node right: Expression; >right : Expression diff --git a/tests/cases/compiler/APISample_linter.ts b/tests/cases/compiler/APISample_linter.ts index c95d6273d4e..2c425a4cf23 100644 --- a/tests/cases/compiler/APISample_linter.ts +++ b/tests/cases/compiler/APISample_linter.ts @@ -39,7 +39,7 @@ export function delint(sourceFile: ts.SourceFile) { break; case ts.SyntaxKind.BinaryExpression: - var op = (node).operator; + var op = (node).operatorToken.kind; if (op === ts.SyntaxKind.EqualsEqualsToken || op === ts.SyntaxKind.ExclamationEqualsToken) { report(node, "Use '===' and '!=='.") diff --git a/tests/cases/unittests/incrementalParser.ts b/tests/cases/unittests/incrementalParser.ts index 7c4213e22c2..54adcaf345f 100644 --- a/tests/cases/unittests/incrementalParser.ts +++ b/tests/cases/unittests/incrementalParser.ts @@ -248,7 +248,7 @@ module ts { var oldText = ScriptSnapshot.fromString(source); var newTextAndChange = withChange(oldText, index, 2, "+"); - compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 21); + compareTrees(oldText, newTextAndChange.text, newTextAndChange.textChangeRange, 24); }); it('Strict mode 1',() => { From b29fba46029b4933cecb032c432d7b1d729e5f2e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 20 Feb 2015 21:53:44 -0800 Subject: [PATCH 155/162] Preserve newlines and indentation for binary expressions when possible. --- src/compiler/emitter.ts | 45 +++- tests/baselines/reference/APISample_linter.js | 3 +- .../baselines/reference/ES5SymbolProperty1.js | 4 +- .../reference/FunctionDeclaration8_es6.js | 4 +- .../reference/FunctionDeclaration9_es6.js | 4 +- .../FunctionPropertyAssignments5_es6.js | 3 +- tests/baselines/reference/asiArith.js | 6 +- .../reference/computedPropertyNames10_ES5.js | 3 +- .../reference/computedPropertyNames11_ES5.js | 3 +- .../reference/computedPropertyNames18_ES5.js | 4 +- .../reference/computedPropertyNames19_ES5.js | 4 +- .../reference/computedPropertyNames1_ES5.js | 3 +- .../reference/computedPropertyNames20_ES5.js | 4 +- .../reference/computedPropertyNames22_ES5.js | 3 +- .../reference/computedPropertyNames23_ES5.js | 4 +- .../reference/computedPropertyNames25_ES5.js | 3 +- .../reference/computedPropertyNames26_ES5.js | 4 +- .../reference/computedPropertyNames28_ES5.js | 3 +- .../reference/computedPropertyNames29_ES5.js | 3 +- .../reference/computedPropertyNames30_ES5.js | 3 +- .../reference/computedPropertyNames31_ES5.js | 3 +- .../reference/computedPropertyNames33_ES5.js | 3 +- .../reference/computedPropertyNames34_ES5.js | 3 +- .../reference/computedPropertyNames46_ES5.js | 4 +- .../reference/computedPropertyNames47_ES5.js | 4 +- .../reference/computedPropertyNames48_ES5.js | 12 +- .../reference/computedPropertyNames49_ES5.js | 7 +- .../reference/computedPropertyNames4_ES5.js | 14 +- .../reference/computedPropertyNames50_ES5.js | 7 +- .../reference/computedPropertyNames5_ES5.js | 9 +- .../reference/computedPropertyNames6_ES5.js | 6 +- .../reference/computedPropertyNames7_ES5.js | 4 +- .../reference/computedPropertyNames8_ES5.js | 5 +- .../reference/computedPropertyNames9_ES5.js | 6 +- ...mputedPropertyNamesContextualType10_ES5.js | 5 +- ...omputedPropertyNamesContextualType1_ES5.js | 4 +- ...omputedPropertyNamesContextualType2_ES5.js | 4 +- ...omputedPropertyNamesContextualType3_ES5.js | 4 +- ...omputedPropertyNamesContextualType4_ES5.js | 5 +- ...omputedPropertyNamesContextualType5_ES5.js | 5 +- ...omputedPropertyNamesContextualType6_ES5.js | 8 +- ...omputedPropertyNamesContextualType7_ES5.js | 8 +- ...omputedPropertyNamesContextualType8_ES5.js | 5 +- ...omputedPropertyNamesContextualType9_ES5.js | 5 +- ...mputedPropertyNamesDeclarationEmit5_ES5.js | 6 +- .../computedPropertyNamesSourceMap2_ES5.js | 3 +- ...computedPropertyNamesSourceMap2_ES5.js.map | 2 +- ...dPropertyNamesSourceMap2_ES5.sourcemap.txt | 65 +++--- ...constructorWithIncompleteTypeAnnotation.js | 21 +- .../reference/duplicateLocalVariable1.js | 24 +- .../reference/parser15.4.4.14-9-2.js | 5 +- .../parserES5ComputedPropertyName2.js | 4 +- .../parserES5ComputedPropertyName3.js | 3 +- .../parserES5ComputedPropertyName4.js | 3 +- .../reference/parserErrorRecovery_Block1.js | 3 +- .../parserErrorRecovery_SwitchStatement1.js | 6 +- .../parserGreaterThanTokenAmbiguity10.js | 3 +- .../parserGreaterThanTokenAmbiguity14.js | 3 +- .../parserGreaterThanTokenAmbiguity15.js | 3 +- .../parserGreaterThanTokenAmbiguity19.js | 3 +- .../parserGreaterThanTokenAmbiguity20.js | 3 +- .../parserGreaterThanTokenAmbiguity4.js | 3 +- .../parserGreaterThanTokenAmbiguity5.js | 3 +- .../parserGreaterThanTokenAmbiguity9.js | 3 +- .../baselines/reference/parserRealSource10.js | 3 +- .../baselines/reference/parserRealSource11.js | 10 +- .../baselines/reference/parserRealSource14.js | 219 ++++++++++++++---- .../baselines/reference/parserRealSource6.js | 3 +- .../baselines/reference/parserRealSource7.js | 33 ++- .../baselines/reference/parserRealSource8.js | 21 +- tests/baselines/reference/parserindenter.js | 14 +- tests/baselines/reference/privateIndexer2.js | 5 +- tests/baselines/reference/scannertest1.js | 4 +- tests/baselines/reference/targetTypeTest1.js | 7 +- .../templateStringInEqualityChecks.js | 5 +- .../templateStringInEqualityChecksES6.js | 5 +- .../thisInPropertyBoundDeclarations.js | 7 +- .../typeGuardsInConditionalExpression.js | 3 +- .../reference/unspecializedConstraints.js | 16 +- 79 files changed, 585 insertions(+), 192 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index 405a048cb48..f33bddb68cc 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3045,13 +3045,54 @@ module ts { } else { emit(node.left); - if (node.operatorToken.kind !== SyntaxKind.CommaToken) write(" "); + + if (node.operatorToken.kind !== SyntaxKind.CommaToken) { + write(" "); + } + write(tokenToString(node.operatorToken.kind)); - write(" "); + + var operatorEnd = getLineAndCharacterOfPosition(currentSourceFile, node.operatorToken.end); + var rightStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.right.pos)); + + var ondifferentLine = operatorEnd.line !== rightStart.line; + if (ondifferentLine) { + var exprStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); + var firstCharOfExpr = getFirstNonWhitespaceCharacter(exprStart.line); + var shouldIndent = rightStart.character > firstCharOfExpr; + + if (shouldIndent) { + increaseIndent(); + } + + writeLine(); + } + else { + write(" "); + } + emit(node.right); + + if (shouldIndent) { + decreaseIndent(); + } } } + function getFirstNonWhitespaceCharacter(line: number): number { + var lineStart = getLineStarts(currentSourceFile)[line]; + var text = currentSourceFile.text; + + for (var i = lineStart; i < text.length; i++) { + var ch = text.charCodeAt(i); + if (!isWhiteSpace(text.charCodeAt(i)) || isLineBreak(ch)) { + break; + } + } + + return i - lineStart; + } + function emitConditionalExpression(node: ConditionalExpression) { emit(node.condition); write(" ? "); diff --git a/tests/baselines/reference/APISample_linter.js b/tests/baselines/reference/APISample_linter.js index 5229605bdec..29bc4802f23 100644 --- a/tests/baselines/reference/APISample_linter.js +++ b/tests/baselines/reference/APISample_linter.js @@ -1998,7 +1998,8 @@ function delint(sourceFile) { if (ifStatement.thenStatement.kind !== 172 /* Block */) { report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body."); } - if (ifStatement.elseStatement && ifStatement.elseStatement.kind !== 172 /* Block */ && ifStatement.elseStatement.kind !== 176 /* IfStatement */) { + if (ifStatement.elseStatement && + ifStatement.elseStatement.kind !== 172 /* Block */ && ifStatement.elseStatement.kind !== 176 /* IfStatement */) { report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body."); } break; diff --git a/tests/baselines/reference/ES5SymbolProperty1.js b/tests/baselines/reference/ES5SymbolProperty1.js index 8cccf31e1a8..e977df7dc6b 100644 --- a/tests/baselines/reference/ES5SymbolProperty1.js +++ b/tests/baselines/reference/ES5SymbolProperty1.js @@ -12,6 +12,8 @@ obj[Symbol.foo]; //// [ES5SymbolProperty1.js] var Symbol; -var obj = (_a = {}, _a[Symbol.foo] = 0, _a); +var obj = (_a = {}, _a[Symbol.foo] = +0, +_a); obj[Symbol.foo]; var _a; diff --git a/tests/baselines/reference/FunctionDeclaration8_es6.js b/tests/baselines/reference/FunctionDeclaration8_es6.js index 64f6bff50c0..3f6d2499cef 100644 --- a/tests/baselines/reference/FunctionDeclaration8_es6.js +++ b/tests/baselines/reference/FunctionDeclaration8_es6.js @@ -2,5 +2,7 @@ var v = { [yield]: foo } //// [FunctionDeclaration8_es6.js] -var v = (_a = {}, _a[yield] = foo, _a); +var v = (_a = {}, _a[yield] = +foo, +_a); var _a; diff --git a/tests/baselines/reference/FunctionDeclaration9_es6.js b/tests/baselines/reference/FunctionDeclaration9_es6.js index bca309d2d62..04c946a96eb 100644 --- a/tests/baselines/reference/FunctionDeclaration9_es6.js +++ b/tests/baselines/reference/FunctionDeclaration9_es6.js @@ -5,6 +5,8 @@ function * foo() { //// [FunctionDeclaration9_es6.js] function foo() { - var v = (_a = {}, _a[] = foo, _a); + var v = (_a = {}, _a[] = + foo, + _a); var _a; } diff --git a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js index 188a843f751..0b786632bdf 100644 --- a/tests/baselines/reference/FunctionPropertyAssignments5_es6.js +++ b/tests/baselines/reference/FunctionPropertyAssignments5_es6.js @@ -2,5 +2,6 @@ var v = { *[foo()]() { } } //// [FunctionPropertyAssignments5_es6.js] -var v = (_a = {}, _a[foo()] = function () { }, _a); +var v = (_a = {}, _a[foo()] = function () { }, +_a); var _a; diff --git a/tests/baselines/reference/asiArith.js b/tests/baselines/reference/asiArith.js index 6d7b964c8d0..ac739bbd767 100644 --- a/tests/baselines/reference/asiArith.js +++ b/tests/baselines/reference/asiArith.js @@ -37,7 +37,9 @@ y //// [asiArith.js] var x = 1; var y = 1; -var z = x + + +y; +var z = x + ++ +y; var a = 1; var b = 1; -var c = x - - -y; +var c = x - +- -y; diff --git a/tests/baselines/reference/computedPropertyNames10_ES5.js b/tests/baselines/reference/computedPropertyNames10_ES5.js index e330db87075..ececb28b8cc 100644 --- a/tests/baselines/reference/computedPropertyNames10_ES5.js +++ b/tests/baselines/reference/computedPropertyNames10_ES5.js @@ -20,5 +20,6 @@ var v = { var s; var n; var a; -var v = (_a = {}, _a[s] = function () { }, _a[n] = function () { }, _a[s + s] = function () { }, _a[s + n] = function () { }, _a[+s] = function () { }, _a[""] = function () { }, _a[0] = function () { }, _a[a] = function () { }, _a[true] = function () { }, _a["hello bye"] = function () { }, _a["hello " + a + " bye"] = function () { }, _a); +var v = (_a = {}, _a[s] = function () { }, _a[n] = function () { }, _a[s + s] = function () { }, _a[s + n] = function () { }, _a[+s] = function () { }, _a[""] = function () { }, _a[0] = function () { }, _a[a] = function () { }, _a[true] = function () { }, _a["hello bye"] = function () { }, _a["hello " + a + " bye"] = function () { }, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.js b/tests/baselines/reference/computedPropertyNames11_ES5.js index 213b30b1a59..2ab248f22cf 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES5.js +++ b/tests/baselines/reference/computedPropertyNames11_ES5.js @@ -32,5 +32,6 @@ var v = (_a = {}, _a[s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["hello bye"] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a["hello " + a + " bye"] = Object.defineProperty({ get: function () { return 0; -}, enumerable: true, configurable: true }), _a); +}, enumerable: true, configurable: true }), +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames18_ES5.js b/tests/baselines/reference/computedPropertyNames18_ES5.js index 6e61d587f63..0ccc0fb4e00 100644 --- a/tests/baselines/reference/computedPropertyNames18_ES5.js +++ b/tests/baselines/reference/computedPropertyNames18_ES5.js @@ -7,6 +7,8 @@ function foo() { //// [computedPropertyNames18_ES5.js] function foo() { - var obj = (_a = {}, _a[this.bar] = 0, _a); + var obj = (_a = {}, _a[this.bar] = + 0, + _a); var _a; } diff --git a/tests/baselines/reference/computedPropertyNames19_ES5.js b/tests/baselines/reference/computedPropertyNames19_ES5.js index 33d0b25817c..a18cb7b95c3 100644 --- a/tests/baselines/reference/computedPropertyNames19_ES5.js +++ b/tests/baselines/reference/computedPropertyNames19_ES5.js @@ -8,6 +8,8 @@ module M { //// [computedPropertyNames19_ES5.js] var M; (function (M) { - var obj = (_a = {}, _a[this.bar] = 0, _a); + var obj = (_a = {}, _a[this.bar] = + 0, + _a); var _a; })(M || (M = {})); diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.js b/tests/baselines/reference/computedPropertyNames1_ES5.js index f31abf71051..33bb89f81a0 100644 --- a/tests/baselines/reference/computedPropertyNames1_ES5.js +++ b/tests/baselines/reference/computedPropertyNames1_ES5.js @@ -7,5 +7,6 @@ var v = { //// [computedPropertyNames1_ES5.js] var v = (_a = {}, _a[0 + 1] = Object.defineProperty({ get: function () { return 0; -}, enumerable: true, configurable: true }), _a[0 + 1] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a); +}, enumerable: true, configurable: true }), _a[0 + 1] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames20_ES5.js b/tests/baselines/reference/computedPropertyNames20_ES5.js index d9fad19e826..21af64d7e41 100644 --- a/tests/baselines/reference/computedPropertyNames20_ES5.js +++ b/tests/baselines/reference/computedPropertyNames20_ES5.js @@ -4,5 +4,7 @@ var obj = { } //// [computedPropertyNames20_ES5.js] -var obj = (_a = {}, _a[this.bar] = 0, _a); +var obj = (_a = {}, _a[this.bar] = +0, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames22_ES5.js b/tests/baselines/reference/computedPropertyNames22_ES5.js index 4dfd1286b06..e3e685aa54b 100644 --- a/tests/baselines/reference/computedPropertyNames22_ES5.js +++ b/tests/baselines/reference/computedPropertyNames22_ES5.js @@ -13,7 +13,8 @@ var C = (function () { function C() { } C.prototype.bar = function () { - var obj = (_a = {}, _a[this.bar()] = function () { }, _a); + var obj = (_a = {}, _a[this.bar()] = function () { }, + _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames23_ES5.js b/tests/baselines/reference/computedPropertyNames23_ES5.js index 33a6d95ec47..7b5a5a101a5 100644 --- a/tests/baselines/reference/computedPropertyNames23_ES5.js +++ b/tests/baselines/reference/computedPropertyNames23_ES5.js @@ -15,7 +15,9 @@ var C = (function () { C.prototype.bar = function () { return 0; }; - C.prototype[(_a = {}, _a[this.bar()] = 1, _a)[0]] = function () { }; + C.prototype[(_a = {}, _a[this.bar()] = + 1, + _a)[0]] = function () { }; return C; })(); var _a; diff --git a/tests/baselines/reference/computedPropertyNames25_ES5.js b/tests/baselines/reference/computedPropertyNames25_ES5.js index 97a43c7cacb..bd2212b72b3 100644 --- a/tests/baselines/reference/computedPropertyNames25_ES5.js +++ b/tests/baselines/reference/computedPropertyNames25_ES5.js @@ -34,7 +34,8 @@ var C = (function (_super) { _super.apply(this, arguments); } C.prototype.foo = function () { - var obj = (_a = {}, _a[_super.prototype.bar.call(this)] = function () { }, _a); + var obj = (_a = {}, _a[_super.prototype.bar.call(this)] = function () { }, + _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames26_ES5.js b/tests/baselines/reference/computedPropertyNames26_ES5.js index 60f6590be9d..5df2f6dc1b6 100644 --- a/tests/baselines/reference/computedPropertyNames26_ES5.js +++ b/tests/baselines/reference/computedPropertyNames26_ES5.js @@ -34,7 +34,9 @@ var C = (function (_super) { } // Gets emitted as super, not _super, which is consistent with // use of super in static properties initializers. - C.prototype[(_a = {}, _a[super.bar.call(this)] = 1, _a)[0]] = function () { }; + C.prototype[(_a = {}, _a[super.bar.call(this)] = + 1, + _a)[0]] = function () { }; return C; })(Base); var _a; diff --git a/tests/baselines/reference/computedPropertyNames28_ES5.js b/tests/baselines/reference/computedPropertyNames28_ES5.js index 3d9a343fcdb..7e548d4d6d3 100644 --- a/tests/baselines/reference/computedPropertyNames28_ES5.js +++ b/tests/baselines/reference/computedPropertyNames28_ES5.js @@ -26,7 +26,8 @@ var C = (function (_super) { __extends(C, _super); function C() { _super.call(this); - var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, _a); + var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, + _a); var _a; } return C; diff --git a/tests/baselines/reference/computedPropertyNames29_ES5.js b/tests/baselines/reference/computedPropertyNames29_ES5.js index ea9a9b1b635..27c7cd97988 100644 --- a/tests/baselines/reference/computedPropertyNames29_ES5.js +++ b/tests/baselines/reference/computedPropertyNames29_ES5.js @@ -17,7 +17,8 @@ var C = (function () { C.prototype.bar = function () { var _this = this; (function () { - var obj = (_a = {}, _a[_this.bar()] = function () { }, _a); + var obj = (_a = {}, _a[_this.bar()] = function () { }, + _a); var _a; }); return 0; diff --git a/tests/baselines/reference/computedPropertyNames30_ES5.js b/tests/baselines/reference/computedPropertyNames30_ES5.js index 06a63dd7565..505b149f62d 100644 --- a/tests/baselines/reference/computedPropertyNames30_ES5.js +++ b/tests/baselines/reference/computedPropertyNames30_ES5.js @@ -32,7 +32,8 @@ var C = (function (_super) { function C() { _super.call(this); (function () { - var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, _a); + var obj = (_a = {}, _a[(_super.call(this), "prop")] = function () { }, + _a); var _a; }); } diff --git a/tests/baselines/reference/computedPropertyNames31_ES5.js b/tests/baselines/reference/computedPropertyNames31_ES5.js index a6db55259d5..0c8cbac455f 100644 --- a/tests/baselines/reference/computedPropertyNames31_ES5.js +++ b/tests/baselines/reference/computedPropertyNames31_ES5.js @@ -38,7 +38,8 @@ var C = (function (_super) { C.prototype.foo = function () { var _this = this; (function () { - var obj = (_a = {}, _a[_super.prototype.bar.call(_this)] = function () { }, _a); + var obj = (_a = {}, _a[_super.prototype.bar.call(_this)] = function () { }, + _a); var _a; }); return 0; diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.js b/tests/baselines/reference/computedPropertyNames33_ES5.js index 92e6456f3ba..80aed7f11a4 100644 --- a/tests/baselines/reference/computedPropertyNames33_ES5.js +++ b/tests/baselines/reference/computedPropertyNames33_ES5.js @@ -17,7 +17,8 @@ var C = (function () { function C() { } C.prototype.bar = function () { - var obj = (_a = {}, _a[foo()] = function () { }, _a); + var obj = (_a = {}, _a[foo()] = function () { }, + _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames34_ES5.js b/tests/baselines/reference/computedPropertyNames34_ES5.js index da9789c0d70..dbe3ac98e41 100644 --- a/tests/baselines/reference/computedPropertyNames34_ES5.js +++ b/tests/baselines/reference/computedPropertyNames34_ES5.js @@ -17,7 +17,8 @@ var C = (function () { function C() { } C.bar = function () { - var obj = (_a = {}, _a[foo()] = function () { }, _a); + var obj = (_a = {}, _a[foo()] = function () { }, + _a); return 0; var _a; }; diff --git a/tests/baselines/reference/computedPropertyNames46_ES5.js b/tests/baselines/reference/computedPropertyNames46_ES5.js index 8919b0389aa..3e4329b8a20 100644 --- a/tests/baselines/reference/computedPropertyNames46_ES5.js +++ b/tests/baselines/reference/computedPropertyNames46_ES5.js @@ -4,5 +4,7 @@ var o = { }; //// [computedPropertyNames46_ES5.js] -var o = (_a = {}, _a["" || 0] = 0, _a); +var o = (_a = {}, _a["" || 0] = +0, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames47_ES5.js b/tests/baselines/reference/computedPropertyNames47_ES5.js index 26add5173a9..7874a25976f 100644 --- a/tests/baselines/reference/computedPropertyNames47_ES5.js +++ b/tests/baselines/reference/computedPropertyNames47_ES5.js @@ -14,5 +14,7 @@ var E2; (function (E2) { E2[E2["x"] = 0] = "x"; })(E2 || (E2 = {})); -var o = (_a = {}, _a[0 /* x */ || 0 /* x */] = 0, _a); +var o = (_a = {}, _a[0 /* x */ || 0 /* x */] = +0, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames48_ES5.js b/tests/baselines/reference/computedPropertyNames48_ES5.js index 66c0336767f..f3f9941aeae 100644 --- a/tests/baselines/reference/computedPropertyNames48_ES5.js +++ b/tests/baselines/reference/computedPropertyNames48_ES5.js @@ -23,7 +23,13 @@ var E; E[E["x"] = 0] = "x"; })(E || (E = {})); var a; -extractIndexer((_a = {}, _a[a] = "", _a)); // Should return string -extractIndexer((_b = {}, _b[0 /* x */] = "", _b)); // Should return string -extractIndexer((_c = {}, _c["" || 0] = "", _c)); // Should return any (widened form of undefined) +extractIndexer((_a = {}, _a[a] = +"", +_a)); // Should return string +extractIndexer((_b = {}, _b[0 /* x */] = +"", +_b)); // Should return string +extractIndexer((_c = {}, _c["" || 0] = +"", +_c)); // Should return any (widened form of undefined) var _a, _b, _c; diff --git a/tests/baselines/reference/computedPropertyNames49_ES5.js b/tests/baselines/reference/computedPropertyNames49_ES5.js index 418bd070457..8aefd49a4a8 100644 --- a/tests/baselines/reference/computedPropertyNames49_ES5.js +++ b/tests/baselines/reference/computedPropertyNames49_ES5.js @@ -28,7 +28,8 @@ var x = { //// [computedPropertyNames49_ES5.js] var x = (_a = { p1: 10 -}, _a.p1 = 10, _a[1 + 1] = Object.defineProperty({ get: function () { +}, _a.p1 = +10, _a[1 + 1] = Object.defineProperty({ get: function () { throw 10; }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { return 10; @@ -39,5 +40,7 @@ var x = (_a = { if (1 == 1) { return 10; } -}, enumerable: true, configurable: true }), _a.p2 = 20, _a); +}, enumerable: true, configurable: true }), _a.p2 = +20, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames4_ES5.js b/tests/baselines/reference/computedPropertyNames4_ES5.js index 60cdefc36ee..255b14eb970 100644 --- a/tests/baselines/reference/computedPropertyNames4_ES5.js +++ b/tests/baselines/reference/computedPropertyNames4_ES5.js @@ -20,5 +20,17 @@ var v = { var s; var n; var a; -var v = (_a = {}, _a[s] = 0, _a[n] = n, _a[s + s] = 1, _a[s + n] = 2, _a[+s] = s, _a[""] = 0, _a[0] = 0, _a[a] = 1, _a[true] = 0, _a["hello bye"] = 0, _a["hello " + a + " bye"] = 0, _a); +var v = (_a = {}, _a[s] = +0, _a[n] = +n, _a[s + s] = +1, _a[s + n] = +2, _a[+s] = +s, _a[""] = +0, _a[0] = +0, _a[a] = +1, _a[true] = +0, _a["hello bye"] = +0, _a["hello " + a + " bye"] = +0, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames50_ES5.js b/tests/baselines/reference/computedPropertyNames50_ES5.js index 90c2d2668d7..e0fd3dfbcd7 100644 --- a/tests/baselines/reference/computedPropertyNames50_ES5.js +++ b/tests/baselines/reference/computedPropertyNames50_ES5.js @@ -33,7 +33,8 @@ var x = (_a = { return 10; } } -}, _a.p1 = 10, _a.foo = Object.defineProperty({ get: function () { +}, _a.p1 = +10, _a.foo = Object.defineProperty({ get: function () { if (1 == 1) { return 10; } @@ -44,5 +45,7 @@ var x = (_a = { throw 10; }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { return 10; -}, enumerable: true, configurable: true }), _a.p2 = 20, _a); +}, enumerable: true, configurable: true }), _a.p2 = +20, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames5_ES5.js b/tests/baselines/reference/computedPropertyNames5_ES5.js index adf9b86aa1b..722c0f3a74d 100644 --- a/tests/baselines/reference/computedPropertyNames5_ES5.js +++ b/tests/baselines/reference/computedPropertyNames5_ES5.js @@ -11,5 +11,12 @@ var v = { //// [computedPropertyNames5_ES5.js] var b; -var v = (_a = {}, _a[b] = 0, _a[true] = 1, _a[[]] = 0, _a[{}] = 0, _a[undefined] = undefined, _a[null] = null, _a); +var v = (_a = {}, _a[b] = +0, _a[true] = +1, _a[[]] = +0, _a[{}] = +0, _a[undefined] = +undefined, _a[null] = +null, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames6_ES5.js b/tests/baselines/reference/computedPropertyNames6_ES5.js index b42b2091c22..4e3ed1b2e9f 100644 --- a/tests/baselines/reference/computedPropertyNames6_ES5.js +++ b/tests/baselines/reference/computedPropertyNames6_ES5.js @@ -12,5 +12,9 @@ var v = { var p1; var p2; var p3; -var v = (_a = {}, _a[p1] = 0, _a[p2] = 1, _a[p3] = 2, _a); +var v = (_a = {}, _a[p1] = +0, _a[p2] = +1, _a[p3] = +2, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames7_ES5.js b/tests/baselines/reference/computedPropertyNames7_ES5.js index 9d9ac41ace1..3e1bcc1151c 100644 --- a/tests/baselines/reference/computedPropertyNames7_ES5.js +++ b/tests/baselines/reference/computedPropertyNames7_ES5.js @@ -11,5 +11,7 @@ var E; (function (E) { E[E["member"] = 0] = "member"; })(E || (E = {})); -var v = (_a = {}, _a[0 /* member */] = 0, _a); +var v = (_a = {}, _a[0 /* member */] = +0, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames8_ES5.js b/tests/baselines/reference/computedPropertyNames8_ES5.js index 0c5b5047d85..4db9ed2ec13 100644 --- a/tests/baselines/reference/computedPropertyNames8_ES5.js +++ b/tests/baselines/reference/computedPropertyNames8_ES5.js @@ -12,6 +12,9 @@ function f() { function f() { var t; var u; - var v = (_a = {}, _a[t] = 0, _a[u] = 1, _a); + var v = (_a = {}, _a[t] = + 0, _a[u] = + 1, + _a); var _a; } diff --git a/tests/baselines/reference/computedPropertyNames9_ES5.js b/tests/baselines/reference/computedPropertyNames9_ES5.js index f52a7d51f25..a7c4a74d5ec 100644 --- a/tests/baselines/reference/computedPropertyNames9_ES5.js +++ b/tests/baselines/reference/computedPropertyNames9_ES5.js @@ -12,5 +12,9 @@ var v = { //// [computedPropertyNames9_ES5.js] function f(x) { } -var v = (_a = {}, _a[f("")] = 0, _a[f(0)] = 0, _a[f(true)] = 0, _a); +var v = (_a = {}, _a[f("")] = +0, _a[f(0)] = +0, _a[f(true)] = +0, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js index 416e4746bee..5ea05124674 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType10_ES5.js @@ -9,5 +9,8 @@ var o: I = { } //// [computedPropertyNamesContextualType10_ES5.js] -var o = (_a = {}, _a[+"foo"] = "", _a[+"bar"] = 0, _a); +var o = (_a = {}, _a[+"foo"] = +"", _a[+"bar"] = +0, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js index 67121a627d1..fda2295c343 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js @@ -12,5 +12,7 @@ var o: I = { //// [computedPropertyNamesContextualType1_ES5.js] var o = (_a = {}, _a["" + 0] = function (y) { return y.length; -}, _a["" + 1] = function (y) { return y.length; }, _a); +}, _a["" + 1] = +function (y) { return y.length; }, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js index 3bea2d75ee0..1cf729eb3b0 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js @@ -12,5 +12,7 @@ var o: I = { //// [computedPropertyNamesContextualType2_ES5.js] var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; -}, _a[+"bar"] = function (y) { return y.length; }, _a); +}, _a[+"bar"] = +function (y) { return y.length; }, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js index 320a4cf1063..bc85e065418 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js @@ -11,5 +11,7 @@ var o: I = { //// [computedPropertyNamesContextualType3_ES5.js] var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; -}, _a[+"bar"] = function (y) { return y.length; }, _a); +}, _a[+"bar"] = +function (y) { return y.length; }, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js index 11d43546b89..b813da30496 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType4_ES5.js @@ -10,5 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType4_ES5.js] -var o = (_a = {}, _a["" + "foo"] = "", _a["" + "bar"] = 0, _a); +var o = (_a = {}, _a["" + "foo"] = +"", _a["" + "bar"] = +0, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js index 313bb87e402..f75389de3e9 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType5_ES5.js @@ -10,5 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType5_ES5.js] -var o = (_a = {}, _a[+"foo"] = "", _a[+"bar"] = 0, _a); +var o = (_a = {}, _a[+"foo"] = +"", _a[+"bar"] = +0, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js index 5500ac0863b..bc724320d14 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType6_ES5.js @@ -17,5 +17,11 @@ foo({ foo((_a = { p: "", 0: function () { } -}, _a.p = "", _a[0] = function () { }, _a["hi" + "bye"] = true, _a[0 + 1] = 0, _a[+"hi"] = [0], _a)); +}, _a.p = +"", _a[0] = +function () { }, _a["hi" + "bye"] = +true, _a[0 + 1] = +0, _a[+"hi"] = +[0], +_a)); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js index f87c5151ab3..8d2386a1d14 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType7_ES5.js @@ -17,5 +17,11 @@ foo({ foo((_a = { p: "", 0: function () { } -}, _a.p = "", _a[0] = function () { }, _a["hi" + "bye"] = true, _a[0 + 1] = 0, _a[+"hi"] = [0], _a)); +}, _a.p = +"", _a[0] = +function () { }, _a["hi" + "bye"] = +true, _a[0 + 1] = +0, _a[+"hi"] = +[0], +_a)); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js index ed6bc81cebb..626f3d1a8e2 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType8_ES5.js @@ -10,5 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType8_ES5.js] -var o = (_a = {}, _a["" + "foo"] = "", _a["" + "bar"] = 0, _a); +var o = (_a = {}, _a["" + "foo"] = +"", _a["" + "bar"] = +0, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js index 7194742f1d2..c28db4ded97 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType9_ES5.js @@ -10,5 +10,8 @@ var o: I = { } //// [computedPropertyNamesContextualType9_ES5.js] -var o = (_a = {}, _a[+"foo"] = "", _a[+"bar"] = 0, _a); +var o = (_a = {}, _a[+"foo"] = +"", _a[+"bar"] = +0, +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js index 4ffdca51f09..4da90756478 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js @@ -7,9 +7,11 @@ var v = { } //// [computedPropertyNamesDeclarationEmit5_ES5.js] -var v = (_a = {}, _a["" + ""] = 0, _a["" + ""] = function () { }, _a["" + ""] = Object.defineProperty({ get: function () { +var v = (_a = {}, _a["" + ""] = +0, _a["" + ""] = function () { }, _a["" + ""] = Object.defineProperty({ get: function () { return 0; -}, enumerable: true, configurable: true }), _a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }), _a); +}, enumerable: true, configurable: true }), _a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }), +_a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js index d01778ff90d..c5af22ef398 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js @@ -8,6 +8,7 @@ var v = { //// [computedPropertyNamesSourceMap2_ES5.js] var v = (_a = {}, _a["hello"] = function () { debugger; -}, _a); +}, +_a); var _a; //# sourceMappingURL=computedPropertyNamesSourceMap2_ES5.js.map \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map index 9a6e38deda4..82a729df957 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.js.map @@ -1,2 +1,2 @@ //// [computedPropertyNamesSourceMap2_ES5.js.map] -{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CACA,EAAA,GADA,EAAA,EACA,EAAA,CACK,OAAO,CAFA,GAAA;IAGA,QAAQ,CAAC;AACb,CAAC,AAJA,EACA,EAAA,AADA,CAKA,CAAA;IAJD,EAAA"} \ No newline at end of file +{"version":3,"file":"computedPropertyNamesSourceMap2_ES5.js","sourceRoot":"","sources":["computedPropertyNamesSourceMap2_ES5.ts"],"names":[],"mappings":"AAAA,IAAI,CAAC,GAAG,AADA,CACA,EAAA,GADA,EAAA,EACA,EAAA,CACK,OAAO,CAFA,GAAA;IAGA,QAAQ,CAAC;AACb,CAAC,AAJA;AACA,EAAA,AADA,CAKA,CAAA;IAJD,EAAA"} \ No newline at end of file diff --git a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt index 068eded06cd..33a3a2b4c2c 100644 --- a/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt +++ b/tests/baselines/reference/computedPropertyNamesSourceMap2_ES5.sourcemap.txt @@ -95,16 +95,11 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts 2 >Emitted(2, 13) Source(3, 17) + SourceIndex(0) 3 >Emitted(2, 14) Source(3, 18) + SourceIndex(0) --- ->>>}, _a); +>>>}, 1 > 2 >^ 3 > -4 > ^^ -5 > ^^ -6 > -7 > ^ -8 > ^ -9 > ^-> +4 > ^^^^-> 1 >!!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found 1 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(1, 33) Source(0, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 1) Source(4, 5) + SourceIndex(0) nameIndex (-1) 1 > @@ -115,42 +110,50 @@ sourceFile:computedPropertyNamesSourceMap2_ES5.ts 3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: 3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 5) Source(3, 21) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 2) Source(0, NaN) + SourceIndex(0) nameIndex (-1) 3 > -4 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 13) Source(3, 29) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 4) Source(1, 1) + SourceIndex(0) nameIndex (-1) -4 > -5 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 14) Source(3, 30) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 6) Source(1, 1) + SourceIndex(0) nameIndex (-1) -5 > -6 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -6 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 1) Source(4, 17) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 6) Source(0, NaN) + SourceIndex(0) nameIndex (-1) -6 > -7 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -7 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(4, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 7) Source(5, 2) + SourceIndex(0) nameIndex (-1) -7 > -8 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found -8 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(3, 8) Source(5, 2) + SourceIndex(0) nameIndex (-1) -8 > 1 >Emitted(3, 1) Source(4, 5) + SourceIndex(0) 2 >Emitted(3, 2) Source(4, 6) + SourceIndex(0) 3 >Emitted(3, 2) Source(0, NaN) + SourceIndex(0) -4 >Emitted(3, 4) Source(1, 1) + SourceIndex(0) -5 >Emitted(3, 6) Source(1, 1) + SourceIndex(0) -6 >Emitted(3, 6) Source(0, NaN) + SourceIndex(0) -7 >Emitted(3, 7) Source(5, 2) + SourceIndex(0) -8 >Emitted(3, 8) Source(5, 2) + SourceIndex(0) +--- +>>>_a); +1-> +2 >^^ +3 > +4 > ^ +5 > ^ +6 > ^^^^-> +1->!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 13) Source(3, 29) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 1) Source(1, 1) + SourceIndex(0) nameIndex (-1) +1-> +2 >!!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +2 >!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(2, 14) Source(3, 30) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 3) Source(1, 1) + SourceIndex(0) nameIndex (-1) +2 > +3 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +3 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 1) Source(4, 17) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 3) Source(0, NaN) + SourceIndex(0) nameIndex (-1) +3 > +4 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: +4 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(4, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 4) Source(5, 2) + SourceIndex(0) nameIndex (-1) +4 > +5 > !!^^ !!^^ There was decoding error in the sourcemap at this location: Invalid sourceLine found +5 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(5, 2) + SourceIndex(0) nameIndex (-1) +5 > +1->Emitted(4, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(4, 3) Source(1, 1) + SourceIndex(0) +3 >Emitted(4, 3) Source(0, NaN) + SourceIndex(0) +4 >Emitted(4, 4) Source(5, 2) + SourceIndex(0) +5 >Emitted(4, 5) Source(5, 2) + SourceIndex(0) --- >>>var _a; 1->^^^^ 2 > ^^ 3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> 1->!!^^ !!^^ There was decoding error in the sourcemap at this location: Unsupported Error Format: No entries after emitted column -1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) +1->!!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 2) Source(0, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 5) Source(1, 1) + SourceIndex(0) nameIndex (-1) 1-> 2 > !!^^ !!^^ The decoded span from sourcemap's mapping entry does not match what was encoded for this span: -2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(3, 4) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(4, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1) +2 > !!^^ !!^^ Decoded span from sourcemap's mappings entry: Emitted(4, 1) Source(1, 18) + SourceIndex(0) nameIndex (-1) Span encoded by the emitter:Emitted(5, 7) Source(1, 1) + SourceIndex(0) nameIndex (-1) 2 > -1->Emitted(4, 5) Source(1, 1) + SourceIndex(0) -2 >Emitted(4, 7) Source(1, 1) + SourceIndex(0) +1->Emitted(5, 5) Source(1, 1) + SourceIndex(0) +2 >Emitted(5, 7) Source(1, 1) + SourceIndex(0) --- !!!! **** There are more source map entries in the sourceMap's mapping than what was encoded !!!! **** Remaining decoded string: ,EAAA,AADA,CAKA,CAAA;IAJD,EAAA diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js index 86338c1d913..829750d4e33 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.js @@ -314,10 +314,12 @@ var TypeScriptAllInOne; Program.prototype.if = function (retValue) { if (retValue === void 0) { retValue = != 0; } return 1; - ^ retValue; + ^ + retValue; bfs.TYPES(); if (retValue != 0) { - return 1 && ; + return 1 && + ; } retValue = bfs.OPERATOR; ' );; @@ -348,7 +350,8 @@ var BasicFeatures = (function () { BasicFeatures.prototype.VARIABLES = function () { var local = Number.MAX_VALUE; var min = Number.MIN_VALUE; - var inf = Number.NEGATIVE_INFINITY - ; + var inf = Number.NEGATIVE_INFINITY - + ; var nan = Number.NaN; var undef = undefined; var _\uD4A5\u7204\uC316, uE59F = local; @@ -357,7 +360,8 @@ var BasicFeatures = (function () { var local6 = local5 instanceof fs.File; var hex = 0xBADC0DE, Hex = 0XDEADBEEF; var float = 6.02e23, float2 = 6.02E-23; - var char = 'c', \u0066 = '\u0066', hexchar = '\x42' != ; + var char = 'c', \u0066 = '\u0066', hexchar = '\x42' != + ; var quoted = '"', quoted2 = "'"; var reg = /\w*/; var objLit = { "var": number = 42, equals: function (x) { @@ -366,7 +370,8 @@ var BasicFeatures = (function () { var weekday = 0 /* Monday */; var con = char + f + hexchar + float.toString() + float2.toString() + reg.toString() + objLit + weekday; // - var any = 0 ^= ; + var any = 0 ^= + ; var bool = 0; var declare = 0; var constructor = 0; @@ -382,7 +387,8 @@ var BasicFeatures = (function () { var public = 0; var set = 0; var static = 0; - var string = 0 / > ; + var string = 0 / > + ; var yield = 0; var sum3 = any + bool + declare + constructor + get + implements + interface + let + module + number + package + private + protected + public + set + static + string + yield; return 0; @@ -545,7 +551,8 @@ while () : string, ; rest: string[]; { - & public; + & + public; DefaultValue(value ? : string = "Hello"); { } } diff --git a/tests/baselines/reference/duplicateLocalVariable1.js b/tests/baselines/reference/duplicateLocalVariable1.js index cace580eea1..6acb95281d1 100644 --- a/tests/baselines/reference/duplicateLocalVariable1.js +++ b/tests/baselines/reference/duplicateLocalVariable1.js @@ -436,22 +436,38 @@ exports.tests = (function () { })); // File pattern matching tests testRunner.addTest(new TestCase("Check text file match", function () { - return (FileManager.FileBuffer.isTextFile("C:\\somedir\\readme.txt") && FileManager.FileBuffer.isTextFile("C:\\spaces path\\myapp.str") && FileManager.FileBuffer.isTextFile("C:\\somedir\\code.js")); + return (FileManager.FileBuffer.isTextFile("C:\\somedir\\readme.txt") && + FileManager.FileBuffer.isTextFile("C:\\spaces path\\myapp.str") && + FileManager.FileBuffer.isTextFile("C:\\somedir\\code.js")); })); testRunner.addTest(new TestCase("Check makefile match", function () { return FileManager.FileBuffer.isTextFile("C:\\some dir\\makefile"); })); testRunner.addTest(new TestCase("Check binary file doesn't match", function () { - return (!FileManager.FileBuffer.isTextFile("C:\\somedir\\app.exe") && !FileManager.FileBuffer.isTextFile("C:\\somedir\\my lib.dll")); + return (!FileManager.FileBuffer.isTextFile("C:\\somedir\\app.exe") && + !FileManager.FileBuffer.isTextFile("C:\\somedir\\my lib.dll")); })); // Command-line parameter tests testRunner.addTest(new TestCase("Check App defaults", function () { var app = new App.App([]); - return (app.fixLines === false && app.recurse === true && app.lineEndings === "CRLF" && app.matchPattern === undefined && app.rootDirectory === ".\\" && app.encodings[0] === "ascii" && app.encodings[1] === "utf8nobom"); + return (app.fixLines === false && + app.recurse === true && + app.lineEndings === "CRLF" && + app.matchPattern === undefined && + app.rootDirectory === ".\\" && + app.encodings[0] === "ascii" && + app.encodings[1] === "utf8nobom"); })); testRunner.addTest(new TestCase("Check App params", function () { var app = new App.App(["-dir=C:\\test dir", "-lineEndings=LF", "-encodings=utf16be,ascii", "-recurse=false", "-fixlines"]); - return (app.fixLines === true && app.lineEndings === "LF" && app.recurse === false && app.matchPattern === undefined && app.rootDirectory === "C:\\test dir" && app.encodings[0] === "utf16be" && app.encodings[1] === "ascii" && app.encodings.length === 2); + return (app.fixLines === true && + app.lineEndings === "LF" && + app.recurse === false && + app.matchPattern === undefined && + app.rootDirectory === "C:\\test dir" && + app.encodings[0] === "utf16be" && + app.encodings[1] === "ascii" && + app.encodings.length === 2); })); // File BOM detection tests testRunner.addTest(new TestCase("Check encoding detection no BOM", function () { diff --git a/tests/baselines/reference/parser15.4.4.14-9-2.js b/tests/baselines/reference/parser15.4.4.14-9-2.js index 9680dbff36b..4f2416b6f4a 100644 --- a/tests/baselines/reference/parser15.4.4.14-9-2.js +++ b/tests/baselines/reference/parser15.4.4.14-9-2.js @@ -43,7 +43,10 @@ function testcase() { var one = 1; var _float = -(4 / 3); var a = new Array(false, undefined, null, "0", obj, -1.3333333333333, "str", -0, true, +0, one, 1, 0, false, _float, -(4 / 3)); - if (a.indexOf(-(4 / 3)) === 14 && a.indexOf(0) === 7 && a.indexOf(-0) === 7 && a.indexOf(1) === 10) { + if (a.indexOf(-(4 / 3)) === 14 && + a.indexOf(0) === 7 && + a.indexOf(-0) === 7 && + a.indexOf(1) === 10) { return true; } } diff --git a/tests/baselines/reference/parserES5ComputedPropertyName2.js b/tests/baselines/reference/parserES5ComputedPropertyName2.js index 4569c00d7b3..2b39e305e07 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName2.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName2.js @@ -2,5 +2,7 @@ var v = { [e]: 1 }; //// [parserES5ComputedPropertyName2.js] -var v = (_a = {}, _a[e] = 1, _a); +var v = (_a = {}, _a[e] = +1, +_a); var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName3.js b/tests/baselines/reference/parserES5ComputedPropertyName3.js index 1fdb5ced65d..3247b0251f1 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName3.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName3.js @@ -2,5 +2,6 @@ var v = { [e]() { } }; //// [parserES5ComputedPropertyName3.js] -var v = (_a = {}, _a[e] = function () { }, _a); +var v = (_a = {}, _a[e] = function () { }, +_a); var _a; diff --git a/tests/baselines/reference/parserES5ComputedPropertyName4.js b/tests/baselines/reference/parserES5ComputedPropertyName4.js index 3271fa41207..436f967e8de 100644 --- a/tests/baselines/reference/parserES5ComputedPropertyName4.js +++ b/tests/baselines/reference/parserES5ComputedPropertyName4.js @@ -2,5 +2,6 @@ var v = { get [e]() { } }; //// [parserES5ComputedPropertyName4.js] -var v = (_a = {}, _a[e] = Object.defineProperty({ get: function () { }, enumerable: true, configurable: true }), _a); +var v = (_a = {}, _a[e] = Object.defineProperty({ get: function () { }, enumerable: true, configurable: true }), +_a); var _a; diff --git a/tests/baselines/reference/parserErrorRecovery_Block1.js b/tests/baselines/reference/parserErrorRecovery_Block1.js index cdcd5856fa6..e2bc5f89a39 100644 --- a/tests/baselines/reference/parserErrorRecovery_Block1.js +++ b/tests/baselines/reference/parserErrorRecovery_Block1.js @@ -6,6 +6,7 @@ function f() { //// [parserErrorRecovery_Block1.js] function f() { - 1 + ; + 1 + + ; return; } diff --git a/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js b/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js index 63591985d1e..4d8008639c9 100644 --- a/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js +++ b/tests/baselines/reference/parserErrorRecovery_SwitchStatement1.js @@ -10,8 +10,10 @@ switch (e) { //// [parserErrorRecovery_SwitchStatement1.js] switch (e) { case 1: - 1 + ; + 1 + + ; case 2: - 1 + ; + 1 + + ; default: } diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js index 4ff1f26d890..766c95632ab 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity10.js @@ -5,4 +5,5 @@ 2; //// [parserGreaterThanTokenAmbiguity10.js] -1 >>> 2; +1 >>> +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js index 5cc8bb3b88e..b2eba6d5873 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity14.js @@ -3,5 +3,6 @@ = 2; //// [parserGreaterThanTokenAmbiguity14.js] -1 >> ; +1 >> +; 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js index df9e55b7e3c..8675365d9ea 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity15.js @@ -5,4 +5,5 @@ 2; //// [parserGreaterThanTokenAmbiguity15.js] -1 >>= 2; +1 >>= +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js index 52035691c84..d0671d8649f 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity19.js @@ -3,5 +3,6 @@ = 2; //// [parserGreaterThanTokenAmbiguity19.js] -1 >>> ; +1 >>> +; 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js index e6043febcd1..e190e94e9f9 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity20.js @@ -5,4 +5,5 @@ 2; //// [parserGreaterThanTokenAmbiguity20.js] -1 >>>= 2; +1 >>>= +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js index 5ef065681dc..c0b8fc45cc1 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity4.js @@ -3,4 +3,5 @@ > 2; //// [parserGreaterThanTokenAmbiguity4.js] -1 > > 2; +1 > + > 2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js index a707e808b4a..59d13d5c9d3 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity5.js @@ -5,4 +5,5 @@ 2; //// [parserGreaterThanTokenAmbiguity5.js] -1 >> 2; +1 >> +2; diff --git a/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js b/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js index 25c5ed53a7c..757ddf38a7f 100644 --- a/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js +++ b/tests/baselines/reference/parserGreaterThanTokenAmbiguity9.js @@ -3,4 +3,5 @@ > 2; //// [parserGreaterThanTokenAmbiguity9.js] -1 >> > 2; +1 >> + > 2; diff --git a/tests/baselines/reference/parserRealSource10.js b/tests/baselines/reference/parserRealSource10.js index 0dd944a7721..768e35c1a3b 100644 --- a/tests/baselines/reference/parserRealSource10.js +++ b/tests/baselines/reference/parserRealSource10.js @@ -813,7 +813,8 @@ var TypeScript; else { var tokenInfo = lookupToken(this.tokenId); if (tokenInfo != undefined) { - if ((tokenInfo.unopNodeType != NodeType.None) || (tokenInfo.binopNodeType != NodeType.None)) { + if ((tokenInfo.unopNodeType != NodeType.None) || + (tokenInfo.binopNodeType != NodeType.None)) { return 2 /* Operator */; } } diff --git a/tests/baselines/reference/parserRealSource11.js b/tests/baselines/reference/parserRealSource11.js index 0574c52eaaa..685bf654d81 100644 --- a/tests/baselines/reference/parserRealSource11.js +++ b/tests/baselines/reference/parserRealSource11.js @@ -2496,7 +2496,8 @@ var TypeScript; if (context.parser !== null) { context.parser.getSourceLineCol(lineCol, this.minChar); context.parser.getSourceLineCol(limLineCol, this.limChar); - context.write("(" + lineCol.line + "," + lineCol.col + ")--" + "(" + limLineCol.line + "," + limLineCol.col + "): "); + context.write("(" + lineCol.line + "," + lineCol.col + ")--" + + "(" + limLineCol.line + "," + limLineCol.col + "): "); } var lab = this.printLabel(); if (hasFlag(this.flags, ASTFlags.Error)) { @@ -4093,13 +4094,16 @@ var TypeScript; var target = cond.target; if (target.nodeType == NodeType.Dot) { var binex = target; - if ((binex.operand1.nodeType == NodeType.Name) && (this.obj.nodeType == NodeType.Name) && (binex.operand1.actualText == this.obj.actualText)) { + if ((binex.operand1.nodeType == NodeType.Name) && + (this.obj.nodeType == NodeType.Name) && + (binex.operand1.actualText == this.obj.actualText)) { var prop = binex.operand2; if (prop.actualText == "hasOwnProperty") { var args = cond.arguments; if ((args !== null) && (args.members.length == 1)) { var arg = args.members[0]; - if ((arg.nodeType == NodeType.Name) && (this.lval.nodeType == NodeType.Name)) { + if ((arg.nodeType == NodeType.Name) && + (this.lval.nodeType == NodeType.Name)) { if ((this.lval.actualText) == arg.actualText) { return true; } diff --git a/tests/baselines/reference/parserRealSource14.js b/tests/baselines/reference/parserRealSource14.js index 9b9ee2bcf84..159a0f23213 100644 --- a/tests/baselines/reference/parserRealSource14.js +++ b/tests/baselines/reference/parserRealSource14.js @@ -658,167 +658,288 @@ var TypeScript; AstPath.prototype.isNameOfClass = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.ClassDeclaration) && (this.parent().name === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.ClassDeclaration) && + (this.parent().name === this.ast()); }; AstPath.prototype.isNameOfInterface = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.InterfaceDeclaration) && (this.parent().name === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.InterfaceDeclaration) && + (this.parent().name === this.ast()); }; AstPath.prototype.isNameOfArgument = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.ArgDecl) && (this.parent().id === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.ArgDecl) && + (this.parent().id === this.ast()); }; AstPath.prototype.isNameOfVariable = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.VarDecl) && (this.parent().id === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.VarDecl) && + (this.parent().id === this.ast()); }; AstPath.prototype.isNameOfModule = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.ModuleDeclaration) && (this.parent().name === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.ModuleDeclaration) && + (this.parent().name === this.ast()); }; AstPath.prototype.isNameOfFunction = function () { if (this.ast() === null || this.parent() === null) return false; - return (this.ast().nodeType === TypeScript.NodeType.Name) && (this.parent().nodeType === TypeScript.NodeType.FuncDecl) && (this.parent().name === this.ast()); + return (this.ast().nodeType === TypeScript.NodeType.Name) && + (this.parent().nodeType === TypeScript.NodeType.FuncDecl) && + (this.parent().name === this.ast()); }; AstPath.prototype.isChildOfScript = function () { var ast = lastOf(this.asts); - return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.Script; + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.Script; }; AstPath.prototype.isChildOfModule = function () { var ast = lastOf(this.asts); - return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.ModuleDeclaration; + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.ModuleDeclaration; }; AstPath.prototype.isChildOfClass = function () { var ast = lastOf(this.asts); - return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.ClassDeclaration; + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.ClassDeclaration; }; AstPath.prototype.isArgumentOfClassConstructor = function () { var ast = lastOf(this.asts); - return this.count() >= 5 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 3].nodeType === TypeScript.NodeType.List && this.asts[this.top - 4].nodeType === TypeScript.NodeType.ClassDeclaration && (this.asts[this.top - 2].isConstructor) && (this.asts[this.top - 2].arguments === this.asts[this.top - 1]) && (this.asts[this.top - 4].constructorDecl === this.asts[this.top - 2]); + return this.count() >= 5 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && + this.asts[this.top - 3].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 4].nodeType === TypeScript.NodeType.ClassDeclaration && + (this.asts[this.top - 2].isConstructor) && + (this.asts[this.top - 2].arguments === this.asts[this.top - 1]) && + (this.asts[this.top - 4].constructorDecl === this.asts[this.top - 2]); }; AstPath.prototype.isChildOfInterface = function () { var ast = lastOf(this.asts); - return this.count() >= 3 && this.asts[this.top] === ast && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.InterfaceDeclaration; + return this.count() >= 3 && + this.asts[this.top] === ast && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.InterfaceDeclaration; }; AstPath.prototype.isTopLevelImplicitModule = function () { - return this.count() >= 1 && this.asts[this.top].nodeType === TypeScript.NodeType.ModuleDeclaration && TypeScript.hasFlag(this.asts[this.top].modFlags, TypeScript.ModuleFlags.IsWholeFile); + return this.count() >= 1 && + this.asts[this.top].nodeType === TypeScript.NodeType.ModuleDeclaration && + TypeScript.hasFlag(this.asts[this.top].modFlags, TypeScript.ModuleFlags.IsWholeFile); }; AstPath.prototype.isBodyOfTopLevelImplicitModule = function () { - return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0] && TypeScript.hasFlag(this.asts[this.top - 1].modFlags, TypeScript.ModuleFlags.IsWholeFile); + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && + this.asts[this.top - 1].members == this.asts[this.top - 0] && + TypeScript.hasFlag(this.asts[this.top - 1].modFlags, TypeScript.ModuleFlags.IsWholeFile); }; AstPath.prototype.isBodyOfScript = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Script && this.asts[this.top - 1].bod == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Script && + this.asts[this.top - 1].bod == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfSwitch = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Switch && this.asts[this.top - 1].caseList == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Switch && + this.asts[this.top - 1].caseList == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfModule = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ModuleDeclaration && + this.asts[this.top - 1].members == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfClass = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ClassDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ClassDeclaration && + this.asts[this.top - 1].members == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfFunction = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 1].bod == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && + this.asts[this.top - 1].bod == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfInterface = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.InterfaceDeclaration && this.asts[this.top - 1].members == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.InterfaceDeclaration && + this.asts[this.top - 1].members == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfBlock = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Block && this.asts[this.top - 1].statements == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Block && + this.asts[this.top - 1].statements == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfFor = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.For && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.For && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfCase = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Case && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Case && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfTry = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Try && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Try && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfCatch = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Catch && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Catch && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfDoWhile = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.DoWhile && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.DoWhile && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfWhile = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.While && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.While && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfForIn = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ForIn && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ForIn && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfWith = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.With && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.With && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfFinally = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Finally && this.asts[this.top - 1].body == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Finally && + this.asts[this.top - 1].body == this.asts[this.top - 0]; }; AstPath.prototype.isCaseOfSwitch = function () { - return this.count() >= 3 && this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].caseList == this.asts[this.top - 1]; + return this.count() >= 3 && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].caseList == this.asts[this.top - 1]; }; AstPath.prototype.isDefaultCaseOfSwitch = function () { - return this.count() >= 3 && this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].caseList == this.asts[this.top - 1] && this.asts[this.top - 2].defaultCase == this.asts[this.top - 0]; + return this.count() >= 3 && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.Switch && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].caseList == this.asts[this.top - 1] && + this.asts[this.top - 2].defaultCase == this.asts[this.top - 0]; }; AstPath.prototype.isListOfObjectLit = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].operand == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].operand == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfObjectLit = function () { return this.isListOfObjectLit(); }; AstPath.prototype.isEmptyListOfObjectLit = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].operand == this.asts[this.top - 0] && this.asts[this.top - 0].members.length == 0; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].operand == this.asts[this.top - 0] && + this.asts[this.top - 0].members.length == 0; }; AstPath.prototype.isMemberOfObjectLit = function () { - return this.count() >= 3 && this.asts[this.top - 2].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 0].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 2].operand == this.asts[this.top - 1]; + return this.count() >= 3 && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.Member && + this.asts[this.top - 2].operand == this.asts[this.top - 1]; }; AstPath.prototype.isNameOfMemberOfObjectLit = function () { - return this.count() >= 4 && this.asts[this.top - 3].nodeType === TypeScript.NodeType.ObjectLit && this.asts[this.top - 2].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 0].nodeType === TypeScript.NodeType.Name && this.asts[this.top - 3].operand == this.asts[this.top - 2]; + return this.count() >= 4 && + this.asts[this.top - 3].nodeType === TypeScript.NodeType.ObjectLit && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.Name && + this.asts[this.top - 3].operand == this.asts[this.top - 2]; }; AstPath.prototype.isListOfArrayLit = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.ArrayLit && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].operand == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.ArrayLit && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].operand == this.asts[this.top - 0]; }; AstPath.prototype.isTargetOfMember = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 1].operand1 === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && + this.asts[this.top - 1].operand1 === this.asts[this.top - 0]; }; AstPath.prototype.isMemberOfMember = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && this.asts[this.top - 1].operand2 === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Member && + this.asts[this.top - 1].operand2 === this.asts[this.top - 0]; }; AstPath.prototype.isItemOfList = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List; //(this.asts[this.top - 1]).operand2 === this.asts[this.top - 0]; }; AstPath.prototype.isThenOfIf = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && this.asts[this.top - 1].thenBod == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && + this.asts[this.top - 1].thenBod == this.asts[this.top - 0]; }; AstPath.prototype.isElseOfIf = function () { - return this.count() >= 2 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && this.asts[this.top - 1].elseBod == this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.If && + this.asts[this.top - 1].elseBod == this.asts[this.top - 0]; }; AstPath.prototype.isBodyOfDefaultCase = function () { return this.isBodyOfCase(); }; AstPath.prototype.isSingleStatementList = function () { - return this.count() >= 1 && this.asts[this.top].nodeType === TypeScript.NodeType.List && this.asts[this.top].members.length === 1; + return this.count() >= 1 && + this.asts[this.top].nodeType === TypeScript.NodeType.List && + this.asts[this.top].members.length === 1; }; AstPath.prototype.isArgumentListOfFunction = function () { - return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 1].arguments === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.FuncDecl && + this.asts[this.top - 1].arguments === this.asts[this.top - 0]; }; AstPath.prototype.isArgumentOfFunction = function () { - return this.count() >= 3 && this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && this.asts[this.top - 2].arguments === this.asts[this.top - 1]; + return this.count() >= 3 && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 2].nodeType === TypeScript.NodeType.FuncDecl && + this.asts[this.top - 2].arguments === this.asts[this.top - 1]; }; AstPath.prototype.isArgumentListOfCall = function () { - return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.Call && this.asts[this.top - 1].arguments === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.Call && + this.asts[this.top - 1].arguments === this.asts[this.top - 0]; }; AstPath.prototype.isArgumentListOfNew = function () { - return this.count() >= 2 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && this.asts[this.top - 1].nodeType === TypeScript.NodeType.New && this.asts[this.top - 1].arguments === this.asts[this.top - 0]; + return this.count() >= 2 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.List && + this.asts[this.top - 1].nodeType === TypeScript.NodeType.New && + this.asts[this.top - 1].arguments === this.asts[this.top - 0]; }; AstPath.prototype.isSynthesizedBlock = function () { - return this.count() >= 1 && this.asts[this.top - 0].nodeType === TypeScript.NodeType.Block && this.asts[this.top - 0].isStatementBlock === false; + return this.count() >= 1 && + this.asts[this.top - 0].nodeType === TypeScript.NodeType.Block && + this.asts[this.top - 0].isStatementBlock === false; }; return AstPath; })(); @@ -879,7 +1000,9 @@ var TypeScript; // bar // 0123 // If "position == 3", the caret is at the "right" of the "r" character, which should be considered valid - var inclusive = hasFlag(options, 1 /* EdgeInclusive */) || cur.nodeType === TypeScript.NodeType.Name || pos === script.limChar; // Special "EOF" case + var inclusive = hasFlag(options, 1 /* EdgeInclusive */) || + cur.nodeType === TypeScript.NodeType.Name || + pos === script.limChar; // Special "EOF" case var minChar = cur.minChar; var limChar = cur.limChar + (inclusive ? 1 : 0); if (pos >= minChar && pos < limChar) { diff --git a/tests/baselines/reference/parserRealSource6.js b/tests/baselines/reference/parserRealSource6.js index e747b95e610..d65207b8c77 100644 --- a/tests/baselines/reference/parserRealSource6.js +++ b/tests/baselines/reference/parserRealSource6.js @@ -329,7 +329,8 @@ var TypeScript; // is has not been fully re-parsed yet. if (ast.nodeType == NodeType.Script && context.pos > limChar) limChar = context.pos; - if ((minChar <= context.pos) && (limChar >= context.pos)) { + if ((minChar <= context.pos) && + (limChar >= context.pos)) { switch (ast.nodeType) { case NodeType.Script: var script = ast; diff --git a/tests/baselines/reference/parserRealSource7.js b/tests/baselines/reference/parserRealSource7.js index c8dd3ae1b15..5073c33febd 100644 --- a/tests/baselines/reference/parserRealSource7.js +++ b/tests/baselines/reference/parserRealSource7.js @@ -1053,7 +1053,8 @@ var TypeScript; if (isExported) { typeSymbol.flags |= SymbolFlags.Exported; } - if ((context.scopeChain.moduleDecl) || (context.scopeChain.container == context.checker.gloMod)) { + if ((context.scopeChain.moduleDecl) || + (context.scopeChain.container == context.checker.gloMod)) { typeSymbol.flags |= SymbolFlags.ModuleMember; } moduleDecl.mod = modType; @@ -1079,7 +1080,11 @@ var TypeScript; // REVIEW-CLASSES if (!typeSymbol) { var valTypeSymbol = scopeChain.scope.findLocal(className, false, false); - if (valTypeSymbol && valTypeSymbol.isType() && valTypeSymbol.declAST && valTypeSymbol.declAST.nodeType == NodeType.FuncDecl && valTypeSymbol.declAST.isSignature()) { + if (valTypeSymbol && + valTypeSymbol.isType() && + valTypeSymbol.declAST && + valTypeSymbol.declAST.nodeType == NodeType.FuncDecl && + valTypeSymbol.declAST.isSignature()) { typeSymbol = valTypeSymbol; foundValSymbol = true; if (isExported) { @@ -1233,7 +1238,10 @@ var TypeScript; if (context.scopeChain.moduleDecl) { context.scopeChain.moduleDecl.recordNonInterface(); } - if (isProperty || isExported || (context.scopeChain.container == context.checker.gloMod) || context.scopeChain.moduleDecl) { + if (isProperty || + isExported || + (context.scopeChain.container == context.checker.gloMod) || + context.scopeChain.moduleDecl) { if (isAmbient) { var existingSym = scopeChain.scope.findLocal(varDecl.id.text, false, false); if (existingSym) { @@ -1254,7 +1262,8 @@ var TypeScript; } field.symbol = fieldSymbol; fieldSymbol.declAST = ast; - if ((context.scopeChain.moduleDecl) || (context.scopeChain.container == context.checker.gloMod)) { + if ((context.scopeChain.moduleDecl) || + (context.scopeChain.container == context.checker.gloMod)) { fieldSymbol.flags |= SymbolFlags.ModuleMember; fieldSymbol.declModule = context.scopeChain.moduleDecl; } @@ -1305,7 +1314,12 @@ var TypeScript; // If the parent is the constructor, and this isn't an instance method, skip it. // That way, we'll set the type during scope assignment, and can be sure that the // function will be placed in the constructor-local scope - if (!funcDecl.isConstructor && containerSym && containerSym.declAST && containerSym.declAST.nodeType == NodeType.FuncDecl && containerSym.declAST.isConstructor && !funcDecl.isMethod()) { + if (!funcDecl.isConstructor && + containerSym && + containerSym.declAST && + containerSym.declAST.nodeType == NodeType.FuncDecl && + containerSym.declAST.isConstructor && + !funcDecl.isMethod()) { return go; } // Interfaces and overloads @@ -1394,7 +1408,14 @@ var TypeScript; } } // REVIEW: Move this check into the typecheck phase? It's only being run over properties... - if (fgSym && !fgSym.isAccessor() && fgSym.type && fgSym.type.construct && fgSym.type.construct.signatures != [] && (fgSym.type.construct.signatures[0].declAST == null || !hasFlag(fgSym.type.construct.signatures[0].declAST.fncFlags, FncFlags.Ambient)) && !funcDecl.isConstructor) { + if (fgSym && + !fgSym.isAccessor() && + fgSym.type && + fgSym.type.construct && + fgSym.type.construct.signatures != [] && + (fgSym.type.construct.signatures[0].declAST == null || + !hasFlag(fgSym.type.construct.signatures[0].declAST.fncFlags, FncFlags.Ambient)) && + !funcDecl.isConstructor) { context.checker.errorReporter.simpleError(funcDecl, "Functions may not have class overloads"); } if (fgSym && !(fgSym.kind() == SymbolKind.Type) && funcDecl.isMethod() && !funcDecl.isAccessor() && !funcDecl.isConstructor) { diff --git a/tests/baselines/reference/parserRealSource8.js b/tests/baselines/reference/parserRealSource8.js index fcdb170ae12..8a667ad6dbe 100644 --- a/tests/baselines/reference/parserRealSource8.js +++ b/tests/baselines/reference/parserRealSource8.js @@ -632,7 +632,8 @@ var TypeScript; // the enclosing scope // REVIEW: Some twisted logic here - this needs to be cleaned up once old classes are removed // - if it's a new class, always use the contained scope, since we initialize the constructor scope below - if (context.scopeChain.thisType && (!funcDecl.isConstructor || hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod))) { + if (context.scopeChain.thisType && + (!funcDecl.isConstructor || hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod))) { var instType = context.scopeChain.thisType; if (!(instType.typeFlags & TypeFlags.IsClass) && !hasFlag(funcDecl.fncFlags, FncFlags.ClassMethod)) { if (!funcDecl.isMethod() || isStatic) { @@ -644,7 +645,10 @@ var TypeScript; } } else { - if (context.scopeChain.previous.scope.container && context.scopeChain.previous.scope.container.declAST && context.scopeChain.previous.scope.container.declAST.nodeType == NodeType.FuncDecl && context.scopeChain.previous.scope.container.declAST.isConstructor) { + if (context.scopeChain.previous.scope.container && + context.scopeChain.previous.scope.container.declAST && + context.scopeChain.previous.scope.container.declAST.nodeType == NodeType.FuncDecl && + context.scopeChain.previous.scope.container.declAST.isConstructor) { // if the parent is the class constructor, use the constructor scope parentScope = instType.constructorScope; } @@ -681,7 +685,12 @@ var TypeScript; outerFnc.innerStaticFuncs[outerFnc.innerStaticFuncs.length] = funcDecl; } else { - if (!funcDecl.isConstructor && container && container.declAST && container.declAST.nodeType == NodeType.FuncDecl && container.declAST.isConstructor && !funcDecl.isMethod()) { + if (!funcDecl.isConstructor && + container && + container.declAST && + container.declAST.nodeType == NodeType.FuncDecl && + container.declAST.isConstructor && + !funcDecl.isMethod()) { funcScope = context.scopeChain.thisType.constructorScope; //locals; } else { @@ -702,7 +711,11 @@ var TypeScript; } context.typeFlow.checker.createFunctionSignature(funcDecl, container, funcScope, fgSym, fgSym == null); // it's a getter or setter for a class property - if (!funcDecl.accessorSymbol && (funcDecl.fncFlags & FncFlags.ClassMethod) && container && ((!fgSym || fgSym.declAST.nodeType != NodeType.FuncDecl) && funcDecl.isAccessor()) || (fgSym && fgSym.isAccessor())) { + if (!funcDecl.accessorSymbol && + (funcDecl.fncFlags & FncFlags.ClassMethod) && + container && + ((!fgSym || fgSym.declAST.nodeType != NodeType.FuncDecl) && funcDecl.isAccessor()) || + (fgSym && fgSym.isAccessor())) { funcDecl.accessorSymbol = context.typeFlow.checker.createAccessorSymbol(funcDecl, fgSym, container.getType(), (funcDecl.isMethod() && isStatic), true, funcScope, container); } funcDecl.type.symbol.flags |= SymbolFlags.TypeSetDuringScopeAssignment; diff --git a/tests/baselines/reference/parserindenter.js b/tests/baselines/reference/parserindenter.js index 514a24afcf6..511e75ea135 100644 --- a/tests/baselines/reference/parserindenter.js +++ b/tests/baselines/reference/parserindenter.js @@ -778,7 +778,10 @@ var Formatting; } Indenter.prototype.GetIndentationEdits = function (token, nextToken, node, sameLineIndent) { if (this.logger.information()) { - this.logger.log("GetIndentationEdits(" + "t1=[" + token.Span.startPosition() + "," + token.Span.endPosition() + "], " + "t2=[" + (nextToken == null ? "null" : (nextToken.Span.startPosition() + "," + nextToken.Span.endPosition())) + "]" + ")"); + this.logger.log("GetIndentationEdits(" + + "t1=[" + token.Span.startPosition() + "," + token.Span.endPosition() + "], " + + "t2=[" + (nextToken == null ? "null" : (nextToken.Span.startPosition() + "," + nextToken.Span.endPosition())) + "]" + + ")"); } var result = this.GetIndentationEditsWorker(token, nextToken, node, sameLineIndent); if (this.logger.information()) { @@ -938,7 +941,8 @@ var Formatting; }; Indenter.prototype.GetSpecialCaseIndentationForLCurly = function (node) { var indentationInfo = null; - if (node.AuthorNode.Details.Kind == AuthorParseNodeKind.apnkFncDecl || node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneThen || node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneElse) { + if (node.AuthorNode.Details.Kind == AuthorParseNodeKind.apnkFncDecl || + node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneThen || node.AuthorNode.EdgeLabel == AuthorParseNodeEdge.apneElse) { // flushed with the node (function & if) indentationInfo = node.GetNodeStartLineIndentation(this); return indentationInfo; @@ -1233,7 +1237,8 @@ var Formatting; // Get the parent that is really on a different line from the self node var startNodeLineNumber = this.snapshot.GetLineNumberFromPosition(tree.StartNodeSelf.AuthorNode.Details.StartOffset); parent = tree.StartNodeSelf.Parent; - while (parent != null && startNodeLineNumber == this.snapshot.GetLineNumberFromPosition(parent.AuthorNode.Details.StartOffset)) { + while (parent != null && + startNodeLineNumber == this.snapshot.GetLineNumberFromPosition(parent.AuthorNode.Details.StartOffset)) { parent = parent.Parent; } } @@ -1331,7 +1336,8 @@ var Formatting; } }; Indenter.prototype.IsMultiLineString = function (token) { - return token.tokenID === TypeScript.TokenID.StringLiteral && this.snapshot.GetLineNumberFromPosition(token.Span.endPosition()) > this.snapshot.GetLineNumberFromPosition(token.Span.startPosition()); + return token.tokenID === TypeScript.TokenID.StringLiteral && + this.snapshot.GetLineNumberFromPosition(token.Span.endPosition()) > this.snapshot.GetLineNumberFromPosition(token.Span.startPosition()); }; return Indenter; })(); diff --git a/tests/baselines/reference/privateIndexer2.js b/tests/baselines/reference/privateIndexer2.js index f8e07d8aeb4..5a36a9eae18 100644 --- a/tests/baselines/reference/privateIndexer2.js +++ b/tests/baselines/reference/privateIndexer2.js @@ -11,6 +11,9 @@ var y: { //// [privateIndexer2.js] // private indexers not allowed -var x = (_a = {}, _a[x] = string, _a.string = , _a); +var x = (_a = {}, _a[x] = +string, _a.string = +, +_a); var y; var _a; diff --git a/tests/baselines/reference/scannertest1.js b/tests/baselines/reference/scannertest1.js index dc003e95a8f..8c9d805c5f2 100644 --- a/tests/baselines/reference/scannertest1.js +++ b/tests/baselines/reference/scannertest1.js @@ -33,7 +33,9 @@ var CharacterInfo = (function () { return c >= CharacterCodes._0 && c <= CharacterCodes._9; }; CharacterInfo.isHexDigit = function (c) { - return isDecimalDigit(c) || (c >= CharacterCodes.A && c <= CharacterCodes.F) || (c >= CharacterCodes.a && c <= CharacterCodes.f); + return isDecimalDigit(c) || + (c >= CharacterCodes.A && c <= CharacterCodes.F) || + (c >= CharacterCodes.a && c <= CharacterCodes.f); }; CharacterInfo.hexValue = function (c) { Debug.assert(isHexDigit(c)); diff --git a/tests/baselines/reference/targetTypeTest1.js b/tests/baselines/reference/targetTypeTest1.js index 94af7579fbb..8f7b1d8b81f 100644 --- a/tests/baselines/reference/targetTypeTest1.js +++ b/tests/baselines/reference/targetTypeTest1.js @@ -110,6 +110,7 @@ function C(a, b) { this.a = a; this.b = b; } -C.prototype = { a: 0, b: 0, C1M1: function (c, d) { - return (this.a + c) + (this.b + d); -} }; +C.prototype = + { a: 0, b: 0, C1M1: function (c, d) { + return (this.a + c) + (this.b + d); + } }; diff --git a/tests/baselines/reference/templateStringInEqualityChecks.js b/tests/baselines/reference/templateStringInEqualityChecks.js index 54f5fa610c2..ca9fc2ed80b 100644 --- a/tests/baselines/reference/templateStringInEqualityChecks.js +++ b/tests/baselines/reference/templateStringInEqualityChecks.js @@ -5,4 +5,7 @@ var x = `abc${0}abc` === `abc` || "abc0abc" !== `abc${0}abc`; //// [templateStringInEqualityChecks.js] -var x = "abc" + 0 + "abc" === "abc" || "abc" !== "abc" + 0 + "abc" && "abc" + 0 + "abc" == "abc0abc" && "abc0abc" !== "abc" + 0 + "abc"; +var x = "abc" + 0 + "abc" === "abc" || + "abc" !== "abc" + 0 + "abc" && + "abc" + 0 + "abc" == "abc0abc" && + "abc0abc" !== "abc" + 0 + "abc"; diff --git a/tests/baselines/reference/templateStringInEqualityChecksES6.js b/tests/baselines/reference/templateStringInEqualityChecksES6.js index 317db1ab366..db00827fac5 100644 --- a/tests/baselines/reference/templateStringInEqualityChecksES6.js +++ b/tests/baselines/reference/templateStringInEqualityChecksES6.js @@ -5,4 +5,7 @@ var x = `abc${0}abc` === `abc` || "abc0abc" !== `abc${0}abc`; //// [templateStringInEqualityChecksES6.js] -var x = `abc${0}abc` === `abc` || `abc` !== `abc${0}abc` && `abc${0}abc` == "abc0abc" && "abc0abc" !== `abc${0}abc`; +var x = `abc${0}abc` === `abc` || + `abc` !== `abc${0}abc` && + `abc${0}abc` == "abc0abc" && + "abc0abc" !== `abc${0}abc`; diff --git a/tests/baselines/reference/thisInPropertyBoundDeclarations.js b/tests/baselines/reference/thisInPropertyBoundDeclarations.js index 36ee45b1110..c6001da0bfb 100644 --- a/tests/baselines/reference/thisInPropertyBoundDeclarations.js +++ b/tests/baselines/reference/thisInPropertyBoundDeclarations.js @@ -120,8 +120,11 @@ var B = (function () { this.prop1 = this; this.prop2 = function () { return _this; }; this.prop3 = function () { return function () { return function () { return function () { return _this; }; }; }; }; - this.prop4 = ' ' + function () { - } + ' ' + (function () { return function () { return function () { return _this; }; }; }); + this.prop4 = ' ' + + function () { + } + + ' ' + + (function () { return function () { return function () { return _this; }; }; }); this.prop5 = { a: function () { return _this; diff --git a/tests/baselines/reference/typeGuardsInConditionalExpression.js b/tests/baselines/reference/typeGuardsInConditionalExpression.js index ebe84879d2b..e493df66ce6 100644 --- a/tests/baselines/reference/typeGuardsInConditionalExpression.js +++ b/tests/baselines/reference/typeGuardsInConditionalExpression.js @@ -142,7 +142,8 @@ function foo7(x) { } function foo8(x) { var b; - return typeof x === "string" ? x === "hello" : ((b = x) && (typeof x === "boolean" ? x // boolean + return typeof x === "string" ? x === "hello" : ((b = x) && + (typeof x === "boolean" ? x // boolean : x == 10)); // number } function foo9(x) { diff --git a/tests/baselines/reference/unspecializedConstraints.js b/tests/baselines/reference/unspecializedConstraints.js index f7974578ee2..0ca464a93af 100644 --- a/tests/baselines/reference/unspecializedConstraints.js +++ b/tests/baselines/reference/unspecializedConstraints.js @@ -240,7 +240,9 @@ var ts; this.flags = flags; } Property.prototype.equals = function (other) { - return this.name === other.name && this.flags === other.flags && this.type.equals(other.type); + return this.name === other.name && + this.flags === other.flags && + this.type.equals(other.type); }; return Property; })(Symbol); @@ -258,10 +260,14 @@ var ts; this.returnType = returnType; } Signature.prototype.equalsNoReturn = function (other) { - return this.parameters.length === other.parameters.length && this.typeParameters.length === other.typeParameters.length && arrayEquals(this.parameters, other.parameters) && arrayEquals(this.typeParameters, other.typeParameters); + return this.parameters.length === other.parameters.length && + this.typeParameters.length === other.typeParameters.length && + arrayEquals(this.parameters, other.parameters) && + arrayEquals(this.typeParameters, other.typeParameters); }; Signature.prototype.equals = function (other) { - return this.equalsNoReturn(other) && this.returnType.equals(other.returnType); + return this.equalsNoReturn(other) && + this.returnType.equals(other.returnType); }; return Signature; })(Symbol); @@ -274,7 +280,9 @@ var ts; this.flags = flags; } Parameter.prototype.equals = function (other) { - return this.name === other.name && this.flags === other.flags && this.type.equals(other.type); + return this.name === other.name && + this.flags === other.flags && + this.type.equals(other.type); }; return Parameter; })(Symbol); From 7e6eee179b9f3a0634101f767c895c5002102f8a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Fri, 20 Feb 2015 22:23:43 -0800 Subject: [PATCH 156/162] Sort navigate to items by name, after sorting by kind. --- src/services/navigateTo.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/services/navigateTo.ts b/src/services/navigateTo.ts index 059259eec9d..d008cac80f7 100644 --- a/src/services/navigateTo.ts +++ b/src/services/navigateTo.ts @@ -34,7 +34,7 @@ module ts.NavigateTo { } }); - rawItems.sort((i1, i2) => i1.matchKind - i2.matchKind); + rawItems.sort(compareNavigateToItems); if (maxResultCount !== undefined) { rawItems = rawItems.slice(0, maxResultCount); } @@ -43,6 +43,18 @@ module ts.NavigateTo { return items; + // This means "compare in a case insensitive manner." + var baseSensitivity: Intl.CollatorOptions = { sensitivity: "base" }; + function compareNavigateToItems(i1: RawNavigateToItem, i2: RawNavigateToItem) { + // TODO(cyrusn): get the gamut of comparisons that VS already uses here. + // Right now we just sort by kind first, and then by name of the item. + // We first sort case insensitively. So "Aaa" will come before "bar". + // Then we sort case sensitively, so "aaa" will come before "Aaa". + return i1.matchKind - i2.matchKind || + i1.name.localeCompare(i2.name, undefined, baseSensitivity) || + i1.name.localeCompare(i2.name); + } + function createNavigateToItem(rawItem: RawNavigateToItem): NavigateToItem { var declaration = rawItem.declaration; var container = getContainerNode(declaration); From a21460ff7516e674e98f77b9112399083e8eab75 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 21 Feb 2015 12:35:02 -0800 Subject: [PATCH 157/162] Fix crash on destructuring null or undefined into rest element --- src/compiler/checker.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index d2d6e9275bb..a06de62be8d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1722,7 +1722,7 @@ module ts { } else { // For an array binding element the specified or inferred type of the parent must be assignable to any[] - if (!isTypeAssignableTo(parentType, anyArrayType)) { + if (!isArrayLikeType(parentType)) { error(pattern, Diagnostics.Type_0_is_not_an_array_type, typeToString(parentType)); return unknownType; } @@ -4190,6 +4190,10 @@ module ts { return type.flags & TypeFlags.Reference && (type).target === globalArrayType; } + function isArrayLikeType(type: Type): boolean { + return !(type.flags & (TypeFlags.Undefined | TypeFlags.Null)) && isTypeAssignableTo(type, anyArrayType); + } + function isTupleLikeType(type: Type): boolean { return !!getPropertyOfType(type, "0"); } @@ -5466,7 +5470,7 @@ module ts { function checkSpreadElementExpression(node: SpreadElementExpression, contextualMapper?: TypeMapper): Type { var type = checkExpressionCached(node.expression, contextualMapper); - if (!isTypeAssignableTo(type, anyArrayType)) { + if (!isArrayLikeType(type)) { error(node.expression, Diagnostics.Type_0_is_not_an_array_type, typeToString(type)); return unknownType; } @@ -7074,7 +7078,7 @@ module ts { function checkArrayLiteralAssignment(node: ArrayLiteralExpression, sourceType: Type, contextualMapper?: TypeMapper): Type { // TODOO(andersh): Allow iterable source type in ES6 - if (!isTypeAssignableTo(sourceType, anyArrayType)) { + if (!isArrayLikeType(sourceType)) { error(node, Diagnostics.Type_0_is_not_an_array_type, typeToString(sourceType)); return sourceType; } From 95b3d6be5867f150739de7330845ad76f1cf1aed Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 21 Feb 2015 12:41:20 -0800 Subject: [PATCH 158/162] Adding test --- .../reference/restElementWithNullInitializer.errors.txt | 8 ++++++++ .../baselines/reference/restElementWithNullInitializer.js | 6 ++++++ .../es6/destructuring/restElementWithNullInitializer.ts | 1 + 3 files changed, 15 insertions(+) create mode 100644 tests/baselines/reference/restElementWithNullInitializer.errors.txt create mode 100644 tests/baselines/reference/restElementWithNullInitializer.js create mode 100644 tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts diff --git a/tests/baselines/reference/restElementWithNullInitializer.errors.txt b/tests/baselines/reference/restElementWithNullInitializer.errors.txt new file mode 100644 index 00000000000..b1222ebc0e7 --- /dev/null +++ b/tests/baselines/reference/restElementWithNullInitializer.errors.txt @@ -0,0 +1,8 @@ +tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(1,14): error TS2461: Type 'null' is not an array type. + + +==== tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts (1 errors) ==== + function foo([...r] = null) { } + ~~~~~~ +!!! error TS2461: Type 'null' is not an array type. + \ No newline at end of file diff --git a/tests/baselines/reference/restElementWithNullInitializer.js b/tests/baselines/reference/restElementWithNullInitializer.js new file mode 100644 index 00000000000..a4056c665f3 --- /dev/null +++ b/tests/baselines/reference/restElementWithNullInitializer.js @@ -0,0 +1,6 @@ +//// [restElementWithNullInitializer.ts] +function foo([...r] = null) { } + + +//// [restElementWithNullInitializer.js] +function foo(_a) { } diff --git a/tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts b/tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts new file mode 100644 index 00000000000..f136633e094 --- /dev/null +++ b/tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts @@ -0,0 +1 @@ +function foo([...r] = null) { } From 0ae0a6fa4394c1d3710bea46620a25f69ad8ae9a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sat, 21 Feb 2015 14:29:01 -0800 Subject: [PATCH 159/162] CR feedback. --- src/compiler/emitter.ts | 32 +++++++++++++++++--- src/services/formatting/formattingScanner.ts | 3 -- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index f33bddb68cc..ba343cf8db2 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -3052,13 +3052,37 @@ module ts { write(tokenToString(node.operatorToken.kind)); + // We'd like to preserve newlines found in the original binary expression. i.e. if a user has: + // + // Foo() || + // Bar(); + // + // Then we'd like to emit it as such. It seems like we'd only need to check for a newline and + // then just indent and emit. However, that will lead to a problem with deeply nested code. + // i.e. if you have: + // + // Foo() || + // Bar() || + // Baz(); + // + // Then we don't want to emit it as: + // + // Foo() || + // Bar() || + // Baz(); + // + // So we only indent if the right side of the binary expression starts further in on the line + // versus the left. var operatorEnd = getLineAndCharacterOfPosition(currentSourceFile, node.operatorToken.end); var rightStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.right.pos)); - var ondifferentLine = operatorEnd.line !== rightStart.line; - if (ondifferentLine) { + // Check if the right expression is on a different line versus the operator itself. If so, + // we'll emit newline. + var onDifferentLine = operatorEnd.line !== rightStart.line; + if (onDifferentLine) { + // Also, if the right expression starts further in on the line than the left, then we'll indent. var exprStart = getLineAndCharacterOfPosition(currentSourceFile, skipTrivia(currentSourceFile.text, node.pos)); - var firstCharOfExpr = getFirstNonWhitespaceCharacter(exprStart.line); + var firstCharOfExpr = getFirstNonWhitespaceCharacterIndexOnLine(exprStart.line); var shouldIndent = rightStart.character > firstCharOfExpr; if (shouldIndent) { @@ -3079,7 +3103,7 @@ module ts { } } - function getFirstNonWhitespaceCharacter(line: number): number { + function getFirstNonWhitespaceCharacterIndexOnLine(line: number): number { var lineStart = getLineStarts(currentSourceFile)[line]; var text = currentSourceFile.text; diff --git a/src/services/formatting/formattingScanner.ts b/src/services/formatting/formattingScanner.ts index 4ce463ec383..962f142f609 100644 --- a/src/services/formatting/formattingScanner.ts +++ b/src/services/formatting/formattingScanner.ts @@ -94,9 +94,6 @@ module ts.formatting { } function shouldRescanGreaterThanToken(node: Node): boolean { - //if (container.kind !== SyntaxKind.BinaryExpression) { - // return false; - //} if (node) { switch (node.kind) { case SyntaxKind.GreaterThanEqualsToken: From 23e66303faaf6af775d9e124c5d4ae1fe39b73bd Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sat, 21 Feb 2015 14:43:45 -0800 Subject: [PATCH 160/162] Update tests. --- .../baselines/reference/APISample_compile.js | 6 +- .../reference/YieldExpression10_es6.js | 5 +- tests/baselines/reference/classExpression.js | 4 +- .../reference/computedPropertyNames11_ES5.js | 14 +--- .../reference/computedPropertyNames16_ES5.js | 24 ++----- .../reference/computedPropertyNames17_ES6.js | 12 +--- .../reference/computedPropertyNames1_ES5.js | 4 +- .../reference/computedPropertyNames32_ES5.js | 9 +-- .../reference/computedPropertyNames32_ES6.js | 4 +- .../reference/computedPropertyNames33_ES5.js | 4 +- .../reference/computedPropertyNames33_ES6.js | 9 +-- .../reference/computedPropertyNames34_ES5.js | 4 +- .../reference/computedPropertyNames34_ES6.js | 9 +-- .../reference/computedPropertyNames35_ES5.js | 9 +-- .../reference/computedPropertyNames35_ES6.js | 4 +- .../reference/computedPropertyNames36_ES6.js | 4 +- .../reference/computedPropertyNames37_ES6.js | 4 +- .../reference/computedPropertyNames38_ES6.js | 4 +- .../reference/computedPropertyNames39_ES6.js | 4 +- .../reference/computedPropertyNames40_ES6.js | 8 +-- .../reference/computedPropertyNames41_ES6.js | 4 +- .../reference/computedPropertyNames43_ES6.js | 4 +- .../reference/computedPropertyNames44_ES6.js | 4 +- .../reference/computedPropertyNames45_ES6.js | 4 +- ...omputedPropertyNamesContextualType1_ES5.js | 4 +- ...omputedPropertyNamesContextualType2_ES5.js | 4 +- ...omputedPropertyNamesContextualType3_ES5.js | 4 +- ...mputedPropertyNamesDeclarationEmit1_ES6.js | 4 +- ...mputedPropertyNamesDeclarationEmit2_ES6.js | 4 +- ...mputedPropertyNamesDeclarationEmit5_ES5.js | 4 +- .../contextualTypeWithUnionTypeMembers.js | 69 +++++++++---------- tests/baselines/reference/enumBasics.js | 16 ++++- .../reference/genericsManyTypeParameters.js | 19 +---- .../reference/nestedClassDeclaration.js | 3 +- .../reference/objectLiteralWithSemicolons4.js | 3 +- .../objectTypesWithOptionalProperties2.js | 3 +- ...serErrorRecoveryArrayLiteralExpression1.js | 3 +- ...serErrorRecoveryArrayLiteralExpression2.js | 3 +- .../parserErrorRecovery_ObjectLiteral2.js | 3 +- .../parserErrorRecovery_ObjectLiteral3.js | 3 +- .../parserErrorRecovery_ObjectLiteral4.js | 3 +- .../parserErrorRecovery_ObjectLiteral5.js | 3 +- tests/baselines/reference/parserharness.js | 4 +- tests/baselines/reference/privateIndexer2.js | 6 -- .../reference/symbolDeclarationEmit10.js | 4 +- .../reference/symbolDeclarationEmit11.js | 4 +- .../reference/symbolDeclarationEmit12.js | 4 +- .../reference/symbolDeclarationEmit13.js | 4 +- .../reference/symbolDeclarationEmit14.js | 8 +-- .../reference/symbolDeclarationEmit4.js | 4 +- tests/baselines/reference/symbolProperty18.js | 4 +- tests/baselines/reference/symbolProperty19.js | 4 +- tests/baselines/reference/symbolProperty20.js | 4 +- tests/baselines/reference/targetTypeTest1.js | 9 +-- .../templateStringInObjectLiteral.js | 3 +- .../templateStringInObjectLiteralES6.js | 3 +- ...eAnnotationBestCommonTypeInArrayLiteral.js | 3 +- ...CheckingInsideFunctionExpressionInArray.js | 10 +-- ...ndefinedSymbolReferencedInArrayLiteral1.js | 6 +- .../wrappedAndRecursiveConstraints3.js | 4 +- .../wrappedAndRecursiveConstraints4.js | 4 +- 61 files changed, 139 insertions(+), 269 deletions(-) diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index bb2a662c071..de2217da843 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -1964,6 +1964,8 @@ function compile(fileNames, options) { } exports.compile = compile; compile(process.argv.slice(2), { - noEmitOnError: true, noImplicitAny: true, - target: 1 /* ES5 */, module: 1 /* CommonJS */ + noEmitOnError: true, + noImplicitAny: true, + target: 1 /* ES5 */, + module: 1 /* CommonJS */ }); diff --git a/tests/baselines/reference/YieldExpression10_es6.js b/tests/baselines/reference/YieldExpression10_es6.js index 3bae1b645fe..f111e6e1bdf 100644 --- a/tests/baselines/reference/YieldExpression10_es6.js +++ b/tests/baselines/reference/YieldExpression10_es6.js @@ -7,6 +7,5 @@ var v = { * foo() { //// [YieldExpression10_es6.js] var v = { foo: function () { - ; - } -}; + ; +} }; diff --git a/tests/baselines/reference/classExpression.js b/tests/baselines/reference/classExpression.js index 6bcf0f46f74..9d902abbf52 100644 --- a/tests/baselines/reference/classExpression.js +++ b/tests/baselines/reference/classExpression.js @@ -20,7 +20,9 @@ var C = (function () { return C; })(); var y = { - foo: , class: C2 }, _a = void 0; + foo: , + class: C2 +}, _a = void 0; var M; (function (M) { var z = ; diff --git a/tests/baselines/reference/computedPropertyNames11_ES5.js b/tests/baselines/reference/computedPropertyNames11_ES5.js index 213b30b1a59..73ed6110ced 100644 --- a/tests/baselines/reference/computedPropertyNames11_ES5.js +++ b/tests/baselines/reference/computedPropertyNames11_ES5.js @@ -20,17 +20,5 @@ var v = { var s; var n; var a; -var v = (_a = {}, _a[s] = Object.defineProperty({ get: function () { - return 0; -}, enumerable: true, configurable: true }), _a[n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[s + s] = Object.defineProperty({ get: function () { - return 0; -}, enumerable: true, configurable: true }), _a[s + n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[+s] = Object.defineProperty({ get: function () { - return 0; -}, enumerable: true, configurable: true }), _a[""] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[0] = Object.defineProperty({ get: function () { - return 0; -}, enumerable: true, configurable: true }), _a[a] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[true] = Object.defineProperty({ get: function () { - return 0; -}, enumerable: true, configurable: true }), _a["hello bye"] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a["hello " + a + " bye"] = Object.defineProperty({ get: function () { - return 0; -}, enumerable: true, configurable: true }), _a); +var v = (_a = {}, _a[s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[s + s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[s + n] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[+s] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[""] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[0] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[a] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a[true] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["hello bye"] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a["hello " + a + " bye"] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames16_ES5.js b/tests/baselines/reference/computedPropertyNames16_ES5.js index d1b5e5db333..2c7316e1398 100644 --- a/tests/baselines/reference/computedPropertyNames16_ES5.js +++ b/tests/baselines/reference/computedPropertyNames16_ES5.js @@ -24,9 +24,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, s, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -36,9 +34,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C, s + s, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -48,9 +44,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, +s, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -60,9 +54,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, 0, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -72,9 +64,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C, true, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -84,9 +74,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, "hello " + a + " bye", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames17_ES6.js b/tests/baselines/reference/computedPropertyNames17_ES6.js index d5af44be147..38012efbb14 100644 --- a/tests/baselines/reference/computedPropertyNames17_ES6.js +++ b/tests/baselines/reference/computedPropertyNames17_ES6.js @@ -15,9 +15,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, b, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -27,9 +25,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C.prototype, [], { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); @@ -39,9 +35,7 @@ var C = (function () { configurable: true }); Object.defineProperty(C, undefined, { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames1_ES5.js b/tests/baselines/reference/computedPropertyNames1_ES5.js index f31abf71051..d8f339dc811 100644 --- a/tests/baselines/reference/computedPropertyNames1_ES5.js +++ b/tests/baselines/reference/computedPropertyNames1_ES5.js @@ -5,7 +5,5 @@ var v = { } //// [computedPropertyNames1_ES5.js] -var v = (_a = {}, _a[0 + 1] = Object.defineProperty({ get: function () { - return 0; -}, enumerable: true, configurable: true }), _a[0 + 1] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a); +var v = (_a = {}, _a[0 + 1] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a[0 + 1] = Object.defineProperty({ set: function (v) { }, enumerable: true, configurable: true }), _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames32_ES5.js b/tests/baselines/reference/computedPropertyNames32_ES5.js index f523c839af9..a0d8b066b5c 100644 --- a/tests/baselines/reference/computedPropertyNames32_ES5.js +++ b/tests/baselines/reference/computedPropertyNames32_ES5.js @@ -7,15 +7,8 @@ class C { [foo()]() { } } -<<<<<<< HEAD:tests/baselines/reference/computedPropertyNames32.js -//// [computedPropertyNames32.js] -function foo() { return ''; } -======= //// [computedPropertyNames32_ES5.js] -function foo() { - return ''; -} ->>>>>>> master:tests/baselines/reference/computedPropertyNames32_ES5.js +function foo() { return ''; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames32_ES6.js b/tests/baselines/reference/computedPropertyNames32_ES6.js index 46ac715f750..69d2a40edce 100644 --- a/tests/baselines/reference/computedPropertyNames32_ES6.js +++ b/tests/baselines/reference/computedPropertyNames32_ES6.js @@ -8,9 +8,7 @@ class C { } //// [computedPropertyNames32_ES6.js] -function foo() { - return ''; -} +function foo() { return ''; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames33_ES5.js b/tests/baselines/reference/computedPropertyNames33_ES5.js index 92e6456f3ba..d689d27fe5a 100644 --- a/tests/baselines/reference/computedPropertyNames33_ES5.js +++ b/tests/baselines/reference/computedPropertyNames33_ES5.js @@ -10,9 +10,7 @@ class C { } //// [computedPropertyNames33_ES5.js] -function foo() { - return ''; -} +function foo() { return ''; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames33_ES6.js b/tests/baselines/reference/computedPropertyNames33_ES6.js index 16f14029bde..768af6fd403 100644 --- a/tests/baselines/reference/computedPropertyNames33_ES6.js +++ b/tests/baselines/reference/computedPropertyNames33_ES6.js @@ -9,15 +9,8 @@ class C { } } -<<<<<<< HEAD:tests/baselines/reference/computedPropertyNames33.js -//// [computedPropertyNames33.js] -function foo() { return ''; } -======= //// [computedPropertyNames33_ES6.js] -function foo() { - return ''; -} ->>>>>>> master:tests/baselines/reference/computedPropertyNames33_ES6.js +function foo() { return ''; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames34_ES5.js b/tests/baselines/reference/computedPropertyNames34_ES5.js index da9789c0d70..3c97971120d 100644 --- a/tests/baselines/reference/computedPropertyNames34_ES5.js +++ b/tests/baselines/reference/computedPropertyNames34_ES5.js @@ -10,9 +10,7 @@ class C { } //// [computedPropertyNames34_ES5.js] -function foo() { - return ''; -} +function foo() { return ''; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames34_ES6.js b/tests/baselines/reference/computedPropertyNames34_ES6.js index c10fa8235b1..09cccb0e7f4 100644 --- a/tests/baselines/reference/computedPropertyNames34_ES6.js +++ b/tests/baselines/reference/computedPropertyNames34_ES6.js @@ -9,15 +9,8 @@ class C { } } -<<<<<<< HEAD:tests/baselines/reference/computedPropertyNames34.js -//// [computedPropertyNames34.js] -function foo() { return ''; } -======= //// [computedPropertyNames34_ES6.js] -function foo() { - return ''; -} ->>>>>>> master:tests/baselines/reference/computedPropertyNames34_ES6.js +function foo() { return ''; } var C = (function () { function C() { } diff --git a/tests/baselines/reference/computedPropertyNames35_ES5.js b/tests/baselines/reference/computedPropertyNames35_ES5.js index 4b1d72465a2..0804c946f1f 100644 --- a/tests/baselines/reference/computedPropertyNames35_ES5.js +++ b/tests/baselines/reference/computedPropertyNames35_ES5.js @@ -5,12 +5,5 @@ interface I { [foo()](): void; } -<<<<<<< HEAD:tests/baselines/reference/computedPropertyNames35.js -//// [computedPropertyNames35.js] -function foo() { return ''; } -======= //// [computedPropertyNames35_ES5.js] -function foo() { - return ''; -} ->>>>>>> master:tests/baselines/reference/computedPropertyNames35_ES5.js +function foo() { return ''; } diff --git a/tests/baselines/reference/computedPropertyNames35_ES6.js b/tests/baselines/reference/computedPropertyNames35_ES6.js index b08d7c0f312..2d3f4088315 100644 --- a/tests/baselines/reference/computedPropertyNames35_ES6.js +++ b/tests/baselines/reference/computedPropertyNames35_ES6.js @@ -6,6 +6,4 @@ interface I { } //// [computedPropertyNames35_ES6.js] -function foo() { - return ''; -} +function foo() { return ''; } diff --git a/tests/baselines/reference/computedPropertyNames36_ES6.js b/tests/baselines/reference/computedPropertyNames36_ES6.js index 08dc062d802..09bab9a2630 100644 --- a/tests/baselines/reference/computedPropertyNames36_ES6.js +++ b/tests/baselines/reference/computedPropertyNames36_ES6.js @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, "get1", { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames37_ES6.js b/tests/baselines/reference/computedPropertyNames37_ES6.js index 988706109e9..c824f15ef54 100644 --- a/tests/baselines/reference/computedPropertyNames37_ES6.js +++ b/tests/baselines/reference/computedPropertyNames37_ES6.js @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, "get1", { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames38_ES6.js b/tests/baselines/reference/computedPropertyNames38_ES6.js index 548babb90e0..9dde7da09de 100644 --- a/tests/baselines/reference/computedPropertyNames38_ES6.js +++ b/tests/baselines/reference/computedPropertyNames38_ES6.js @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, 1 << 6, { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames39_ES6.js b/tests/baselines/reference/computedPropertyNames39_ES6.js index f3ad2569c1e..d0d21f201bb 100644 --- a/tests/baselines/reference/computedPropertyNames39_ES6.js +++ b/tests/baselines/reference/computedPropertyNames39_ES6.js @@ -26,9 +26,7 @@ var C = (function () { } Object.defineProperty(C.prototype, 1 << 6, { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames40_ES6.js b/tests/baselines/reference/computedPropertyNames40_ES6.js index 99d28688a29..208be7760a9 100644 --- a/tests/baselines/reference/computedPropertyNames40_ES6.js +++ b/tests/baselines/reference/computedPropertyNames40_ES6.js @@ -25,11 +25,7 @@ var C = (function () { function C() { } // Computed properties - C.prototype[""] = function () { - return new Foo; - }; - C.prototype[""] = function () { - return new Foo2; - }; + C.prototype[""] = function () { return new Foo; }; + C.prototype[""] = function () { return new Foo2; }; return C; })(); diff --git a/tests/baselines/reference/computedPropertyNames41_ES6.js b/tests/baselines/reference/computedPropertyNames41_ES6.js index f0c386706a3..050079017c0 100644 --- a/tests/baselines/reference/computedPropertyNames41_ES6.js +++ b/tests/baselines/reference/computedPropertyNames41_ES6.js @@ -24,8 +24,6 @@ var C = (function () { function C() { } // Computed properties - C[""] = function () { - return new Foo; - }; + C[""] = function () { return new Foo; }; return C; })(); diff --git a/tests/baselines/reference/computedPropertyNames43_ES6.js b/tests/baselines/reference/computedPropertyNames43_ES6.js index 25457eade1f..4b64a4c803b 100644 --- a/tests/baselines/reference/computedPropertyNames43_ES6.js +++ b/tests/baselines/reference/computedPropertyNames43_ES6.js @@ -41,9 +41,7 @@ var D = (function (_super) { } Object.defineProperty(D.prototype, "get1", { // Computed properties - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames44_ES6.js b/tests/baselines/reference/computedPropertyNames44_ES6.js index 1417d0188a2..9cf11f3b337 100644 --- a/tests/baselines/reference/computedPropertyNames44_ES6.js +++ b/tests/baselines/reference/computedPropertyNames44_ES6.js @@ -32,9 +32,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "get1", { - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNames45_ES6.js b/tests/baselines/reference/computedPropertyNames45_ES6.js index 0651d204492..2e7992fe260 100644 --- a/tests/baselines/reference/computedPropertyNames45_ES6.js +++ b/tests/baselines/reference/computedPropertyNames45_ES6.js @@ -33,9 +33,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, "get1", { - get: function () { - return new Foo; - }, + get: function () { return new Foo; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js index 67121a627d1..b8b0ac2b020 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType1_ES5.js @@ -10,7 +10,5 @@ var o: I = { } //// [computedPropertyNamesContextualType1_ES5.js] -var o = (_a = {}, _a["" + 0] = function (y) { - return y.length; -}, _a["" + 1] = function (y) { return y.length; }, _a); +var o = (_a = {}, _a["" + 0] = function (y) { return y.length; }, _a["" + 1] = function (y) { return y.length; }, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js index 3bea2d75ee0..aa4c719b8d8 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType2_ES5.js @@ -10,7 +10,5 @@ var o: I = { } //// [computedPropertyNamesContextualType2_ES5.js] -var o = (_a = {}, _a[+"foo"] = function (y) { - return y.length; -}, _a[+"bar"] = function (y) { return y.length; }, _a); +var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] = function (y) { return y.length; }, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js index 320a4cf1063..779580dfc20 100644 --- a/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesContextualType3_ES5.js @@ -9,7 +9,5 @@ var o: I = { } //// [computedPropertyNamesContextualType3_ES5.js] -var o = (_a = {}, _a[+"foo"] = function (y) { - return y.length; -}, _a[+"bar"] = function (y) { return y.length; }, _a); +var o = (_a = {}, _a[+"foo"] = function (y) { return y.length; }, _a[+"bar"] = function (y) { return y.length; }, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.js index 800b94dba86..b7505212baf 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit1_ES6.js @@ -11,9 +11,7 @@ var C = (function () { } C.prototype["" + ""] = function () { }; Object.defineProperty(C.prototype, "" + "", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.js index 46cf904515a..9cd90493ea6 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit2_ES6.js @@ -11,9 +11,7 @@ var C = (function () { } C["" + ""] = function () { }; Object.defineProperty(C, "" + "", { - get: function () { - return 0; - }, + get: function () { return 0; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js index 4ffdca51f09..84ac825754d 100644 --- a/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js +++ b/tests/baselines/reference/computedPropertyNamesDeclarationEmit5_ES5.js @@ -7,9 +7,7 @@ var v = { } //// [computedPropertyNamesDeclarationEmit5_ES5.js] -var v = (_a = {}, _a["" + ""] = 0, _a["" + ""] = function () { }, _a["" + ""] = Object.defineProperty({ get: function () { - return 0; -}, enumerable: true, configurable: true }), _a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }), _a); +var v = (_a = {}, _a["" + ""] = 0, _a["" + ""] = function () { }, _a["" + ""] = Object.defineProperty({ get: function () { return 0; }, enumerable: true, configurable: true }), _a["" + ""] = Object.defineProperty({ set: function (x) { }, enumerable: true, configurable: true }), _a); var _a; diff --git a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js index 10672d86796..b04c804ad7e 100644 --- a/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js +++ b/tests/baselines/reference/contextualTypeWithUnionTypeMembers.js @@ -150,27 +150,26 @@ var i1Ori2 = { propertyOnlyInI2: "Hello" }; var arrayI1OrI2 = [i1, i2, { - commonPropertyType: "hello", - commonMethodType: function (a) { return a; }, - commonMethodWithTypeParameter: function (a) { return a; }, - methodOnlyInI1: function (a) { return a; }, - propertyOnlyInI1: "Hello" - }, - { - commonPropertyType: "hello", - commonMethodType: function (a) { return a; }, - commonMethodWithTypeParameter: function (a) { return a; }, - methodOnlyInI2: function (a) { return a; }, - propertyOnlyInI2: "Hello" - }, { - commonPropertyType: "hello", - commonMethodType: function (a) { return a; }, - commonMethodWithTypeParameter: function (a) { return a; }, - methodOnlyInI1: function (a) { return a; }, - propertyOnlyInI1: "Hello", - methodOnlyInI2: function (a) { return a; }, - propertyOnlyInI2: "Hello" - }]; + commonPropertyType: "hello", + commonMethodType: function (a) { return a; }, + commonMethodWithTypeParameter: function (a) { return a; }, + methodOnlyInI1: function (a) { return a; }, + propertyOnlyInI1: "Hello" +}, { + commonPropertyType: "hello", + commonMethodType: function (a) { return a; }, + commonMethodWithTypeParameter: function (a) { return a; }, + methodOnlyInI2: function (a) { return a; }, + propertyOnlyInI2: "Hello" +}, { + commonPropertyType: "hello", + commonMethodType: function (a) { return a; }, + commonMethodWithTypeParameter: function (a) { return a; }, + methodOnlyInI1: function (a) { return a; }, + propertyOnlyInI1: "Hello", + methodOnlyInI2: function (a) { return a; }, + propertyOnlyInI2: "Hello" +}]; var i11; var i21; var i11Ori21 = i11; @@ -192,17 +191,17 @@ var i11Ori21 = { commonPropertyDifferentType: 10 }; var arrayOrI11OrI21 = [i11, i21, i11 || i21, { - // Like i1 - commonMethodDifferentReturnType: function (a, b) { - var z = a.charAt(b); - return z; - }, - commonPropertyDifferentType: "hello" - }, { - // Like i2 - commonMethodDifferentReturnType: function (a, b) { - var z = a.charCodeAt(b); - return z; - }, - commonPropertyDifferentType: 10 - }]; + // Like i1 + commonMethodDifferentReturnType: function (a, b) { + var z = a.charAt(b); + return z; + }, + commonPropertyDifferentType: "hello" +}, { + // Like i2 + commonMethodDifferentReturnType: function (a, b) { + var z = a.charCodeAt(b); + return z; + }, + commonPropertyDifferentType: 10 +}]; diff --git a/tests/baselines/reference/enumBasics.js b/tests/baselines/reference/enumBasics.js index eca92215fb6..6f1a039ca6e 100644 --- a/tests/baselines/reference/enumBasics.js +++ b/tests/baselines/reference/enumBasics.js @@ -150,9 +150,21 @@ var E9; // (refer to .js to validate) // Enum constant members are propagated var doNotPropagate = [ - E8.B, E7.A, E4.Z, E3.X, E3.Y, E3.Z + E8.B, + E7.A, + E4.Z, + E3.X, + E3.Y, + E3.Z ]; // Enum computed members are not propagated var doPropagate = [ - 0 /* A */, E9.B, 0 /* B */, 1 /* C */, 0 /* A */, 0 /* A */, 3 /* B */, 4 /* C */ + 0 /* A */, + E9.B, + 0 /* B */, + 1 /* C */, + 0 /* A */, + 0 /* A */, + 3 /* B */, + 4 /* C */ ]; diff --git a/tests/baselines/reference/genericsManyTypeParameters.js b/tests/baselines/reference/genericsManyTypeParameters.js index 491f0c41168..19a5117cb6b 100644 --- a/tests/baselines/reference/genericsManyTypeParameters.js +++ b/tests/baselines/reference/genericsManyTypeParameters.js @@ -61,22 +61,5 @@ function Foo< //// [genericsManyTypeParameters.js] function Foo(x1, y1, z1, a1, b1, c1, x2, y2, z2, a2, b2, c2, x3, y3, z3, a3, b3, c3, x4, y4, z4, a4, b4, c4, x5, y5, z5, a5, b5, c5, x6, y6, z6, a6, b6, c6, x7, y7, z7, a7, b7, c7, x8, y8, z8, a8, b8, c8, x9, y9, z9, a9, b9, c9, x10, y12, z10, a10, b10, c10, x11, y13, z11, a11, b11, c11, x12, y14, z12, a12, b12, c12, x13, y15, z13, a13, b13, c13, x14, y16, z14, a14, b14, c14, x15, y17, z15, a15, b15, c15, x16, y18, z16, a16, b16, c16, x17, y19, z17, a17, b17, c17, x18, y10, z18, a18, b18, c18) { - return [x1, y1, z1, a1, b1, c1, - x2, y2, z2, a2, b2, c2, - x3, y3, z3, a3, b3, c3, - x4, y4, z4, a4, b4, c4, - x5, y5, z5, a5, b5, c5, - x6, y6, z6, a6, b6, c6, - x7, y7, z7, a7, b7, c7, - x8, y8, z8, a8, b8, c8, - x9, y9, z9, a9, b9, c9, - x10, y12, z10, a10, b10, c10, - x11, y13, z11, a11, b11, c11, - x12, y14, z12, a12, b12, c12, - x13, y15, z13, a13, b13, c13, - x14, y16, z14, a14, b14, c14, - x15, y17, z15, a15, b15, c15, - x16, y18, z16, a16, b16, c16, - x17, y19, z17, a17, b17, c17, - x18, y10, z18, a18, b18, c18]; + return [x1, y1, z1, a1, b1, c1, x2, y2, z2, a2, b2, c2, x3, y3, z3, a3, b3, c3, x4, y4, z4, a4, b4, c4, x5, y5, z5, a5, b5, c5, x6, y6, z6, a6, b6, c6, x7, y7, z7, a7, b7, c7, x8, y8, z8, a8, b8, c8, x9, y9, z9, a9, b9, c9, x10, y12, z10, a10, b10, c10, x11, y13, z11, a11, b11, c11, x12, y14, z12, a12, b12, c12, x13, y15, z13, a13, b13, c13, x14, y16, z14, a14, b14, c14, x15, y17, z15, a15, b15, c15, x16, y18, z16, a16, b16, c16, x17, y19, z17, a17, b17, c17, x18, y10, z18, a18, b18, c18]; } diff --git a/tests/baselines/reference/nestedClassDeclaration.js b/tests/baselines/reference/nestedClassDeclaration.js index 70445b3372f..fa69ef5950e 100644 --- a/tests/baselines/reference/nestedClassDeclaration.js +++ b/tests/baselines/reference/nestedClassDeclaration.js @@ -37,4 +37,5 @@ var C3 = (function () { return C3; })(); var x = { - class: C4 }, _a = void 0; + class: C4 +}, _a = void 0; diff --git a/tests/baselines/reference/objectLiteralWithSemicolons4.js b/tests/baselines/reference/objectLiteralWithSemicolons4.js index a01d52548ee..9e1e3dea4b9 100644 --- a/tests/baselines/reference/objectLiteralWithSemicolons4.js +++ b/tests/baselines/reference/objectLiteralWithSemicolons4.js @@ -5,4 +5,5 @@ var v = { //// [objectLiteralWithSemicolons4.js] var v = { - a: }; + a: +}; diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties2.js b/tests/baselines/reference/objectTypesWithOptionalProperties2.js index cf0d113c244..7a237223d7c 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties2.js +++ b/tests/baselines/reference/objectTypesWithOptionalProperties2.js @@ -42,5 +42,6 @@ var C2 = (function () { return C2; })(); var b = { - x: function () { }, 1: // error + x: function () { }, + 1: // error }; diff --git a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js index c33dbc2a626..1ed36d8dac5 100644 --- a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js +++ b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression1.js @@ -3,5 +3,4 @@ var v = [1, 2, 3 4, 5, 6, 7]; //// [parserErrorRecoveryArrayLiteralExpression1.js] -var v = [1, 2, 3, - 4, 5, 6, 7]; +var v = [1, 2, 3, 4, 5, 6, 7]; diff --git a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js index 0bfe59964db..c5386a2b6a2 100644 --- a/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js +++ b/tests/baselines/reference/parserErrorRecoveryArrayLiteralExpression2.js @@ -5,5 +5,4 @@ var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0 //// [parserErrorRecoveryArrayLiteralExpression2.js] -var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0, - .7042760848999023, 1.1955541372299194, 0.19600726664066315, -0.7120069861412048]; +var points = [-0.6961439251899719, 1.207661509513855, 0.19374050199985504, -0, .7042760848999023, 1.1955541372299194, 0.19600726664066315, -0.7120069861412048]; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js index 6a703759fff..08dc96d38ef 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js @@ -3,5 +3,4 @@ var v = { a return; //// [parserErrorRecovery_ObjectLiteral2.js] -var v = { a: , - return: }; +var v = { a: , return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js index eecf45fea4f..1ea23d59112 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js @@ -3,5 +3,4 @@ var v = { a: return; //// [parserErrorRecovery_ObjectLiteral3.js] -var v = { a: , - return: }; +var v = { a: , return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js index 87a1a31437e..4fe49788740 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js @@ -3,5 +3,4 @@ var v = { a: 1 return; //// [parserErrorRecovery_ObjectLiteral4.js] -var v = { a: 1, - return: }; +var v = { a: 1, return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js index 97e618946a0..cf55b59c711 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js @@ -3,5 +3,4 @@ var v = { a: 1, return; //// [parserErrorRecovery_ObjectLiteral5.js] -var v = { a: 1, - return: }; +var v = { a: 1, return: }; diff --git a/tests/baselines/reference/parserharness.js b/tests/baselines/reference/parserharness.js index 02304380013..64e8b13ab9d 100644 --- a/tests/baselines/reference/parserharness.js +++ b/tests/baselines/reference/parserharness.js @@ -2627,7 +2627,9 @@ var Harness; var description = b.description + (prop ? ": " + prop : ''); emitLog('testStart', { desc: description }); emitLog('pass', { - desc: description, pass: true, perfResults: { + desc: description, + pass: true, + perfResults: { mean: b.results[prop].mean(), min: b.results[prop].min(), max: b.results[prop].max(), diff --git a/tests/baselines/reference/privateIndexer2.js b/tests/baselines/reference/privateIndexer2.js index b15357a13d2..f8e07d8aeb4 100644 --- a/tests/baselines/reference/privateIndexer2.js +++ b/tests/baselines/reference/privateIndexer2.js @@ -11,12 +11,6 @@ var y: { //// [privateIndexer2.js] // private indexers not allowed -<<<<<<< HEAD -var x = { - [x]: string, string: -}; -======= var x = (_a = {}, _a[x] = string, _a.string = , _a); ->>>>>>> master var y; var _a; diff --git a/tests/baselines/reference/symbolDeclarationEmit10.js b/tests/baselines/reference/symbolDeclarationEmit10.js index 090adc03a1c..0c46d8750e9 100644 --- a/tests/baselines/reference/symbolDeclarationEmit10.js +++ b/tests/baselines/reference/symbolDeclarationEmit10.js @@ -6,9 +6,7 @@ var obj = { //// [symbolDeclarationEmit10.js] var obj = { - get [Symbol.isConcatSpreadable]() { - return ''; - }, + get [Symbol.isConcatSpreadable]() { return ''; }, set [Symbol.isConcatSpreadable](x) { } }; diff --git a/tests/baselines/reference/symbolDeclarationEmit11.js b/tests/baselines/reference/symbolDeclarationEmit11.js index eeaf66db3e0..e5822104bf8 100644 --- a/tests/baselines/reference/symbolDeclarationEmit11.js +++ b/tests/baselines/reference/symbolDeclarationEmit11.js @@ -12,9 +12,7 @@ var C = (function () { } C[Symbol.toPrimitive] = function () { }; Object.defineProperty(C, Symbol.isRegExp, { - get: function () { - return ""; - }, + get: function () { return ""; }, set: function (x) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/symbolDeclarationEmit12.js b/tests/baselines/reference/symbolDeclarationEmit12.js index e39e62f62ed..68a256bd39d 100644 --- a/tests/baselines/reference/symbolDeclarationEmit12.js +++ b/tests/baselines/reference/symbolDeclarationEmit12.js @@ -23,9 +23,7 @@ var M; return undefined; }; Object.defineProperty(C.prototype, Symbol.isRegExp, { - get: function () { - return undefined; - }, + get: function () { return undefined; }, set: function (x) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/symbolDeclarationEmit13.js b/tests/baselines/reference/symbolDeclarationEmit13.js index 83e2a2501e4..acf470ffce1 100644 --- a/tests/baselines/reference/symbolDeclarationEmit13.js +++ b/tests/baselines/reference/symbolDeclarationEmit13.js @@ -9,9 +9,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, Symbol.isRegExp, { - get: function () { - return ""; - }, + get: function () { return ""; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/symbolDeclarationEmit14.js b/tests/baselines/reference/symbolDeclarationEmit14.js index d81bc329927..64330c6ce92 100644 --- a/tests/baselines/reference/symbolDeclarationEmit14.js +++ b/tests/baselines/reference/symbolDeclarationEmit14.js @@ -9,16 +9,12 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, Symbol.isRegExp, { - get: function () { - return ""; - }, + get: function () { return ""; }, enumerable: true, configurable: true }); Object.defineProperty(C.prototype, Symbol.toStringTag, { - get: function () { - return ""; - }, + get: function () { return ""; }, enumerable: true, configurable: true }); diff --git a/tests/baselines/reference/symbolDeclarationEmit4.js b/tests/baselines/reference/symbolDeclarationEmit4.js index 85906167b11..cfe3a14122d 100644 --- a/tests/baselines/reference/symbolDeclarationEmit4.js +++ b/tests/baselines/reference/symbolDeclarationEmit4.js @@ -9,9 +9,7 @@ var C = (function () { function C() { } Object.defineProperty(C.prototype, Symbol.isRegExp, { - get: function () { - return ""; - }, + get: function () { return ""; }, set: function (x) { }, enumerable: true, configurable: true diff --git a/tests/baselines/reference/symbolProperty18.js b/tests/baselines/reference/symbolProperty18.js index 17570e2f007..1d0a57e7b50 100644 --- a/tests/baselines/reference/symbolProperty18.js +++ b/tests/baselines/reference/symbolProperty18.js @@ -12,9 +12,7 @@ i[Symbol.toPrimitive] = false; //// [symbolProperty18.js] var i = { [Symbol.iterator]: 0, - [Symbol.toStringTag]() { - return ""; - }, + [Symbol.toStringTag]() { return ""; }, set [Symbol.toPrimitive](p) { } }; var it = i[Symbol.iterator]; diff --git a/tests/baselines/reference/symbolProperty19.js b/tests/baselines/reference/symbolProperty19.js index c64541691cc..5ec7968218a 100644 --- a/tests/baselines/reference/symbolProperty19.js +++ b/tests/baselines/reference/symbolProperty19.js @@ -10,9 +10,7 @@ var str = i[Symbol.toStringTag](); //// [symbolProperty19.js] var i = { [Symbol.iterator]: { p: null }, - [Symbol.toStringTag]() { - return { p: undefined }; - } + [Symbol.toStringTag]() { return { p: undefined }; } }; var it = i[Symbol.iterator]; var str = i[Symbol.toStringTag](); diff --git a/tests/baselines/reference/symbolProperty20.js b/tests/baselines/reference/symbolProperty20.js index 558305a577d..df7516552e0 100644 --- a/tests/baselines/reference/symbolProperty20.js +++ b/tests/baselines/reference/symbolProperty20.js @@ -12,7 +12,5 @@ var i: I = { //// [symbolProperty20.js] var i = { [Symbol.iterator]: s => { return s; }, - [Symbol.toStringTag](n) { - return n; - } + [Symbol.toStringTag](n) { return n; } }; diff --git a/tests/baselines/reference/targetTypeTest1.js b/tests/baselines/reference/targetTypeTest1.js index 5b3230439e6..1507fcf2a1b 100644 --- a/tests/baselines/reference/targetTypeTest1.js +++ b/tests/baselines/reference/targetTypeTest1.js @@ -108,9 +108,6 @@ function C(a, b) { this.a = a; this.b = b; } -C.prototype = { a: 0, - b: 0, - C1M1: function (c, d) { - return (this.a + c) + (this.b + d); - } -}; +C.prototype = { a: 0, b: 0, C1M1: function (c, d) { + return (this.a + c) + (this.b + d); +} }; diff --git a/tests/baselines/reference/templateStringInObjectLiteral.js b/tests/baselines/reference/templateStringInObjectLiteral.js index 6df5a64d78a..b026aedf4d3 100644 --- a/tests/baselines/reference/templateStringInObjectLiteral.js +++ b/tests/baselines/reference/templateStringInObjectLiteral.js @@ -6,5 +6,6 @@ var x = { //// [templateStringInObjectLiteral.js] var x = { - a: "abc" + 123 + "def" } "b"; + a: "abc" + 123 + "def" +} "b"; 321; diff --git a/tests/baselines/reference/templateStringInObjectLiteralES6.js b/tests/baselines/reference/templateStringInObjectLiteralES6.js index 7de012185a9..22144e75247 100644 --- a/tests/baselines/reference/templateStringInObjectLiteralES6.js +++ b/tests/baselines/reference/templateStringInObjectLiteralES6.js @@ -6,5 +6,6 @@ var x = { //// [templateStringInObjectLiteralES6.js] var x = { - a: `abc${123}def`, } `b`; + a: `abc${123}def`, +} `b`; 321; diff --git a/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js b/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js index cf5ddb23ccd..be252fe345b 100644 --- a/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js +++ b/tests/baselines/reference/typeAnnotationBestCommonTypeInArrayLiteral.js @@ -29,7 +29,8 @@ var menuData = [ "type": "image", "link": "", "icon": "modules/menu/logo.svg" - }, { + }, + { "id": "productName", "type": "default", "link": "", diff --git a/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js b/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js index 9dad9fb671f..9d387d850a7 100644 --- a/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js +++ b/tests/baselines/reference/typeCheckingInsideFunctionExpressionInArray.js @@ -9,8 +9,8 @@ var functions = [function () { //// [typeCheckingInsideFunctionExpressionInArray.js] var functions = [function () { - var k = 10; - k = new Object(); - [1, 2, 3].NonexistantMethod(); - derp(); - }]; + var k = 10; + k = new Object(); + [1, 2, 3].NonexistantMethod(); + derp(); +}]; diff --git a/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js b/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js index f314f9ad111..94211010677 100644 --- a/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js +++ b/tests/baselines/reference/undefinedSymbolReferencedInArrayLiteral1.js @@ -11,6 +11,6 @@ var functions = [function() { //// [undefinedSymbolReferencedInArrayLiteral1.js] var tokens = [{ startIndex: deltaOffset }]; var functions = [function () { - [1, 2, 3].NonexistantMethod(); - anotherNonExistingMethod(); - }]; + [1, 2, 3].NonexistantMethod(); + anotherNonExistingMethod(); +}]; diff --git a/tests/baselines/reference/wrappedAndRecursiveConstraints3.js b/tests/baselines/reference/wrappedAndRecursiveConstraints3.js index fb0f5388aaa..01f591de323 100644 --- a/tests/baselines/reference/wrappedAndRecursiveConstraints3.js +++ b/tests/baselines/reference/wrappedAndRecursiveConstraints3.js @@ -30,6 +30,6 @@ var C = (function () { })(); var c = new C({ length: 2 }); var r = c.foo({ length: 3, charAt: function (x) { - ''; - } }); + ''; +} }); var r2 = r(''); diff --git a/tests/baselines/reference/wrappedAndRecursiveConstraints4.js b/tests/baselines/reference/wrappedAndRecursiveConstraints4.js index 998c16a9f87..da4117860a7 100644 --- a/tests/baselines/reference/wrappedAndRecursiveConstraints4.js +++ b/tests/baselines/reference/wrappedAndRecursiveConstraints4.js @@ -28,5 +28,5 @@ var C = (function () { var c = new C({ length: 2 }); var r = c.foo(''); var r2 = r({ length: 3, charAt: function (x) { - ''; - } }); // error + ''; +} }); // error From b99d70c212c4a31beb137618128af2d1ebb8f747 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sat, 21 Feb 2015 15:11:37 -0800 Subject: [PATCH 161/162] Preserve newlines between object literal members. --- src/compiler/emitter.ts | 35 +++++-------------- .../baselines/reference/APISample_compile.js | 6 ++-- .../reference/YieldExpression10_es6.js | 5 +-- tests/baselines/reference/classExpression.js | 4 +-- .../reference/computedPropertyNames49_ES5.js | 20 +++++------ .../reference/computedPropertyNames50_ES5.js | 20 +++++------ .../reference/nestedClassDeclaration.js | 3 +- .../reference/objectLiteralWithSemicolons4.js | 3 +- .../objectTypesWithOptionalProperties2.js | 3 +- .../parserErrorRecovery_ObjectLiteral2.js | 3 +- .../parserErrorRecovery_ObjectLiteral3.js | 3 +- .../parserErrorRecovery_ObjectLiteral4.js | 3 +- .../parserErrorRecovery_ObjectLiteral5.js | 3 +- .../reference/parserSymbolIndexer5.js | 3 +- tests/baselines/reference/parserharness.js | 4 +-- tests/baselines/reference/targetTypeTest1.js | 9 +++-- .../templateStringInObjectLiteral.js | 3 +- .../templateStringInObjectLiteralES6.js | 3 +- .../wrappedAndRecursiveConstraints3.js | 4 +-- .../wrappedAndRecursiveConstraints4.js | 4 +-- 20 files changed, 59 insertions(+), 82 deletions(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index ac9e360c21c..ca6adc53169 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -2546,32 +2546,6 @@ module ts { } } - function emitObjectLiteralBody(node: ObjectLiteralExpression, numElements: number) { - write("{"); - - var multiLine = (node.flags & NodeFlags.MultiLine) !== 0; - - if (numElements > 0) { - var properties = node.properties; - if (!multiLine) { - write(" "); - } - else { - increaseIndent(); - } - emitList(properties, 0, numElements, /*multiLine*/ multiLine, - /*trailingComma*/ properties.hasTrailingComma && languageVersion >= ScriptTarget.ES5); - if (!multiLine) { - write(" "); - } - else { - decreaseIndent(); - } - } - - write("}"); - } - function createSynthesizedNode(kind: SyntaxKind): Node { var node = createNode(kind); node.pos = -1; @@ -2801,7 +2775,14 @@ module ts { // Ordinary case: either the object has no computed properties // or we're compiling with an ES6+ target. - emitObjectLiteralBody(node, properties.length); + write("{"); + + var properties = node.properties; + if (properties.length) { + emitLinePreservingList(node, properties, /*allowTrailingComma:*/ languageVersion >= ScriptTarget.ES5, /*spacesBetweenBraces:*/ true) + } + + write("}"); } function emitComputedPropertyName(node: ComputedPropertyName) { diff --git a/tests/baselines/reference/APISample_compile.js b/tests/baselines/reference/APISample_compile.js index edc4ee297aa..b7ae84a2312 100644 --- a/tests/baselines/reference/APISample_compile.js +++ b/tests/baselines/reference/APISample_compile.js @@ -1965,8 +1965,6 @@ function compile(fileNames, options) { } exports.compile = compile; compile(process.argv.slice(2), { - noEmitOnError: true, - noImplicitAny: true, - target: 1 /* ES5 */, - module: 1 /* CommonJS */ + noEmitOnError: true, noImplicitAny: true, + target: 1 /* ES5 */, module: 1 /* CommonJS */ }); diff --git a/tests/baselines/reference/YieldExpression10_es6.js b/tests/baselines/reference/YieldExpression10_es6.js index f111e6e1bdf..3bae1b645fe 100644 --- a/tests/baselines/reference/YieldExpression10_es6.js +++ b/tests/baselines/reference/YieldExpression10_es6.js @@ -7,5 +7,6 @@ var v = { * foo() { //// [YieldExpression10_es6.js] var v = { foo: function () { - ; -} }; + ; + } +}; diff --git a/tests/baselines/reference/classExpression.js b/tests/baselines/reference/classExpression.js index 9d902abbf52..6bcf0f46f74 100644 --- a/tests/baselines/reference/classExpression.js +++ b/tests/baselines/reference/classExpression.js @@ -20,9 +20,7 @@ var C = (function () { return C; })(); var y = { - foo: , - class: C2 -}, _a = void 0; + foo: , class: C2 }, _a = void 0; var M; (function (M) { var z = ; diff --git a/tests/baselines/reference/computedPropertyNames49_ES5.js b/tests/baselines/reference/computedPropertyNames49_ES5.js index 8aefd49a4a8..a64d9431a9a 100644 --- a/tests/baselines/reference/computedPropertyNames49_ES5.js +++ b/tests/baselines/reference/computedPropertyNames49_ES5.js @@ -30,17 +30,17 @@ var x = (_a = { p1: 10 }, _a.p1 = 10, _a[1 + 1] = Object.defineProperty({ get: function () { - throw 10; -}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { - return 10; -}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ set: function () { - // just throw - throw 10; -}, enumerable: true, configurable: true }), _a.foo = Object.defineProperty({ get: function () { - if (1 == 1) { + throw 10; + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { return 10; - } -}, enumerable: true, configurable: true }), _a.p2 = + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ set: function () { + // just throw + throw 10; + }, enumerable: true, configurable: true }), _a.foo = Object.defineProperty({ get: function () { + if (1 == 1) { + return 10; + } + }, enumerable: true, configurable: true }), _a.p2 = 20, _a); var _a; diff --git a/tests/baselines/reference/computedPropertyNames50_ES5.js b/tests/baselines/reference/computedPropertyNames50_ES5.js index e0fd3dfbcd7..a0703eeac05 100644 --- a/tests/baselines/reference/computedPropertyNames50_ES5.js +++ b/tests/baselines/reference/computedPropertyNames50_ES5.js @@ -35,17 +35,17 @@ var x = (_a = { } }, _a.p1 = 10, _a.foo = Object.defineProperty({ get: function () { - if (1 == 1) { + if (1 == 1) { + return 10; + } + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { + throw 10; + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ set: function () { + // just throw + throw 10; + }, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { return 10; - } -}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { - throw 10; -}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ set: function () { - // just throw - throw 10; -}, enumerable: true, configurable: true }), _a[1 + 1] = Object.defineProperty({ get: function () { - return 10; -}, enumerable: true, configurable: true }), _a.p2 = + }, enumerable: true, configurable: true }), _a.p2 = 20, _a); var _a; diff --git a/tests/baselines/reference/nestedClassDeclaration.js b/tests/baselines/reference/nestedClassDeclaration.js index fa69ef5950e..70445b3372f 100644 --- a/tests/baselines/reference/nestedClassDeclaration.js +++ b/tests/baselines/reference/nestedClassDeclaration.js @@ -37,5 +37,4 @@ var C3 = (function () { return C3; })(); var x = { - class: C4 -}, _a = void 0; + class: C4 }, _a = void 0; diff --git a/tests/baselines/reference/objectLiteralWithSemicolons4.js b/tests/baselines/reference/objectLiteralWithSemicolons4.js index 9e1e3dea4b9..a01d52548ee 100644 --- a/tests/baselines/reference/objectLiteralWithSemicolons4.js +++ b/tests/baselines/reference/objectLiteralWithSemicolons4.js @@ -5,5 +5,4 @@ var v = { //// [objectLiteralWithSemicolons4.js] var v = { - a: -}; + a: }; diff --git a/tests/baselines/reference/objectTypesWithOptionalProperties2.js b/tests/baselines/reference/objectTypesWithOptionalProperties2.js index 7a237223d7c..cf0d113c244 100644 --- a/tests/baselines/reference/objectTypesWithOptionalProperties2.js +++ b/tests/baselines/reference/objectTypesWithOptionalProperties2.js @@ -42,6 +42,5 @@ var C2 = (function () { return C2; })(); var b = { - x: function () { }, - 1: // error + x: function () { }, 1: // error }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js index 08dc96d38ef..6a703759fff 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral2.js @@ -3,4 +3,5 @@ var v = { a return; //// [parserErrorRecovery_ObjectLiteral2.js] -var v = { a: , return: }; +var v = { a: , + return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js index 1ea23d59112..eecf45fea4f 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral3.js @@ -3,4 +3,5 @@ var v = { a: return; //// [parserErrorRecovery_ObjectLiteral3.js] -var v = { a: , return: }; +var v = { a: , + return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js index 4fe49788740..87a1a31437e 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral4.js @@ -3,4 +3,5 @@ var v = { a: 1 return; //// [parserErrorRecovery_ObjectLiteral4.js] -var v = { a: 1, return: }; +var v = { a: 1, + return: }; diff --git a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js index cf55b59c711..97e618946a0 100644 --- a/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js +++ b/tests/baselines/reference/parserErrorRecovery_ObjectLiteral5.js @@ -3,4 +3,5 @@ var v = { a: 1, return; //// [parserErrorRecovery_ObjectLiteral5.js] -var v = { a: 1, return: }; +var v = { a: 1, + return: }; diff --git a/tests/baselines/reference/parserSymbolIndexer5.js b/tests/baselines/reference/parserSymbolIndexer5.js index 43c456b64aa..3aa046e2114 100644 --- a/tests/baselines/reference/parserSymbolIndexer5.js +++ b/tests/baselines/reference/parserSymbolIndexer5.js @@ -5,6 +5,5 @@ var x = { //// [parserSymbolIndexer5.js] var x = { - [s]: symbol, - "": + [s]: symbol, "": }; diff --git a/tests/baselines/reference/parserharness.js b/tests/baselines/reference/parserharness.js index 64e8b13ab9d..02304380013 100644 --- a/tests/baselines/reference/parserharness.js +++ b/tests/baselines/reference/parserharness.js @@ -2627,9 +2627,7 @@ var Harness; var description = b.description + (prop ? ": " + prop : ''); emitLog('testStart', { desc: description }); emitLog('pass', { - desc: description, - pass: true, - perfResults: { + desc: description, pass: true, perfResults: { mean: b.results[prop].mean(), min: b.results[prop].min(), max: b.results[prop].max(), diff --git a/tests/baselines/reference/targetTypeTest1.js b/tests/baselines/reference/targetTypeTest1.js index 38ca34843e8..8f9657ee9d0 100644 --- a/tests/baselines/reference/targetTypeTest1.js +++ b/tests/baselines/reference/targetTypeTest1.js @@ -109,6 +109,9 @@ function C(a, b) { this.b = b; } C.prototype = - { a: 0, b: 0, C1M1: function (c, d) { - return (this.a + c) + (this.b + d); - } }; + { a: 0, + b: 0, + C1M1: function (c, d) { + return (this.a + c) + (this.b + d); + } + }; diff --git a/tests/baselines/reference/templateStringInObjectLiteral.js b/tests/baselines/reference/templateStringInObjectLiteral.js index b026aedf4d3..6df5a64d78a 100644 --- a/tests/baselines/reference/templateStringInObjectLiteral.js +++ b/tests/baselines/reference/templateStringInObjectLiteral.js @@ -6,6 +6,5 @@ var x = { //// [templateStringInObjectLiteral.js] var x = { - a: "abc" + 123 + "def" -} "b"; + a: "abc" + 123 + "def" } "b"; 321; diff --git a/tests/baselines/reference/templateStringInObjectLiteralES6.js b/tests/baselines/reference/templateStringInObjectLiteralES6.js index 22144e75247..7de012185a9 100644 --- a/tests/baselines/reference/templateStringInObjectLiteralES6.js +++ b/tests/baselines/reference/templateStringInObjectLiteralES6.js @@ -6,6 +6,5 @@ var x = { //// [templateStringInObjectLiteralES6.js] var x = { - a: `abc${123}def`, -} `b`; + a: `abc${123}def`, } `b`; 321; diff --git a/tests/baselines/reference/wrappedAndRecursiveConstraints3.js b/tests/baselines/reference/wrappedAndRecursiveConstraints3.js index 01f591de323..fb0f5388aaa 100644 --- a/tests/baselines/reference/wrappedAndRecursiveConstraints3.js +++ b/tests/baselines/reference/wrappedAndRecursiveConstraints3.js @@ -30,6 +30,6 @@ var C = (function () { })(); var c = new C({ length: 2 }); var r = c.foo({ length: 3, charAt: function (x) { - ''; -} }); + ''; + } }); var r2 = r(''); diff --git a/tests/baselines/reference/wrappedAndRecursiveConstraints4.js b/tests/baselines/reference/wrappedAndRecursiveConstraints4.js index da4117860a7..998c16a9f87 100644 --- a/tests/baselines/reference/wrappedAndRecursiveConstraints4.js +++ b/tests/baselines/reference/wrappedAndRecursiveConstraints4.js @@ -28,5 +28,5 @@ var C = (function () { var c = new C({ length: 2 }); var r = c.foo(''); var r2 = r({ length: 3, charAt: function (x) { - ''; -} }); // error + ''; + } }); // error From ca92653aba44d437476822907493f1386890e5b4 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Sat, 21 Feb 2015 19:33:53 -0800 Subject: [PATCH 162/162] Addressing CR feedback --- src/compiler/checker.ts | 3 ++- .../restElementWithNullInitializer.errors.txt | 24 +++++++++++++++--- .../restElementWithNullInitializer.js | 25 +++++++++++++++++-- .../restElementWithNullInitializer.ts | 12 ++++++++- 4 files changed, 56 insertions(+), 8 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a06de62be8d..01d63c7d85f 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1721,7 +1721,7 @@ module ts { } } else { - // For an array binding element the specified or inferred type of the parent must be assignable to any[] + // For an array binding element the specified or inferred type of the parent must be an array-like type if (!isArrayLikeType(parentType)) { error(pattern, Diagnostics.Type_0_is_not_an_array_type, typeToString(parentType)); return unknownType; @@ -4191,6 +4191,7 @@ module ts { } function isArrayLikeType(type: Type): boolean { + // A type is array-like if it is not the undefined or null type and if it is assignable to any[] return !(type.flags & (TypeFlags.Undefined | TypeFlags.Null)) && isTypeAssignableTo(type, anyArrayType); } diff --git a/tests/baselines/reference/restElementWithNullInitializer.errors.txt b/tests/baselines/reference/restElementWithNullInitializer.errors.txt index b1222ebc0e7..7beb7b9a642 100644 --- a/tests/baselines/reference/restElementWithNullInitializer.errors.txt +++ b/tests/baselines/reference/restElementWithNullInitializer.errors.txt @@ -1,8 +1,24 @@ -tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(1,14): error TS2461: Type 'null' is not an array type. +tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(1,15): error TS2461: Type 'null' is not an array type. +tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(4,15): error TS2461: Type 'undefined' is not an array type. +tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts(7,15): error TS2461: Type '{ [x: number]: undefined; }' is not an array type. -==== tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts (1 errors) ==== - function foo([...r] = null) { } - ~~~~~~ +==== tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts (3 errors) ==== + function foo1([...r] = null) { + ~~~~~~ !!! error TS2461: Type 'null' is not an array type. + } + + function foo2([...r] = undefined) { + ~~~~~~ +!!! error TS2461: Type 'undefined' is not an array type. + } + + function foo3([...r] = {}) { + ~~~~~~ +!!! error TS2461: Type '{ [x: number]: undefined; }' is not an array type. + } + + function foo4([...r] = []) { + } \ No newline at end of file diff --git a/tests/baselines/reference/restElementWithNullInitializer.js b/tests/baselines/reference/restElementWithNullInitializer.js index a4056c665f3..9f326602fb8 100644 --- a/tests/baselines/reference/restElementWithNullInitializer.js +++ b/tests/baselines/reference/restElementWithNullInitializer.js @@ -1,6 +1,27 @@ //// [restElementWithNullInitializer.ts] -function foo([...r] = null) { } +function foo1([...r] = null) { +} + +function foo2([...r] = undefined) { +} + +function foo3([...r] = {}) { +} + +function foo4([...r] = []) { +} //// [restElementWithNullInitializer.js] -function foo(_a) { } +function foo1(_a) { + var _b = _a === void 0 ? null : _a, r = _b.slice(0); +} +function foo2(_a) { + var _b = _a === void 0 ? undefined : _a, r = _b.slice(0); +} +function foo3(_a) { + var _b = _a === void 0 ? {} : _a, r = _b.slice(0); +} +function foo4(_a) { + var _b = _a === void 0 ? [] : _a, r = _b.slice(0); +} diff --git a/tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts b/tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts index f136633e094..1b03c533e7d 100644 --- a/tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts +++ b/tests/cases/conformance/es6/destructuring/restElementWithNullInitializer.ts @@ -1 +1,11 @@ -function foo([...r] = null) { } +function foo1([...r] = null) { +} + +function foo2([...r] = undefined) { +} + +function foo3([...r] = {}) { +} + +function foo4([...r] = []) { +}