From 3fdd66bddf8174a443f11c4bad1cf19e76c08b34 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 2 Apr 2019 13:15:02 -0700 Subject: [PATCH 01/15] Report program's source files even when there are errors when building using --build mode --- src/compiler/tsbuild.ts | 35 +++++++++++++------ src/compiler/watch.ts | 15 ++++---- src/testRunner/unittests/tsbuild/sample.ts | 6 ++-- .../unittests/tsbuild/transitiveReferences.ts | 2 ++ 4 files changed, 39 insertions(+), 19 deletions(-) diff --git a/src/compiler/tsbuild.ts b/src/compiler/tsbuild.ts index 16e6e42272e..f60641fe0cf 100644 --- a/src/compiler/tsbuild.ts +++ b/src/compiler/tsbuild.ts @@ -394,7 +394,7 @@ namespace ts { const projectStatus = createFileMap(toPath); const missingRoots = createMap(); let globalDependencyGraph: DependencyGraph | undefined; - const writeFileName = (s: string) => host.trace && host.trace(s); + const writeFileName = host.trace ? (s: string) => host.trace!(s) : undefined; let readFileWithCache = (f: string) => host.readFile(f); let projectCompilerOptions = baseCompilerOptions; const compilerHost = createCompilerHostFromProgramHost(host, () => projectCompilerOptions); @@ -1129,7 +1129,7 @@ namespace ts { let declDiagnostics: Diagnostic[] | undefined; const reportDeclarationDiagnostics = (d: Diagnostic) => (declDiagnostics || (declDiagnostics = [])).push(d); const outputFiles: OutputFile[] = []; - emitFilesAndReportErrors(program, reportDeclarationDiagnostics, writeFileName, /*reportSummary*/ undefined, (name, text, writeByteOrderMark) => outputFiles.push({ name, text, writeByteOrderMark })); + emitFilesAndReportErrors(program, reportDeclarationDiagnostics, /*writeFileName*/ undefined, /*reportSummary*/ undefined, (name, text, writeByteOrderMark) => outputFiles.push({ name, text, writeByteOrderMark })); // Don't emit .d.ts if there are decl file errors if (declDiagnostics) { program.restoreState(); @@ -1138,7 +1138,7 @@ namespace ts { // Actual Emit const emitterDiagnostics = createDiagnosticCollection(); - const emittedOutputs = createFileMap(toPath as ToPath); + const emittedOutputs = createFileMap(toPath as ToPath); outputFiles.forEach(({ name, text, writeByteOrderMark }) => { let priorChangeTime: Date | undefined; if (!anyDtsChanged && isDeclarationFile(name)) { @@ -1152,7 +1152,7 @@ namespace ts { } } - emittedOutputs.setValue(name, true); + emittedOutputs.setValue(name, name); writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); if (priorChangeTime !== undefined) { newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime); @@ -1165,6 +1165,11 @@ namespace ts { return buildErrors(emitDiagnostics, BuildResultFlags.EmitErrors, "Emit"); } + if (writeFileName) { + emittedOutputs.forEach(name => listEmittedFile(configFile, name)); + listFiles(program, writeFileName); + } + // Update time stamps for rest of the outputs newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(configFile, newestDeclarationFileContentChangedTime, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); @@ -1182,6 +1187,8 @@ namespace ts { function buildErrors(diagnostics: ReadonlyArray, errorFlags: BuildResultFlags, errorType: string) { resultFlags |= errorFlags; reportAndStoreErrors(proj, diagnostics); + // List files if any other build error using program (emit errors already report files) + if (writeFileName) listFiles(program, writeFileName); projectStatus.setValue(proj, { type: UpToDateStatusType.Unbuildable, reason: `${errorType} errors` }); afterProgramCreate(proj, program); projectCompilerOptions = baseCompilerOptions; @@ -1189,6 +1196,12 @@ namespace ts { } } + function listEmittedFile(proj: ParsedCommandLine, file: string) { + if (writeFileName && proj.options.listEmittedFiles) { + writeFileName(`TSFILE: ${file}`); + } + } + function afterProgramCreate(proj: ResolvedConfigFileName, program: T) { if (host.afterProgramEmitAndDiagnostics) { host.afterProgramEmitAndDiagnostics(program); @@ -1229,9 +1242,9 @@ namespace ts { // Actual Emit Debug.assert(!!outputFiles.length); const emitterDiagnostics = createDiagnosticCollection(); - const emittedOutputs = createFileMap(toPath as ToPath); + const emittedOutputs = createFileMap(toPath as ToPath); outputFiles.forEach(({ name, text, writeByteOrderMark }) => { - emittedOutputs.setValue(name, true); + emittedOutputs.setValue(name, name); writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark); }); const emitDiagnostics = emitterDiagnostics.getDiagnostics(); @@ -1242,6 +1255,10 @@ namespace ts { return BuildResultFlags.DeclarationOutputUnchanged | BuildResultFlags.EmitErrors; } + if (writeFileName) { + emittedOutputs.forEach(name => listEmittedFile(config, name)); + } + // Update timestamps for dts const newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(config, minimumDate, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs); @@ -1270,7 +1287,7 @@ namespace ts { projectStatus.setValue(proj.options.configFilePath as ResolvedConfigFilePath, status); } - function updateOutputTimestampsWorker(proj: ParsedCommandLine, priorNewestUpdateTime: Date, verboseMessage: DiagnosticMessage, skipOutputs?: FileMap) { + function updateOutputTimestampsWorker(proj: ParsedCommandLine, priorNewestUpdateTime: Date, verboseMessage: DiagnosticMessage, skipOutputs?: FileMap) { const outputs = getAllProjectOutputs(proj, !host.useCaseSensitiveFileNames()); if (!skipOutputs || outputs.length !== skipOutputs.getSize()) { if (options.verbose) { @@ -1287,9 +1304,7 @@ namespace ts { } host.setModifiedTime(file, now); - if (proj.options.listEmittedFiles) { - writeFileName(`TSFILE: ${file}`); - } + listEmittedFile(proj, file); } } diff --git a/src/compiler/watch.ts b/src/compiler/watch.ts index 9b08c54222f..f9bf2a8468d 100644 --- a/src/compiler/watch.ts +++ b/src/compiler/watch.ts @@ -121,6 +121,14 @@ namespace ts { emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult; } + export function listFiles(program: ProgramToEmitFilesAndReportErrors, writeFileName: (s: string) => void) { + if (program.getCompilerOptions().listFiles) { + forEach(program.getSourceFiles(), file => { + writeFileName(file.fileName); + }); + } + } + /** * Helper that emit files, report diagnostics and lists emitted and/or source files depending on compiler options */ @@ -152,12 +160,7 @@ namespace ts { const filepath = getNormalizedAbsolutePath(file, currentDir); writeFileName(`TSFILE: ${filepath}`); }); - - if (program.getCompilerOptions().listFiles) { - forEach(program.getSourceFiles(), file => { - writeFileName(file.fileName); - }); - } + listFiles(program, writeFileName); } if (reportSummary) { diff --git a/src/testRunner/unittests/tsbuild/sample.ts b/src/testRunner/unittests/tsbuild/sample.ts index 6d128b348cc..588eb256eda 100644 --- a/src/testRunner/unittests/tsbuild/sample.ts +++ b/src/testRunner/unittests/tsbuild/sample.ts @@ -427,14 +427,14 @@ export class cNew {}`); builder.buildAllProjects(); assert.deepEqual(host.traces, [ "TSFILE: /src/core/anotherModule.js", - "TSFILE: /src/core/anotherModule.d.ts", "TSFILE: /src/core/anotherModule.d.ts.map", + "TSFILE: /src/core/anotherModule.d.ts", "TSFILE: /src/core/index.js", - "TSFILE: /src/core/index.d.ts", "TSFILE: /src/core/index.d.ts.map", + "TSFILE: /src/core/index.d.ts", "TSFILE: /src/core/tsconfig.tsbuildinfo", - "TSFILE: /src/logic/index.js", "TSFILE: /src/logic/index.js.map", + "TSFILE: /src/logic/index.js", "TSFILE: /src/logic/index.d.ts", "TSFILE: /src/logic/tsconfig.tsbuildinfo", "TSFILE: /src/tests/index.js", diff --git a/src/testRunner/unittests/tsbuild/transitiveReferences.ts b/src/testRunner/unittests/tsbuild/transitiveReferences.ts index 201c89c7b5b..7944d1fda09 100644 --- a/src/testRunner/unittests/tsbuild/transitiveReferences.ts +++ b/src/testRunner/unittests/tsbuild/transitiveReferences.ts @@ -65,6 +65,8 @@ export const b = new A();`); const expectedFileTraces = [ ...getLibs(), "/src/a.ts", + ...getLibs(), + "/src/b.ts" ]; verifyBuild(fs => modifyFsBTsToNonRelativeImport(fs, "node"), allExpectedOutputs, From c07f219cca6a8bdf50f924e81ed47623bdb3ac86 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Mon, 1 Apr 2019 15:29:32 -0700 Subject: [PATCH 02/15] Add failing test --- .../compiler/jsFileCompilationBindDeepExportsAssignment.ts | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 tests/cases/compiler/jsFileCompilationBindDeepExportsAssignment.ts diff --git a/tests/cases/compiler/jsFileCompilationBindDeepExportsAssignment.ts b/tests/cases/compiler/jsFileCompilationBindDeepExportsAssignment.ts new file mode 100644 index 00000000000..c4e53e2d4cf --- /dev/null +++ b/tests/cases/compiler/jsFileCompilationBindDeepExportsAssignment.ts @@ -0,0 +1,5 @@ +// @allowJs: true +// @noEmit: true +// @filename: a.js + +exports.a.b.c = 0; From d6df34bc4851ae0bde083ee2b5e9cd7d97f37510 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 2 Apr 2019 14:01:05 -0700 Subject: [PATCH 03/15] =?UTF-8?q?Don=E2=80=99t=20crash=20in=20forEachIdent?= =?UTF-8?q?ifierInEntityName?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/compiler/binder.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/compiler/binder.ts b/src/compiler/binder.ts index ff11b09f0fe..ad02d84a35b 100644 --- a/src/compiler/binder.ts +++ b/src/compiler/binder.ts @@ -2710,8 +2710,7 @@ namespace ts { } else { const s = forEachIdentifierInEntityName(e.expression, parent, action); - if (!s || !s.exports) return Debug.fail(); - return action(e.name, s.exports.get(e.name.escapedText), s); + return action(e.name, s && s.exports && s.exports.get(e.name.escapedText), s); } } From 85135c38c1759de58bcc86f861ac4e408fdeb74e Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Tue, 2 Apr 2019 14:01:57 -0700 Subject: [PATCH 04/15] Add baselines for new test --- ...leCompilationBindDeepExportsAssignment.errors.txt | 8 ++++++++ ...sFileCompilationBindDeepExportsAssignment.symbols | 4 ++++ .../jsFileCompilationBindDeepExportsAssignment.types | 12 ++++++++++++ .../jsFileCompilationBindDeepExportsAssignment.ts | 1 + 4 files changed, 25 insertions(+) create mode 100644 tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.errors.txt create mode 100644 tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.symbols create mode 100644 tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.types diff --git a/tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.errors.txt b/tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.errors.txt new file mode 100644 index 00000000000..11c68e5603f --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.errors.txt @@ -0,0 +1,8 @@ +tests/cases/compiler/a.js(1,9): error TS2339: Property 'a' does not exist on type 'typeof import("tests/cases/compiler/a")'. + + +==== tests/cases/compiler/a.js (1 errors) ==== + exports.a.b.c = 0; + ~ +!!! error TS2339: Property 'a' does not exist on type 'typeof import("tests/cases/compiler/a")'. + \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.symbols b/tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.symbols new file mode 100644 index 00000000000..06acf3481da --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.symbols @@ -0,0 +1,4 @@ +=== tests/cases/compiler/a.js === +exports.a.b.c = 0; +>exports : Symbol("tests/cases/compiler/a", Decl(a.js, 0, 0)) + diff --git a/tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.types b/tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.types new file mode 100644 index 00000000000..a30ecf717c3 --- /dev/null +++ b/tests/baselines/reference/jsFileCompilationBindDeepExportsAssignment.types @@ -0,0 +1,12 @@ +=== tests/cases/compiler/a.js === +exports.a.b.c = 0; +>exports.a.b.c = 0 : 0 +>exports.a.b.c : any +>exports.a.b : any +>exports.a : any +>exports : typeof import("tests/cases/compiler/a") +>a : any +>b : any +>c : any +>0 : 0 + diff --git a/tests/cases/compiler/jsFileCompilationBindDeepExportsAssignment.ts b/tests/cases/compiler/jsFileCompilationBindDeepExportsAssignment.ts index c4e53e2d4cf..5d3de3e0d2e 100644 --- a/tests/cases/compiler/jsFileCompilationBindDeepExportsAssignment.ts +++ b/tests/cases/compiler/jsFileCompilationBindDeepExportsAssignment.ts @@ -1,5 +1,6 @@ // @allowJs: true // @noEmit: true +// @checkJs: true // @filename: a.js exports.a.b.c = 0; From b559e813f49a2440391e90eed264bdfb15edc7b0 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 2 Apr 2019 14:23:28 -0700 Subject: [PATCH 05/15] Add test when module resolution resolves to original file of referenced project with --out Test for #30591 --- .../unittests/tsbuild/amdModulesWithOut.ts | 45 +++++++++++++++++++ src/testRunner/unittests/tsbuild/helpers.ts | 5 ++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts index 28f80bd44cb..70f3fe187c8 100644 --- a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts +++ b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts @@ -198,6 +198,51 @@ ${internal} export enum internalEnum { a, b, c }`); modifyAgainFs: fs => replaceText(fs, sources[project.lib][source.ts][1], `export const`, `/*@internal*/ export const`), }); }); + + describe("when the module resolution finds original source file", () => { + function modifyFs(fs: vfs.FileSystem) { + // Make lib to output to parent dir + replaceText(fs, sources[project.lib][source.config], `"outFile": "module.js"`, `"outFile": "../module.js", "rootDir": "../"`); + // Change reference to file1 module to resolve to lib/file1 + replaceText(fs, sources[project.app][source.ts][0], "file1", "lib/file1"); + } + + const libOutputFile: OutputFile = [ + "/src/lib/module.js", + "/src/lib/module.js.map", + "/src/lib/module.d.ts", + "/src/lib/module.d.ts.map", + "/src/lib/module.tsbuildinfo" + ]; + verifyTsbuildOutput({ + scenario: "when the module resolution finds original source file", + projFs: () => outFileFs, + time, + tick, + proj: "amdModulesWithOut", + rootNames: ["/src/app"], + expectedMapFileNames: [ + libOutputFile[ext.jsmap], + libOutputFile[ext.dtsmap], + outputFiles[project.app][ext.jsmap], + outputFiles[project.app][ext.dtsmap], + ], + expectedBuildInfoFilesForSectionBaselines: [ + [libOutputFile[ext.buildinfo], libOutputFile[ext.js], libOutputFile[ext.dts]], + [outputFiles[project.app][ext.buildinfo], outputFiles[project.app][ext.js], outputFiles[project.app][ext.dts]] + ], + lastProjectOutputJs: outputFiles[project.app][ext.js], + initialBuild: { + modifyFs + }, + outputFiles: [ + ...libOutputFile, + ...outputFiles[project.app] + ], + baselineOnly: true, + verifyDiagnostics: true + }); + }); }); }); } diff --git a/src/testRunner/unittests/tsbuild/helpers.ts b/src/testRunner/unittests/tsbuild/helpers.ts index 9672da1ff79..6915dd5d3b7 100644 --- a/src/testRunner/unittests/tsbuild/helpers.ts +++ b/src/testRunner/unittests/tsbuild/helpers.ts @@ -234,10 +234,11 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(arrayFrom(mapDefinedIt incrementalDtsUnchangedBuild?: BuildState; incrementalHeaderChangedBuild?: BuildState; baselineOnly?: true; + verifyDiagnostics?: true; } export function verifyTsbuildOutput({ - scenario, projFs, time, tick, proj, rootNames, outputFiles, baselineOnly, + scenario, projFs, time, tick, proj, rootNames, outputFiles, baselineOnly, verifyDiagnostics, expectedMapFileNames, expectedBuildInfoFilesForSectionBaselines, lastProjectOutputJs, initialBuild, incrementalDtsChangedBuild, incrementalDtsUnchangedBuild, incrementalHeaderChangedBuild }: VerifyTsBuildInput) { @@ -264,7 +265,7 @@ Mismatch Actual(path, actual, expected): ${JSON.stringify(arrayFrom(mapDefinedIt host = undefined!; }); describe("initialBuild", () => { - if (!baselineOnly) { + if (!baselineOnly || verifyDiagnostics) { it(`verify diagnostics`, () => { host.assertDiagnosticMessages(...(initialBuild.expectedDiagnostics || emptyArray)); }); From 602aec2f7d9cd539f71c6c81f42985d8916a1422 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 2 Apr 2019 14:37:00 -0700 Subject: [PATCH 06/15] Never create redirect for sourceFiles that get emitted to single output file Fixes #30591 --- src/compiler/program.ts | 23 +- .../unittests/tsbuild/amdModulesWithOut.ts | 9 +- ...e-resolution-finds-original-source-file.js | 573 ++++++++++++++++++ 3 files changed, 598 insertions(+), 7 deletions(-) create mode 100644 tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/when-the-module-resolution-finds-original-source-file.js diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 6418f55968b..ad3121860ad 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -2266,8 +2266,13 @@ namespace ts { let redirectedPath: Path | undefined; if (refFile) { - const redirect = getProjectReferenceRedirect(fileName); - if (redirect) { + const redirectProject = getProjectReferenceRedirectProject(fileName); + if (redirectProject) { + if (redirectProject.commandLine.options.outFile || redirectProject.commandLine.options.out) { + // Shouldnt create many to 1 mapping file in --out scenario + return undefined; + } + const redirect = getProjectReferenceOutputName(redirectProject, fileName); fileName = redirect; // Once we start redirecting to a file, we can potentially come back to it // via a back-reference from another file in the .d.ts folder. If that happens we'll @@ -2364,6 +2369,11 @@ namespace ts { } function getProjectReferenceRedirect(fileName: string): string | undefined { + const referencedProject = getProjectReferenceRedirectProject(fileName); + return referencedProject && getProjectReferenceOutputName(referencedProject, fileName); + } + + function getProjectReferenceRedirectProject(fileName: string) { // Ignore dts or any of the non ts files if (!resolvedProjectReferences || !resolvedProjectReferences.length || fileExtensionIs(fileName, Extension.Dts) || !fileExtensionIsOneOf(fileName, supportedTSExtensions)) { return undefined; @@ -2371,10 +2381,11 @@ namespace ts { // If this file is produced by a referenced project, we need to rewrite it to // look in the output folder of the referenced project rather than the input - const referencedProject = getResolvedProjectReferenceToRedirect(fileName); - if (!referencedProject) { - return undefined; - } + return getResolvedProjectReferenceToRedirect(fileName); + } + + + function getProjectReferenceOutputName(referencedProject: ResolvedProjectReference, fileName: string) { const out = referencedProject.commandLine.options.outFile || referencedProject.commandLine.options.out; return out ? changeExtension(out, Extension.Dts) : diff --git a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts index 70f3fe187c8..3e1cab9b4a0 100644 --- a/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts +++ b/src/testRunner/unittests/tsbuild/amdModulesWithOut.ts @@ -233,7 +233,14 @@ ${internal} export enum internalEnum { a, b, c }`); ], lastProjectOutputJs: outputFiles[project.app][ext.js], initialBuild: { - modifyFs + modifyFs, + expectedDiagnostics: [ + getExpectedDiagnosticForProjectsInBuild("src/lib/tsconfig.json", "src/app/tsconfig.json"), + [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/lib/tsconfig.json", "src/module.js"], + [Diagnostics.Building_project_0, sources[project.lib][source.config]], + [Diagnostics.Project_0_is_out_of_date_because_output_file_1_does_not_exist, "src/app/tsconfig.json", "src/app/module.js"], + [Diagnostics.Building_project_0, sources[project.app][source.config]], + ] }, outputFiles: [ ...libOutputFile, diff --git a/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/when-the-module-resolution-finds-original-source-file.js b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/when-the-module-resolution-finds-original-source-file.js new file mode 100644 index 00000000000..119eb04f23a --- /dev/null +++ b/tests/baselines/reference/tsbuild/amdModulesWithOut/initial-Build/when-the-module-resolution-finds-original-source-file.js @@ -0,0 +1,573 @@ +//// [/src/app/file3.ts] +export const z = 30; +import { x } from "lib/file1"; + +//// [/src/app/module.d.ts] +declare const myGlob = 20; +declare module "lib/file1" { + export const x = 10; +} +declare module "lib/file2" { + export const y = 20; +} +declare const globalConst = 10; +declare module "file3" { + export const z = 30; +} +declare const myVar = 30; +//# sourceMappingURL=module.d.ts.map + +//// [/src/app/module.d.ts.map] +{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../lib/file0.ts","../lib/file1.ts","../lib/file2.ts","../lib/global.ts","file3.ts","file4.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,KAAK,CAAC;;ICAlB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;;ICApB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,WAAW,KAAK,CAAC;;ICAvB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,KAAK,KAAK,CAAC"} + +//// [/src/app/module.d.ts.map.baseline.txt] +=================================================================== +JsFile: module.d.ts +mapUrl: module.d.ts.map +sourceRoot: +sources: ../lib/file0.ts,../lib/file1.ts,../lib/file2.ts,../lib/global.ts,file3.ts,file4.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/app/module.d.ts +sourceFile:../lib/file0.ts +------------------------------------------------------------------- +>>>declare const myGlob = 20; +1 > +2 >^^^^^^^^ +3 > ^^^^^^ +4 > ^^^^^^ +5 > ^^^^^ +6 > ^ +7 > ^^^-> +1 > +2 > +3 > const +4 > myGlob +5 > = 20 +6 > ; +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 9) Source(1, 1) + SourceIndex(0) +3 >Emitted(1, 15) Source(1, 7) + SourceIndex(0) +4 >Emitted(1, 21) Source(1, 13) + SourceIndex(0) +5 >Emitted(1, 26) Source(1, 18) + SourceIndex(0) +6 >Emitted(1, 27) Source(1, 19) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.d.ts +sourceFile:../lib/file1.ts +------------------------------------------------------------------- +>>>declare module "lib/file1" { +>>> export const x = 10; +1->^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1-> +2 > export +3 > +4 > const +5 > x +6 > = 10 +7 > ; +1->Emitted(3, 5) Source(1, 1) + SourceIndex(1) +2 >Emitted(3, 11) Source(1, 7) + SourceIndex(1) +3 >Emitted(3, 12) Source(1, 8) + SourceIndex(1) +4 >Emitted(3, 18) Source(1, 14) + SourceIndex(1) +5 >Emitted(3, 19) Source(1, 15) + SourceIndex(1) +6 >Emitted(3, 24) Source(1, 20) + SourceIndex(1) +7 >Emitted(3, 25) Source(1, 21) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.d.ts +sourceFile:../lib/file2.ts +------------------------------------------------------------------- +>>>} +>>>declare module "lib/file2" { +>>> export const y = 20; +1 >^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1 > +2 > export +3 > +4 > const +5 > y +6 > = 20 +7 > ; +1 >Emitted(6, 5) Source(1, 1) + SourceIndex(2) +2 >Emitted(6, 11) Source(1, 7) + SourceIndex(2) +3 >Emitted(6, 12) Source(1, 8) + SourceIndex(2) +4 >Emitted(6, 18) Source(1, 14) + SourceIndex(2) +5 >Emitted(6, 19) Source(1, 15) + SourceIndex(2) +6 >Emitted(6, 24) Source(1, 20) + SourceIndex(2) +7 >Emitted(6, 25) Source(1, 21) + SourceIndex(2) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.d.ts +sourceFile:../lib/global.ts +------------------------------------------------------------------- +>>>} +>>>declare const globalConst = 10; +1 > +2 >^^^^^^^^ +3 > ^^^^^^ +4 > ^^^^^^^^^^^ +5 > ^^^^^ +6 > ^ +1 > +2 > +3 > const +4 > globalConst +5 > = 10 +6 > ; +1 >Emitted(8, 1) Source(1, 1) + SourceIndex(3) +2 >Emitted(8, 9) Source(1, 1) + SourceIndex(3) +3 >Emitted(8, 15) Source(1, 7) + SourceIndex(3) +4 >Emitted(8, 26) Source(1, 18) + SourceIndex(3) +5 >Emitted(8, 31) Source(1, 23) + SourceIndex(3) +6 >Emitted(8, 32) Source(1, 24) + SourceIndex(3) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.d.ts +sourceFile:file3.ts +------------------------------------------------------------------- +>>>declare module "file3" { +>>> export const z = 30; +1 >^^^^ +2 > ^^^^^^ +3 > ^ +4 > ^^^^^^ +5 > ^ +6 > ^^^^^ +7 > ^ +1 > +2 > export +3 > +4 > const +5 > z +6 > = 30 +7 > ; +1 >Emitted(10, 5) Source(1, 1) + SourceIndex(4) +2 >Emitted(10, 11) Source(1, 7) + SourceIndex(4) +3 >Emitted(10, 12) Source(1, 8) + SourceIndex(4) +4 >Emitted(10, 18) Source(1, 14) + SourceIndex(4) +5 >Emitted(10, 19) Source(1, 15) + SourceIndex(4) +6 >Emitted(10, 24) Source(1, 20) + SourceIndex(4) +7 >Emitted(10, 25) Source(1, 21) + SourceIndex(4) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.d.ts +sourceFile:file4.ts +------------------------------------------------------------------- +>>>} +>>>declare const myVar = 30; +1 > +2 >^^^^^^^^ +3 > ^^^^^^ +4 > ^^^^^ +5 > ^^^^^ +6 > ^ +7 > ^^^^^^^^^^-> +1 > +2 > +3 > const +4 > myVar +5 > = 30 +6 > ; +1 >Emitted(12, 1) Source(1, 1) + SourceIndex(5) +2 >Emitted(12, 9) Source(1, 1) + SourceIndex(5) +3 >Emitted(12, 15) Source(1, 7) + SourceIndex(5) +4 >Emitted(12, 20) Source(1, 12) + SourceIndex(5) +5 >Emitted(12, 25) Source(1, 17) + SourceIndex(5) +6 >Emitted(12, 26) Source(1, 18) + SourceIndex(5) +--- +>>>//# sourceMappingURL=module.d.ts.map + +//// [/src/app/module.js] +var myGlob = 20; +define("lib/file1", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.x = 10; +}); +define("lib/file2", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.y = 20; +}); +var globalConst = 10; +define("file3", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.z = 30; +}); +var myVar = 30; +//# sourceMappingURL=module.js.map + +//// [/src/app/module.js.map] +{"version":3,"file":"module.js","sourceRoot":"","sources":["../lib/file0.ts","../lib/file1.ts","../lib/file2.ts","../lib/global.ts","file3.ts","file4.ts"],"names":[],"mappings":"AAAA,IAAM,MAAM,GAAG,EAAE,CAAC;;;;ICAL,QAAA,CAAC,GAAG,EAAE,CAAC;;;;;ICAP,QAAA,CAAC,GAAG,EAAE,CAAC;;ACApB,IAAM,WAAW,GAAG,EAAE,CAAC;;;;ICAV,QAAA,CAAC,GAAG,EAAE,CAAC;;ACApB,IAAM,KAAK,GAAG,EAAE,CAAC"} + +//// [/src/app/module.js.map.baseline.txt] +=================================================================== +JsFile: module.js +mapUrl: module.js.map +sourceRoot: +sources: ../lib/file0.ts,../lib/file1.ts,../lib/file2.ts,../lib/global.ts,file3.ts,file4.ts +=================================================================== +------------------------------------------------------------------- +emittedFile:/src/app/module.js +sourceFile:../lib/file0.ts +------------------------------------------------------------------- +>>>var myGlob = 20; +1 > +2 >^^^^ +3 > ^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >const +3 > myGlob +4 > = +5 > 20 +6 > ; +1 >Emitted(1, 1) Source(1, 1) + SourceIndex(0) +2 >Emitted(1, 5) Source(1, 7) + SourceIndex(0) +3 >Emitted(1, 11) Source(1, 13) + SourceIndex(0) +4 >Emitted(1, 14) Source(1, 16) + SourceIndex(0) +5 >Emitted(1, 16) Source(1, 18) + SourceIndex(0) +6 >Emitted(1, 17) Source(1, 19) + SourceIndex(0) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.js +sourceFile:../lib/file1.ts +------------------------------------------------------------------- +>>>define("lib/file1", ["require", "exports"], function (require, exports) { +>>> "use strict"; +>>> Object.defineProperty(exports, "__esModule", { value: true }); +>>> exports.x = 10; +1->^^^^ +2 > ^^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^^ +6 > ^ +1->export const +2 > +3 > x +4 > = +5 > 10 +6 > ; +1->Emitted(5, 5) Source(1, 14) + SourceIndex(1) +2 >Emitted(5, 13) Source(1, 14) + SourceIndex(1) +3 >Emitted(5, 14) Source(1, 15) + SourceIndex(1) +4 >Emitted(5, 17) Source(1, 18) + SourceIndex(1) +5 >Emitted(5, 19) Source(1, 20) + SourceIndex(1) +6 >Emitted(5, 20) Source(1, 21) + SourceIndex(1) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.js +sourceFile:../lib/file2.ts +------------------------------------------------------------------- +>>>}); +>>>define("lib/file2", ["require", "exports"], function (require, exports) { +>>> "use strict"; +>>> Object.defineProperty(exports, "__esModule", { value: true }); +>>> exports.y = 20; +1 >^^^^ +2 > ^^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^^ +6 > ^ +1 >export const +2 > +3 > y +4 > = +5 > 20 +6 > ; +1 >Emitted(10, 5) Source(1, 14) + SourceIndex(2) +2 >Emitted(10, 13) Source(1, 14) + SourceIndex(2) +3 >Emitted(10, 14) Source(1, 15) + SourceIndex(2) +4 >Emitted(10, 17) Source(1, 18) + SourceIndex(2) +5 >Emitted(10, 19) Source(1, 20) + SourceIndex(2) +6 >Emitted(10, 20) Source(1, 21) + SourceIndex(2) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.js +sourceFile:../lib/global.ts +------------------------------------------------------------------- +>>>}); +>>>var globalConst = 10; +1 > +2 >^^^^ +3 > ^^^^^^^^^^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-> +1 > +2 >const +3 > globalConst +4 > = +5 > 10 +6 > ; +1 >Emitted(12, 1) Source(1, 1) + SourceIndex(3) +2 >Emitted(12, 5) Source(1, 7) + SourceIndex(3) +3 >Emitted(12, 16) Source(1, 18) + SourceIndex(3) +4 >Emitted(12, 19) Source(1, 21) + SourceIndex(3) +5 >Emitted(12, 21) Source(1, 23) + SourceIndex(3) +6 >Emitted(12, 22) Source(1, 24) + SourceIndex(3) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.js +sourceFile:file3.ts +------------------------------------------------------------------- +>>>define("file3", ["require", "exports"], function (require, exports) { +>>> "use strict"; +>>> Object.defineProperty(exports, "__esModule", { value: true }); +>>> exports.z = 30; +1->^^^^ +2 > ^^^^^^^^ +3 > ^ +4 > ^^^ +5 > ^^ +6 > ^ +1->export const +2 > +3 > z +4 > = +5 > 30 +6 > ; +1->Emitted(16, 5) Source(1, 14) + SourceIndex(4) +2 >Emitted(16, 13) Source(1, 14) + SourceIndex(4) +3 >Emitted(16, 14) Source(1, 15) + SourceIndex(4) +4 >Emitted(16, 17) Source(1, 18) + SourceIndex(4) +5 >Emitted(16, 19) Source(1, 20) + SourceIndex(4) +6 >Emitted(16, 20) Source(1, 21) + SourceIndex(4) +--- +------------------------------------------------------------------- +emittedFile:/src/app/module.js +sourceFile:file4.ts +------------------------------------------------------------------- +>>>}); +>>>var myVar = 30; +1 > +2 >^^^^ +3 > ^^^^^ +4 > ^^^ +5 > ^^ +6 > ^ +7 > ^^^^^^^^^^^^^^^^^^-> +1 > +2 >const +3 > myVar +4 > = +5 > 30 +6 > ; +1 >Emitted(18, 1) Source(1, 1) + SourceIndex(5) +2 >Emitted(18, 5) Source(1, 7) + SourceIndex(5) +3 >Emitted(18, 10) Source(1, 12) + SourceIndex(5) +4 >Emitted(18, 13) Source(1, 15) + SourceIndex(5) +5 >Emitted(18, 15) Source(1, 17) + SourceIndex(5) +6 >Emitted(18, 16) Source(1, 18) + SourceIndex(5) +--- +>>>//# sourceMappingURL=module.js.map + +//// [/src/app/module.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "/src/app/", + "sourceFiles": [ + "/src/app/file3.ts", + "/src/app/file4.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 417, + "kind": "prepend", + "data": "/src/module.js", + "texts": [ + { + "pos": 0, + "end": 417, + "kind": "text" + } + ] + }, + { + "pos": 417, + "end": 618, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 179, + "kind": "prepend", + "data": "/src/module.d.ts", + "texts": [ + { + "pos": 0, + "end": 179, + "kind": "text" + } + ] + }, + { + "pos": 179, + "end": 261, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + +//// [/src/app/module.tsbuildinfo.baseline.txt] +====================================================================== +File:: /src/app/module.js +---------------------------------------------------------------------- +prepend: (0-417):: /src/module.js texts:: 1 +>>-------------------------------------------------------------------- +text: (0-417) +var myGlob = 20; +define("lib/file1", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.x = 10; +}); +define("lib/file2", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.y = 20; +}); +var globalConst = 10; + +---------------------------------------------------------------------- +text: (417-618) +define("file3", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.z = 30; +}); +var myVar = 30; + +====================================================================== +====================================================================== +File:: /src/app/module.d.ts +---------------------------------------------------------------------- +prepend: (0-179):: /src/module.d.ts texts:: 1 +>>-------------------------------------------------------------------- +text: (0-179) +declare const myGlob = 20; +declare module "lib/file1" { + export const x = 10; +} +declare module "lib/file2" { + export const y = 20; +} +declare const globalConst = 10; + +---------------------------------------------------------------------- +text: (179-261) +declare module "file3" { + export const z = 30; +} +declare const myVar = 30; + +====================================================================== + +//// [/src/lib/tsconfig.json] +{ + "compilerOptions": { + "target": "es5", + "module": "amd", + "composite": true, + "sourceMap": true, + "declarationMap": true, + "strict": false, + "outFile": "../module.js", "rootDir": "../" + }, + "exclude": ["module.d.ts"] + +} + +//// [/src/module.d.ts] +declare const myGlob = 20; +declare module "lib/file1" { + export const x = 10; +} +declare module "lib/file2" { + export const y = 20; +} +declare const globalConst = 10; +//# sourceMappingURL=module.d.ts.map + +//// [/src/module.d.ts.map] +{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["lib/file0.ts","lib/file1.ts","lib/file2.ts","lib/global.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM,KAAK,CAAC;;ICAlB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;;ICApB,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC;;ACApB,QAAA,MAAM,WAAW,KAAK,CAAC"} + +//// [/src/module.js] +var myGlob = 20; +define("lib/file1", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.x = 10; +}); +define("lib/file2", ["require", "exports"], function (require, exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); + exports.y = 20; +}); +var globalConst = 10; +//# sourceMappingURL=module.js.map + +//// [/src/module.js.map] +{"version":3,"file":"module.js","sourceRoot":"","sources":["lib/file0.ts","lib/file1.ts","lib/file2.ts","lib/global.ts"],"names":[],"mappings":"AAAA,IAAM,MAAM,GAAG,EAAE,CAAC;;;;ICAL,QAAA,CAAC,GAAG,EAAE,CAAC;;;;;ICAP,QAAA,CAAC,GAAG,EAAE,CAAC;;ACApB,IAAM,WAAW,GAAG,EAAE,CAAC"} + +//// [/src/module.tsbuildinfo] +{ + "bundle": { + "commonSourceDirectory": "/src/", + "sourceFiles": [ + "/src/lib/file0.ts", + "/src/lib/file1.ts", + "/src/lib/file2.ts", + "/src/lib/global.ts" + ], + "js": { + "sections": [ + { + "pos": 0, + "end": 417, + "kind": "text" + } + ] + }, + "dts": { + "sections": [ + { + "pos": 0, + "end": 179, + "kind": "text" + } + ] + } + }, + "version": "FakeTSVersion" +} + From f04a40dd493626ffa7811b8c4d4054a37e7cb1c9 Mon Sep 17 00:00:00 2001 From: Ron Buckton Date: Tue, 2 Apr 2019 17:15:40 -0700 Subject: [PATCH 07/15] Treat hoisted temp variables as a custom prologue --- src/compiler/transformer.ts | 2 + .../reference/asyncArrowFunction11_es5.js | 3 +- .../reference/asyncArrowFunction8_es5.js | 3 +- .../asyncFunctionDeclaration9_es5.js | 3 +- .../bindingPatternOmittedExpressionNesting.js | 2 +- ...blockScopedBindingsInDownlevelGenerator.js | 13 ++--- ...poundExponentiationAssignmentLHSIsValue.js | 3 +- ...EmitComputedNameCausesImportToBePainted.js | 2 +- ...clarationEmitComputedNameConstEnumAlias.js | 2 +- ...tPrivateSymbolCausesVarDeclarationEmit2.js | 4 +- ...eclarationEmitWithDefaultAsComputedName.js | 2 +- ...clarationEmitWithDefaultAsComputedName2.js | 2 +- .../decoratedClassExportsCommonJS1.js | 2 +- .../decoratedClassExportsCommonJS2.js | 2 +- .../emitClassExpressionInDeclarationFile2.js | 2 +- .../reference/emitter.forAwait.es2015.js | 6 +-- .../reference/emitter.forAwait.es5.js | 18 ++++--- .../es5-asyncFunctionForOfStatements.js | 50 +++++++++++-------- .../es5-asyncFunctionObjectLiterals.js | 24 +++++---- ...ctLiteralComputedNameNoDeclarationError.js | 2 +- .../restParameterInDownlevelGenerator.js | 32 ++++++++++++ .../restParameterInDownlevelGenerator.symbols | 10 ++++ .../restParameterInDownlevelGenerator.types | 10 ++++ ...olAllowsIndexInObjectWithIndexSignature.js | 2 +- ...arationEmitUniqueSymbolPartialStatement.js | 2 +- .../restParameterInDownlevelGenerator.ts | 9 ++++ 26 files changed, 146 insertions(+), 66 deletions(-) create mode 100644 tests/baselines/reference/restParameterInDownlevelGenerator.js create mode 100644 tests/baselines/reference/restParameterInDownlevelGenerator.symbols create mode 100644 tests/baselines/reference/restParameterInDownlevelGenerator.types create mode 100644 tests/cases/conformance/generators/restParameterInDownlevelGenerator.ts diff --git a/src/compiler/transformer.ts b/src/compiler/transformer.ts index d8a2848bcc3..12d20d6c089 100644 --- a/src/compiler/transformer.ts +++ b/src/compiler/transformer.ts @@ -327,6 +327,8 @@ namespace ts { createVariableDeclarationList(lexicalEnvironmentVariableDeclarations) ); + setEmitFlags(statement, EmitFlags.CustomPrologue); + if (!statements) { statements = [statement]; } diff --git a/tests/baselines/reference/asyncArrowFunction11_es5.js b/tests/baselines/reference/asyncArrowFunction11_es5.js index 013941c96ca..5f234f2fbf6 100644 --- a/tests/baselines/reference/asyncArrowFunction11_es5.js +++ b/tests/baselines/reference/asyncArrowFunction11_es5.js @@ -53,7 +53,8 @@ var A = /** @class */ (function () { args[_i] = arguments[_i]; } return __awaiter(_this, void 0, void 0, function () { - var _a, obj; + var obj; + var _a; var _this = this; return __generator(this, function (_b) { switch (_b.label) { diff --git a/tests/baselines/reference/asyncArrowFunction8_es5.js b/tests/baselines/reference/asyncArrowFunction8_es5.js index 7e9e5a492be..aae263255b3 100644 --- a/tests/baselines/reference/asyncArrowFunction8_es5.js +++ b/tests/baselines/reference/asyncArrowFunction8_es5.js @@ -6,7 +6,8 @@ var foo = async (): Promise => { //// [asyncArrowFunction8_es5.js] var _this = this; var foo = function () { return __awaiter(_this, void 0, void 0, function () { - var _a, v; + var v; + var _a; return __generator(this, function (_b) { switch (_b.label) { case 0: diff --git a/tests/baselines/reference/asyncFunctionDeclaration9_es5.js b/tests/baselines/reference/asyncFunctionDeclaration9_es5.js index 2fd29408422..505ed08d840 100644 --- a/tests/baselines/reference/asyncFunctionDeclaration9_es5.js +++ b/tests/baselines/reference/asyncFunctionDeclaration9_es5.js @@ -6,7 +6,8 @@ async function foo(): Promise { //// [asyncFunctionDeclaration9_es5.js] function foo() { return __awaiter(this, void 0, void 0, function () { - var _a, v; + var v; + var _a; return __generator(this, function (_b) { switch (_b.label) { case 0: diff --git a/tests/baselines/reference/bindingPatternOmittedExpressionNesting.js b/tests/baselines/reference/bindingPatternOmittedExpressionNesting.js index e8a8e02a6a1..36fd6a11fad 100644 --- a/tests/baselines/reference/bindingPatternOmittedExpressionNesting.js +++ b/tests/baselines/reference/bindingPatternOmittedExpressionNesting.js @@ -3,8 +3,8 @@ export let [,,[,[],,[],]] = undefined as any; //// [bindingPatternOmittedExpressionNesting.js] "use strict"; -exports.__esModule = true; var _a, _b, _c, _d; +exports.__esModule = true; exports._e = (_a = undefined, _b = _a[2], _c = _b[1], _d = _b[3]); diff --git a/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js index e177b7d4a0a..9bb07d80b00 100644 --- a/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js +++ b/tests/baselines/reference/blockScopedBindingsInDownlevelGenerator.js @@ -45,7 +45,8 @@ var __values = (this && this.__values) || function (o) { }; }; function a() { - var e_1, _a, _loop_1, _b, _c, i, e_1_1; + var _loop_1, _a, _b, i, e_1_1; + var e_1, _c; return __generator(this, function (_d) { switch (_d.label) { case 0: @@ -64,17 +65,17 @@ function a() { _d.label = 1; case 1: _d.trys.push([1, 6, 7, 8]); - _b = __values([1, 2, 3]), _c = _b.next(); + _a = __values([1, 2, 3]), _b = _a.next(); _d.label = 2; case 2: - if (!!_c.done) return [3 /*break*/, 5]; - i = _c.value; + if (!!_b.done) return [3 /*break*/, 5]; + i = _b.value; return [5 /*yield**/, _loop_1(i)]; case 3: _d.sent(); _d.label = 4; case 4: - _c = _b.next(); + _b = _a.next(); return [3 /*break*/, 2]; case 5: return [3 /*break*/, 8]; case 6: @@ -83,7 +84,7 @@ function a() { return [3 /*break*/, 8]; case 7: try { - if (_c && !_c.done && (_a = _b.return)) _a.call(_b); + if (_b && !_b.done && (_c = _a.return)) _c.call(_a); } finally { if (e_1) throw e_1.error; } return [7 /*endfinally*/]; diff --git a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js index c5aa9eeb681..b3e1312cd69 100644 --- a/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js +++ b/tests/baselines/reference/compoundExponentiationAssignmentLHSIsValue.js @@ -148,9 +148,8 @@ _a = Math.pow(['', ''], value), '' = _a[0], '' = _a[1]; var Derived = /** @class */ (function (_super) { __extends(Derived, _super); function Derived() { - var _this = this; var _a; - _this = _super.call(this) || this; + var _this = _super.call(this) || this; (_a = _super.prototype). = Math.pow(_a., value); return _this; } diff --git a/tests/baselines/reference/declarationEmitComputedNameCausesImportToBePainted.js b/tests/baselines/reference/declarationEmitComputedNameCausesImportToBePainted.js index ee97c6b2182..65572cd4316 100644 --- a/tests/baselines/reference/declarationEmitComputedNameCausesImportToBePainted.js +++ b/tests/baselines/reference/declarationEmitComputedNameCausesImportToBePainted.js @@ -20,8 +20,8 @@ exports.__esModule = true; exports.Key = Symbol(); //// [index.js] "use strict"; -exports.__esModule = true; var _a; +exports.__esModule = true; var context_1 = require("./context"); exports.context = (_a = {}, _a[context_1.Key] = 'bar', diff --git a/tests/baselines/reference/declarationEmitComputedNameConstEnumAlias.js b/tests/baselines/reference/declarationEmitComputedNameConstEnumAlias.js index 461eb21087e..93ae03a820b 100644 --- a/tests/baselines/reference/declarationEmitComputedNameConstEnumAlias.js +++ b/tests/baselines/reference/declarationEmitComputedNameConstEnumAlias.js @@ -24,8 +24,8 @@ var EnumExample; exports["default"] = EnumExample; //// [index.js] "use strict"; -exports.__esModule = true; var _a; +exports.__esModule = true; var EnumExample_1 = require("./EnumExample"); exports["default"] = (_a = {}, _a[EnumExample_1["default"].TEST] = {}, diff --git a/tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js b/tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js index b78c104f468..ab986aba1e8 100644 --- a/tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js +++ b/tests/baselines/reference/declarationEmitPrivateSymbolCausesVarDeclarationEmit2.js @@ -25,8 +25,8 @@ exports.__esModule = true; exports.x = Symbol(); //// [b.js] "use strict"; -exports.__esModule = true; var _a; +exports.__esModule = true; var a_1 = require("./a"); var C = /** @class */ (function () { function C() { @@ -51,8 +51,8 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -exports.__esModule = true; var _a; +exports.__esModule = true; var a_1 = require("./a"); var b_1 = require("./b"); var D = /** @class */ (function (_super) { diff --git a/tests/baselines/reference/declarationEmitWithDefaultAsComputedName.js b/tests/baselines/reference/declarationEmitWithDefaultAsComputedName.js index ae45c09438f..89877887cd9 100644 --- a/tests/baselines/reference/declarationEmitWithDefaultAsComputedName.js +++ b/tests/baselines/reference/declarationEmitWithDefaultAsComputedName.js @@ -25,8 +25,8 @@ exports.default = createExperiment({ }); //// [main.js] "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); var _a; +Object.defineProperty(exports, "__esModule", { value: true }); var other_1 = require("./other"); exports.obj = (_a = {}, _a[other_1.default.name] = 1, diff --git a/tests/baselines/reference/declarationEmitWithDefaultAsComputedName2.js b/tests/baselines/reference/declarationEmitWithDefaultAsComputedName2.js index ddf89f2d57d..24db1560dca 100644 --- a/tests/baselines/reference/declarationEmitWithDefaultAsComputedName2.js +++ b/tests/baselines/reference/declarationEmitWithDefaultAsComputedName2.js @@ -25,8 +25,8 @@ exports.default = createExperiment({ }); //// [main.js] "use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); var _a; +Object.defineProperty(exports, "__esModule", { value: true }); var other2 = require("./other"); exports.obj = (_a = {}, _a[other2.default.name] = 1, diff --git a/tests/baselines/reference/decoratedClassExportsCommonJS1.js b/tests/baselines/reference/decoratedClassExportsCommonJS1.js index befb1f9586b..d9ba6a5ce12 100644 --- a/tests/baselines/reference/decoratedClassExportsCommonJS1.js +++ b/tests/baselines/reference/decoratedClassExportsCommonJS1.js @@ -14,8 +14,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -Object.defineProperty(exports, "__esModule", { value: true }); var Testing123_1; +Object.defineProperty(exports, "__esModule", { value: true }); let Testing123 = Testing123_1 = class Testing123 { }; Testing123.prop1 = Testing123_1.prop0; diff --git a/tests/baselines/reference/decoratedClassExportsCommonJS2.js b/tests/baselines/reference/decoratedClassExportsCommonJS2.js index b93e63c7406..2ed37afa881 100644 --- a/tests/baselines/reference/decoratedClassExportsCommonJS2.js +++ b/tests/baselines/reference/decoratedClassExportsCommonJS2.js @@ -12,8 +12,8 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; -Object.defineProperty(exports, "__esModule", { value: true }); var Testing123_1; +Object.defineProperty(exports, "__esModule", { value: true }); let Testing123 = Testing123_1 = class Testing123 { }; Testing123 = Testing123_1 = __decorate([ diff --git a/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js b/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js index c3af6416868..fbeae9f8a4f 100644 --- a/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js +++ b/tests/baselines/reference/emitClassExpressionInDeclarationFile2.js @@ -44,8 +44,8 @@ var __extends = (this && this.__extends) || (function () { d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); -exports.__esModule = true; var _a; +exports.__esModule = true; exports.noPrivates = (_a = /** @class */ (function () { function class_1() { this.p = 12; diff --git a/tests/baselines/reference/emitter.forAwait.es2015.js b/tests/baselines/reference/emitter.forAwait.es2015.js index 6260870471b..e5764747765 100644 --- a/tests/baselines/reference/emitter.forAwait.es2015.js +++ b/tests/baselines/reference/emitter.forAwait.es2015.js @@ -58,8 +58,8 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } }; function f1() { + var e_1, _a; return __awaiter(this, void 0, void 0, function* () { - var e_1, _a; let y; try { for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = yield y_1.next(), !y_1_1.done;) { @@ -92,8 +92,8 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } }; function f2() { + var e_1, _a; return __awaiter(this, void 0, void 0, function* () { - var e_1, _a; let x, y; try { for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = yield y_1.next(), !y_1_1.done;) { @@ -203,8 +203,8 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { }; // https://github.com/Microsoft/TypeScript/issues/21363 function f5() { + var e_1, _a; return __awaiter(this, void 0, void 0, function* () { - var e_1, _a; let y; try { outer: for (var y_1 = __asyncValues(y), y_1_1; y_1_1 = yield y_1.next(), !y_1_1.done;) { diff --git a/tests/baselines/reference/emitter.forAwait.es5.js b/tests/baselines/reference/emitter.forAwait.es5.js index f264820d3b1..0d67c591e30 100644 --- a/tests/baselines/reference/emitter.forAwait.es5.js +++ b/tests/baselines/reference/emitter.forAwait.es5.js @@ -85,8 +85,9 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } }; function f1() { + var e_1, _a; return __awaiter(this, void 0, void 0, function () { - var e_1, _a, y, y_1, y_1_1, x, e_1_1; + var y, y_1, y_1_1, x, e_1_1; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -165,8 +166,9 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } }; function f2() { + var e_1, _a; return __awaiter(this, void 0, void 0, function () { - var e_1, _a, x, y, y_1, y_1_1, e_1_1; + var x, y, y_1, y_1_1, e_1_1; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -250,7 +252,8 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar }; function f3() { return __asyncGenerator(this, arguments, function f3_1() { - var e_1, _a, y, y_1, y_1_1, x, e_1_1; + var y, y_1, y_1_1, x, e_1_1; + var e_1, _a; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -334,7 +337,8 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar }; function f4() { return __asyncGenerator(this, arguments, function f4_1() { - var e_1, _a, x, y, y_1, y_1_1, e_1_1; + var x, y, y_1, y_1_1, e_1_1; + var e_1, _a; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -414,8 +418,9 @@ var __asyncValues = (this && this.__asyncValues) || function (o) { }; // https://github.com/Microsoft/TypeScript/issues/21363 function f5() { + var e_1, _a; return __awaiter(this, void 0, void 0, function () { - var e_1, _a, y, y_1, y_1_1, x, e_1_1; + var y, y_1, y_1_1, x, e_1_1; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -500,7 +505,8 @@ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _ar // https://github.com/Microsoft/TypeScript/issues/21363 function f6() { return __asyncGenerator(this, arguments, function f6_1() { - var e_1, _a, y, y_1, y_1_1, x, e_1_1; + var y, y_1, y_1_1, x, e_1_1; + var e_1, _a; return __generator(this, function (_b) { switch (_b.label) { case 0: diff --git a/tests/baselines/reference/es5-asyncFunctionForOfStatements.js b/tests/baselines/reference/es5-asyncFunctionForOfStatements.js index 5fbeef0461a..7ae556f9419 100644 --- a/tests/baselines/reference/es5-asyncFunctionForOfStatements.js +++ b/tests/baselines/reference/es5-asyncFunctionForOfStatements.js @@ -315,7 +315,8 @@ function forOfStatement10() { } function forOfStatement11() { return __awaiter(this, void 0, void 0, function () { - var _a, _i, y_8, _b; + var _i, y_8, _a; + var _b; return __generator(this, function (_c) { switch (_c.label) { case 0: @@ -323,17 +324,17 @@ function forOfStatement11() { _c.label = 1; case 1: if (!(_i < y_8.length)) return [3 /*break*/, 6]; - _a = y_8[_i][0]; - if (!(_a === void 0)) return [3 /*break*/, 3]; + _b = y_8[_i][0]; + if (!(_b === void 0)) return [3 /*break*/, 3]; return [4 /*yield*/, a]; case 2: - _b = _c.sent(); + _a = _c.sent(); return [3 /*break*/, 4]; case 3: - _b = _a; + _a = _b; _c.label = 4; case 4: - x = _b; + x = _a; z; _c.label = 5; case 5: @@ -346,18 +347,19 @@ function forOfStatement11() { } function forOfStatement12() { return __awaiter(this, void 0, void 0, function () { - var _a, _i, _b; + var _i, _a; + var _b; return __generator(this, function (_c) { switch (_c.label) { case 0: _i = 0; return [4 /*yield*/, y]; case 1: - _b = _c.sent(); + _a = _c.sent(); _c.label = 2; case 2: - if (!(_i < _b.length)) return [3 /*break*/, 4]; - _a = _b[_i][0], x = _a === void 0 ? a : _a; + if (!(_i < _a.length)) return [3 /*break*/, 4]; + _b = _a[_i][0], x = _b === void 0 ? a : _b; z; _c.label = 3; case 3: @@ -370,7 +372,8 @@ function forOfStatement12() { } function forOfStatement13() { return __awaiter(this, void 0, void 0, function () { - var _a, _i, y_9; + var _i, y_9; + var _a; return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -440,7 +443,8 @@ function forOfStatement15() { } function forOfStatement16() { return __awaiter(this, void 0, void 0, function () { - var _a, _i, y_11, _b; + var _i, y_11, _a; + var _b; return __generator(this, function (_c) { switch (_c.label) { case 0: @@ -448,17 +452,17 @@ function forOfStatement16() { _c.label = 1; case 1: if (!(_i < y_11.length)) return [3 /*break*/, 6]; - _a = y_11[_i].x; - if (!(_a === void 0)) return [3 /*break*/, 3]; + _b = y_11[_i].x; + if (!(_b === void 0)) return [3 /*break*/, 3]; return [4 /*yield*/, a]; case 2: - _b = _c.sent(); + _a = _c.sent(); return [3 /*break*/, 4]; case 3: - _b = _a; + _a = _b; _c.label = 4; case 4: - x = _b; + x = _a; z; _c.label = 5; case 5: @@ -471,18 +475,19 @@ function forOfStatement16() { } function forOfStatement17() { return __awaiter(this, void 0, void 0, function () { - var _a, _i, _b; + var _i, _a; + var _b; return __generator(this, function (_c) { switch (_c.label) { case 0: _i = 0; return [4 /*yield*/, y]; case 1: - _b = _c.sent(); + _a = _c.sent(); _c.label = 2; case 2: - if (!(_i < _b.length)) return [3 /*break*/, 4]; - _a = _b[_i].x, x = _a === void 0 ? a : _a; + if (!(_i < _a.length)) return [3 /*break*/, 4]; + _b = _a[_i].x, x = _b === void 0 ? a : _b; z; _c.label = 3; case 3: @@ -495,7 +500,8 @@ function forOfStatement17() { } function forOfStatement18() { return __awaiter(this, void 0, void 0, function () { - var _a, _i, y_12; + var _i, y_12; + var _a; return __generator(this, function (_b) { switch (_b.label) { case 0: diff --git a/tests/baselines/reference/es5-asyncFunctionObjectLiterals.js b/tests/baselines/reference/es5-asyncFunctionObjectLiterals.js index de1aab50b51..e6031d256af 100644 --- a/tests/baselines/reference/es5-asyncFunctionObjectLiterals.js +++ b/tests/baselines/reference/es5-asyncFunctionObjectLiterals.js @@ -105,17 +105,18 @@ function objectLiteral2() { } function objectLiteral3() { return __awaiter(this, void 0, void 0, function () { - var _a, _b; + var _a; + var _b; return __generator(this, function (_c) { switch (_c.label) { case 0: - _a = {}; - _b = a; + _b = {}; + _a = a; return [4 /*yield*/, y]; case 1: - x = (_a[_b] = _c.sent(), - _a.b = z, - _a); + x = (_b[_a] = _c.sent(), + _b.b = z, + _b); return [2 /*return*/]; } }); @@ -158,18 +159,19 @@ function objectLiteral5() { } function objectLiteral6() { return __awaiter(this, void 0, void 0, function () { - var _a, _b; + var _a; + var _b; return __generator(this, function (_c) { switch (_c.label) { case 0: - _a = { + _b = { a: y }; - _b = b; + _a = b; return [4 /*yield*/, z]; case 1: - x = (_a[_b] = _c.sent(), - _a); + x = (_b[_a] = _c.sent(), + _b); return [2 /*return*/]; } }); diff --git a/tests/baselines/reference/objectLiteralComputedNameNoDeclarationError.js b/tests/baselines/reference/objectLiteralComputedNameNoDeclarationError.js index 5c5e5feccd8..8f9b43d091d 100644 --- a/tests/baselines/reference/objectLiteralComputedNameNoDeclarationError.js +++ b/tests/baselines/reference/objectLiteralComputedNameNoDeclarationError.js @@ -9,8 +9,8 @@ export const Baa = { //// [objectLiteralComputedNameNoDeclarationError.js] "use strict"; -exports.__esModule = true; var _a; +exports.__esModule = true; var Foo = { BANANA: 'banana' }; diff --git a/tests/baselines/reference/restParameterInDownlevelGenerator.js b/tests/baselines/reference/restParameterInDownlevelGenerator.js new file mode 100644 index 00000000000..3a1dbe6a7ac --- /dev/null +++ b/tests/baselines/reference/restParameterInDownlevelGenerator.js @@ -0,0 +1,32 @@ +//// [restParameterInDownlevelGenerator.ts] +// https://github.com/Microsoft/TypeScript/issues/30653 +function * mergeStringLists(...strings: string[]) { + for (var str of strings); +} + +//// [restParameterInDownlevelGenerator.js] +// https://github.com/Microsoft/TypeScript/issues/30653 +function mergeStringLists() { + var _i, strings_1, strings_1_1, str; + var e_1, _a; + var strings = []; + for (_i = 0; _i < arguments.length; _i++) { + strings[_i] = arguments[_i]; + } + return __generator(this, function (_b) { + try { + for (strings_1 = __values(strings), strings_1_1 = strings_1.next(); !strings_1_1.done; strings_1_1 = strings_1.next()) { + str = strings_1_1.value; + ; + } + } + catch (e_1_1) { e_1 = { error: e_1_1 }; } + finally { + try { + if (strings_1_1 && !strings_1_1.done && (_a = strings_1.return)) _a.call(strings_1); + } + finally { if (e_1) throw e_1.error; } + } + return [2 /*return*/]; + }); +} diff --git a/tests/baselines/reference/restParameterInDownlevelGenerator.symbols b/tests/baselines/reference/restParameterInDownlevelGenerator.symbols new file mode 100644 index 00000000000..bc15dd540ff --- /dev/null +++ b/tests/baselines/reference/restParameterInDownlevelGenerator.symbols @@ -0,0 +1,10 @@ +=== tests/cases/conformance/generators/restParameterInDownlevelGenerator.ts === +// https://github.com/Microsoft/TypeScript/issues/30653 +function * mergeStringLists(...strings: string[]) { +>mergeStringLists : Symbol(mergeStringLists, Decl(restParameterInDownlevelGenerator.ts, 0, 0)) +>strings : Symbol(strings, Decl(restParameterInDownlevelGenerator.ts, 1, 28)) + + for (var str of strings); +>str : Symbol(str, Decl(restParameterInDownlevelGenerator.ts, 2, 12)) +>strings : Symbol(strings, Decl(restParameterInDownlevelGenerator.ts, 1, 28)) +} diff --git a/tests/baselines/reference/restParameterInDownlevelGenerator.types b/tests/baselines/reference/restParameterInDownlevelGenerator.types new file mode 100644 index 00000000000..e0b85e1a0ff --- /dev/null +++ b/tests/baselines/reference/restParameterInDownlevelGenerator.types @@ -0,0 +1,10 @@ +=== tests/cases/conformance/generators/restParameterInDownlevelGenerator.ts === +// https://github.com/Microsoft/TypeScript/issues/30653 +function * mergeStringLists(...strings: string[]) { +>mergeStringLists : (...strings: string[]) => IterableIterator +>strings : string[] + + for (var str of strings); +>str : string +>strings : string[] +} diff --git a/tests/baselines/reference/uniqueSymbolAllowsIndexInObjectWithIndexSignature.js b/tests/baselines/reference/uniqueSymbolAllowsIndexInObjectWithIndexSignature.js index f74ff6d2c2b..911f3abf7c4 100644 --- a/tests/baselines/reference/uniqueSymbolAllowsIndexInObjectWithIndexSignature.js +++ b/tests/baselines/reference/uniqueSymbolAllowsIndexInObjectWithIndexSignature.js @@ -13,8 +13,8 @@ let b: I = {[SYM]: 'str'}; // Expect error //// [uniqueSymbolAllowsIndexInObjectWithIndexSignature.js] "use strict"; -exports.__esModule = true; var _a, _b; +exports.__esModule = true; // https://github.com/Microsoft/TypeScript/issues/21962 exports.SYM = Symbol('a unique symbol'); var a = (_a = {}, _a[exports.SYM] = 'sym', _a); // Expect ok diff --git a/tests/baselines/reference/variableDeclarationDeclarationEmitUniqueSymbolPartialStatement.js b/tests/baselines/reference/variableDeclarationDeclarationEmitUniqueSymbolPartialStatement.js index f2a1df5e707..21871ff2304 100644 --- a/tests/baselines/reference/variableDeclarationDeclarationEmitUniqueSymbolPartialStatement.js +++ b/tests/baselines/reference/variableDeclarationDeclarationEmitUniqueSymbolPartialStatement.js @@ -7,8 +7,8 @@ export class Foo { //// [variableDeclarationDeclarationEmitUniqueSymbolPartialStatement.js] "use strict"; -exports.__esModule = true; var _a; +exports.__esModule = true; var key = Symbol(), value = 12; var Foo = /** @class */ (function () { function Foo() { diff --git a/tests/cases/conformance/generators/restParameterInDownlevelGenerator.ts b/tests/cases/conformance/generators/restParameterInDownlevelGenerator.ts new file mode 100644 index 00000000000..bb98fb0f742 --- /dev/null +++ b/tests/cases/conformance/generators/restParameterInDownlevelGenerator.ts @@ -0,0 +1,9 @@ +// @target: es5 +// @lib: es2015 +// @downlevelIteration: true +// @noEmitHelpers: true + +// https://github.com/Microsoft/TypeScript/issues/30653 +function * mergeStringLists(...strings: string[]) { + for (var str of strings); +} \ No newline at end of file From 75a812b4db8f76bad3db073603f34594fd12c07d Mon Sep 17 00:00:00 2001 From: Alexander T Date: Wed, 3 Apr 2019 19:49:34 +0300 Subject: [PATCH 08/15] add new message - TS1258 (#30704) --- src/compiler/checker.ts | 2 +- src/compiler/diagnosticMessages.json | 4 ++++ .../definiteAssignmentAssertions.errors.txt | 20 +++++++++---------- 3 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 93e66dd05e4..b9e5bcaeddf 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -31462,7 +31462,7 @@ namespace ts { } if (node.exclamationToken && (node.parent.parent.kind !== SyntaxKind.VariableStatement || !node.type || node.initializer || node.flags & NodeFlags.Ambient)) { - return grammarErrorOnNode(node.exclamationToken, Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context); + return grammarErrorOnNode(node.exclamationToken, Diagnostics.Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation); } if (compilerOptions.module !== ModuleKind.ES2015 && compilerOptions.module !== ModuleKind.ESNext && compilerOptions.module !== ModuleKind.System && !compilerOptions.noEmit && diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index 6cb498df827..7717f51bd50 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -847,6 +847,10 @@ "category": "Error", "code": 1257 }, + "Definite assignment assertions can only be used along with a type annotation.": { + "category": "Error", + "code": 1258 + }, "'with' statements are not allowed in an async function block.": { "category": "Error", "code": 1300 diff --git a/tests/baselines/reference/definiteAssignmentAssertions.errors.txt b/tests/baselines/reference/definiteAssignmentAssertions.errors.txt index d65d9b510ae..dea5e45aa82 100644 --- a/tests/baselines/reference/definiteAssignmentAssertions.errors.txt +++ b/tests/baselines/reference/definiteAssignmentAssertions.errors.txt @@ -4,11 +4,11 @@ tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(21,6): error tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(22,13): error TS1255: A definite assignment assertion '!' is not permitted in this context. tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(28,6): error TS1255: A definite assignment assertion '!' is not permitted in this context. tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(34,15): error TS1255: A definite assignment assertion '!' is not permitted in this context. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(68,10): error TS1255: A definite assignment assertion '!' is not permitted in this context. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(69,10): error TS1255: A definite assignment assertion '!' is not permitted in this context. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(70,10): error TS1255: A definite assignment assertion '!' is not permitted in this context. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(75,15): error TS1255: A definite assignment assertion '!' is not permitted in this context. -tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(76,15): error TS1255: A definite assignment assertion '!' is not permitted in this context. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(68,10): error TS1258: Definite assignment assertions can only be used along with a type annotation. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(69,10): error TS1258: Definite assignment assertions can only be used along with a type annotation. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(70,10): error TS1258: Definite assignment assertions can only be used along with a type annotation. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(75,15): error TS1258: Definite assignment assertions can only be used along with a type annotation. +tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(76,15): error TS1258: Definite assignment assertions can only be used along with a type annotation. ==== tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts (11 errors) ==== @@ -93,21 +93,21 @@ tests/cases/conformance/controlFlow/definiteAssignmentAssertions.ts(76,15): erro function f4() { let a!; ~ -!!! error TS1255: A definite assignment assertion '!' is not permitted in this context. +!!! error TS1258: Definite assignment assertions can only be used along with a type annotation. let b! = 1; ~ -!!! error TS1255: A definite assignment assertion '!' is not permitted in this context. +!!! error TS1258: Definite assignment assertions can only be used along with a type annotation. let c!: number = 1; ~ -!!! error TS1255: A definite assignment assertion '!' is not permitted in this context. +!!! error TS1258: Definite assignment assertions can only be used along with a type annotation. } // Definite assignment assertion not permitted in ambient context declare let v1!: number; ~ -!!! error TS1255: A definite assignment assertion '!' is not permitted in this context. +!!! error TS1258: Definite assignment assertions can only be used along with a type annotation. declare var v2!: number; ~ -!!! error TS1255: A definite assignment assertion '!' is not permitted in this context. +!!! error TS1258: Definite assignment assertions can only be used along with a type annotation. \ No newline at end of file From 78b095647477b6f47d68f72a96252829e61e437c Mon Sep 17 00:00:00 2001 From: Benjamin Lichtman Date: Wed, 3 Apr 2019 10:36:04 -0700 Subject: [PATCH 09/15] VS IntelliCode-related changes (#30731) * ensure configurePlugin gives a response * Update tests * Update baseline * Enable global plugin loading for external projects * Fix lint errors --- src/harness/client.ts | 8 ++- src/server/editorServices.ts | 3 +- src/server/project.ts | 4 +- src/server/protocol.ts | 3 + src/server/session.ts | 1 + .../unittests/tsserver/externalProjects.ts | 62 +++++++++++++++++++ .../reference/api/tsserverlibrary.d.ts | 2 + 7 files changed, 78 insertions(+), 5 deletions(-) diff --git a/src/harness/client.ts b/src/harness/client.ts index 1c7c0adb834..03d53344616 100644 --- a/src/harness/client.ts +++ b/src/harness/client.ts @@ -90,7 +90,7 @@ namespace ts.server { return request; } - private processResponse(request: protocol.Request): T { + private processResponse(request: protocol.Request, expectEmptyBody = false): T { let foundResponseMessage = false; let response!: T; while (!foundResponseMessage) { @@ -118,7 +118,8 @@ namespace ts.server { throw new Error("Error " + response.message); } - Debug.assert(!!response.body, "Malformed response: Unexpected empty response body."); + Debug.assert(expectEmptyBody || !!response.body, "Malformed response: Unexpected empty response body."); + Debug.assert(!expectEmptyBody || !response.body, "Malformed response: Unexpected non-empty response body."); return response; } @@ -696,7 +697,8 @@ namespace ts.server { } configurePlugin(pluginName: string, configuration: any): void { - this.processRequest("configurePlugin", { pluginName, configuration }); + const request = this.processRequest("configurePlugin", { pluginName, configuration }); + this.processResponse(request, /*expectEmptyBody*/ true); } getIndentationAtPosition(_fileName: string, _position: number, _options: EditorOptions): number { diff --git a/src/server/editorServices.ts b/src/server/editorServices.ts index 6c1ad386a05..6bfce902a04 100644 --- a/src/server/editorServices.ts +++ b/src/server/editorServices.ts @@ -1607,7 +1607,8 @@ namespace ts.server { this.documentRegistry, compilerOptions, /*lastFileExceededProgramSize*/ this.getFilenameForExceededTotalSizeLimitForNonTsFiles(projectFileName, compilerOptions, files, externalFilePropertyReader), - options.compileOnSave === undefined ? true : options.compileOnSave); + options.compileOnSave === undefined ? true : options.compileOnSave, + /*projectFilePath*/ undefined, this.currentPluginConfigOverrides); project.excludedFiles = excludedFiles; this.addFilesToNonInferredProject(project, files, externalFilePropertyReader, typeAcquisition); diff --git a/src/server/project.ts b/src/server/project.ts index 431c5664f3a..5a2c897e386 100644 --- a/src/server/project.ts +++ b/src/server/project.ts @@ -1610,7 +1610,8 @@ namespace ts.server { compilerOptions: CompilerOptions, lastFileExceededProgramSize: string | undefined, public compileOnSaveEnabled: boolean, - projectFilePath?: string) { + projectFilePath?: string, + pluginConfigOverrides?: Map) { super(externalProjectName, ProjectKind.External, projectService, @@ -1621,6 +1622,7 @@ namespace ts.server { compileOnSaveEnabled, projectService.host, getDirectoryPath(projectFilePath || normalizeSlashes(externalProjectName))); + this.enableGlobalPlugins(this.getCompilerOptions(), pluginConfigOverrides); } updateGraph() { diff --git a/src/server/protocol.ts b/src/server/protocol.ts index 3b7690e2c60..e5580874369 100644 --- a/src/server/protocol.ts +++ b/src/server/protocol.ts @@ -1392,6 +1392,9 @@ namespace ts.server.protocol { arguments: ConfigurePluginRequestArguments; } + export interface ConfigurePluginResponse extends Response { + } + /** * Information found in an "open" request. */ diff --git a/src/server/session.ts b/src/server/session.ts index 6cf0619efd1..3c202c9aecd 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -2412,6 +2412,7 @@ namespace ts.server { }, [CommandNames.ConfigurePlugin]: (request: protocol.ConfigurePluginRequest) => { this.configurePlugin(request.arguments); + this.doOutput(/*info*/ undefined, CommandNames.ConfigurePlugin, request.seq, /*success*/ true); return this.notRequired(); } }); diff --git a/src/testRunner/unittests/tsserver/externalProjects.ts b/src/testRunner/unittests/tsserver/externalProjects.ts index 82c706500d3..21d1290fc2e 100644 --- a/src/testRunner/unittests/tsserver/externalProjects.ts +++ b/src/testRunner/unittests/tsserver/externalProjects.ts @@ -50,6 +50,68 @@ namespace ts.projectSystem { }); }); + it("load global plugins", () => { + const f1 = { + path: "/a/file1.ts", + content: "let x = [1, 2];" + }; + const p1 = { projectFileName: "/a/proj1.csproj", rootFiles: [toExternalFile(f1.path)], options: {} }; + + const host = createServerHost([f1]); + host.require = (_initialPath, moduleName) => { + assert.equal(moduleName, "myplugin"); + return { + module: () => ({ + create(info: server.PluginCreateInfo) { + const proxy = Harness.LanguageService.makeDefaultProxy(info); + proxy.getSemanticDiagnostics = filename => { + const prev = info.languageService.getSemanticDiagnostics(filename); + const sourceFile: SourceFile = info.project.getSourceFile(toPath(filename, /*basePath*/ undefined, createGetCanonicalFileName(info.serverHost.useCaseSensitiveFileNames)))!; + prev.push({ + category: DiagnosticCategory.Warning, + file: sourceFile, + code: 9999, + length: 3, + messageText: `Plugin diagnostic`, + start: 0 + }); + return prev; + }; + return proxy; + } + }), + error: undefined + }; + }; + const session = createSession(host, { globalPlugins: ["myplugin"] }); + + session.executeCommand({ + seq: 1, + type: "request", + command: "openExternalProjects", + arguments: { projects: [p1] } + }); + + const projectService = session.getProjectService(); + checkNumberOfProjects(projectService, { externalProjects: 1 }); + assert.equal(projectService.externalProjects[0].getProjectName(), p1.projectFileName); + + const handlerResponse = session.executeCommand({ + seq: 2, + type: "request", + command: "semanticDiagnosticsSync", + arguments: { + file: f1.path, + projectFileName: p1.projectFileName + } + }); + + assert.isDefined(handlerResponse.response); + const response = handlerResponse.response as protocol.Diagnostic[]; + assert.equal(response.length, 1); + assert.equal(response[0].text, "Plugin diagnostic"); + }); + it("remove not-listed external projects", () => { const f1 = { path: "/a/app.ts", diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 8208cdba2ab..59fa706bf45 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -6748,6 +6748,8 @@ declare namespace ts.server.protocol { command: CommandTypes.ConfigurePlugin; arguments: ConfigurePluginRequestArguments; } + interface ConfigurePluginResponse extends Response { + } /** * Information found in an "open" request. */ From 24b1ec86814a7114e003c95f71ad39bc8fd05e4a Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 3 Apr 2019 13:00:47 -0700 Subject: [PATCH 10/15] Update version to '3.5.0'. --- package.json | 2 +- src/compiler/core.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 275411c477f..493a3501d2f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "typescript", "author": "Microsoft Corp.", "homepage": "https://www.typescriptlang.org/", - "version": "3.4.0", + "version": "3.5.0", "license": "Apache-2.0", "description": "TypeScript is a language for application scale JavaScript development", "keywords": [ diff --git a/src/compiler/core.ts b/src/compiler/core.ts index ec5eafd6ca3..b99304ddfed 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1,7 +1,7 @@ namespace ts { // WARNING: The script `configureNightly.ts` uses a regexp to parse out these values. // If changing the text in this section, be sure to test `configureNightly` too. - export const versionMajorMinor = "3.4"; + export const versionMajorMinor = "3.5"; /** The version of the TypeScript compiler release */ export const version = `${versionMajorMinor}.0-dev`; } From b8f6ae4e256f2a5f47fe45b7fcfccfec941dc994 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 3 Apr 2019 13:00:58 -0700 Subject: [PATCH 11/15] Accepted baselines. --- tests/baselines/reference/api/tsserverlibrary.d.ts | 2 +- tests/baselines/reference/api/typescript.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/baselines/reference/api/tsserverlibrary.d.ts b/tests/baselines/reference/api/tsserverlibrary.d.ts index 59fa706bf45..46cd79bf77d 100644 --- a/tests/baselines/reference/api/tsserverlibrary.d.ts +++ b/tests/baselines/reference/api/tsserverlibrary.d.ts @@ -14,7 +14,7 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { - const versionMajorMinor = "3.4"; + const versionMajorMinor = "3.5"; /** The version of the TypeScript compiler release */ const version: string; } diff --git a/tests/baselines/reference/api/typescript.d.ts b/tests/baselines/reference/api/typescript.d.ts index 314ccf298cf..51c10fdf195 100644 --- a/tests/baselines/reference/api/typescript.d.ts +++ b/tests/baselines/reference/api/typescript.d.ts @@ -14,7 +14,7 @@ and limitations under the License. ***************************************************************************** */ declare namespace ts { - const versionMajorMinor = "3.4"; + const versionMajorMinor = "3.5"; /** The version of the TypeScript compiler release */ const version: string; } From 13d2b8d617b820e40a93cabc9f2a31895b19d32b Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Fri, 22 Mar 2019 15:44:29 -0700 Subject: [PATCH 12/15] Add the Omit helper type. --- src/lib/es5.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/es5.d.ts b/src/lib/es5.d.ts index 458dc8b9252..79fd72ac937 100644 --- a/src/lib/es5.d.ts +++ b/src/lib/es5.d.ts @@ -1443,6 +1443,11 @@ type Exclude = T extends U ? never : T; */ type Extract = T extends U ? T : never; +/** + * Construct a type with the properties of T except for those in type K. + */ +type Omit = Pick>; + /** * Exclude null and undefined from T */ From 1dae8fcc305c173082eb83a66b726f154c06a278 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 3 Apr 2019 14:01:05 -0700 Subject: [PATCH 13/15] Fix tests to be non-global. --- .../compiler/circularlySimplifyingConditionalTypesNoCrash.ts | 4 +++- tests/cases/compiler/indexedAccessRetainsIndexSignature.ts | 2 +- .../reactReduxLikeDeferredInferenceAllowsAssignment.ts | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts b/tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts index ccacb10dd2d..34e5a1b0f4c 100644 --- a/tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts +++ b/tests/cases/compiler/circularlySimplifyingConditionalTypesNoCrash.ts @@ -45,4 +45,6 @@ const myStoreConnect: Connect = function( mergeProps, options, ); -}; \ No newline at end of file +}; + +export {}; diff --git a/tests/cases/compiler/indexedAccessRetainsIndexSignature.ts b/tests/cases/compiler/indexedAccessRetainsIndexSignature.ts index 11abf771edc..36b7c482506 100644 --- a/tests/cases/compiler/indexedAccessRetainsIndexSignature.ts +++ b/tests/cases/compiler/indexedAccessRetainsIndexSignature.ts @@ -7,4 +7,4 @@ type Omit1 = Pick>; type Omit2 = {[P in Diff]: T[P]}; type O = Omit<{ a: number, b: string }, 'a'> -const o: O = { b: '' } +export const o: O = { b: '' } diff --git a/tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts b/tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts index 940031c52c2..20b18febdc3 100644 --- a/tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts +++ b/tests/cases/compiler/reactReduxLikeDeferredInferenceAllowsAssignment.ts @@ -143,3 +143,5 @@ const Test1 = connect( null, mapDispatchToProps )(TestComponent); + +export {}; From e8feaf9a3eeb691a2fdf209a5ec3c3f75d553a78 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 3 Apr 2019 17:09:37 -0700 Subject: [PATCH 14/15] Accepted baselines. --- .../circularlySimplifyingConditionalTypesNoCrash.js | 6 +++++- .../circularlySimplifyingConditionalTypesNoCrash.symbols | 3 +++ .../circularlySimplifyingConditionalTypesNoCrash.types | 3 +++ .../reference/indexedAccessRetainsIndexSignature.js | 6 ++++-- .../reference/indexedAccessRetainsIndexSignature.symbols | 6 +++--- .../reference/indexedAccessRetainsIndexSignature.types | 2 +- .../reactReduxLikeDeferredInferenceAllowsAssignment.js | 3 +++ .../reactReduxLikeDeferredInferenceAllowsAssignment.symbols | 2 ++ .../reactReduxLikeDeferredInferenceAllowsAssignment.types | 2 ++ 9 files changed, 26 insertions(+), 7 deletions(-) diff --git a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.js b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.js index 724a8f8dbea..fdeff927f6b 100644 --- a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.js +++ b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.js @@ -45,10 +45,14 @@ const myStoreConnect: Connect = function( mergeProps, options, ); -}; +}; + +export {}; + //// [circularlySimplifyingConditionalTypesNoCrash.js] "use strict"; +exports.__esModule = true; var myStoreConnect = function (mapStateToProps, mapDispatchToProps, mergeProps, options) { if (options === void 0) { options = {}; } return connect(mapStateToProps, mapDispatchToProps, mergeProps, options); diff --git a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.symbols b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.symbols index 97abdadf2b3..9b7f5dd22ca 100644 --- a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.symbols +++ b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.symbols @@ -152,3 +152,6 @@ const myStoreConnect: Connect = function( ); }; + +export {}; + diff --git a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types index 4a3a1fdbe53..e7690eee850 100644 --- a/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types +++ b/tests/baselines/reference/circularlySimplifyingConditionalTypesNoCrash.types @@ -90,3 +90,6 @@ const myStoreConnect: Connect = function( ); }; + +export {}; + diff --git a/tests/baselines/reference/indexedAccessRetainsIndexSignature.js b/tests/baselines/reference/indexedAccessRetainsIndexSignature.js index 92952515779..7d16717bae9 100644 --- a/tests/baselines/reference/indexedAccessRetainsIndexSignature.js +++ b/tests/baselines/reference/indexedAccessRetainsIndexSignature.js @@ -8,8 +8,10 @@ type Omit1 = Pick>; type Omit2 = {[P in Diff]: T[P]}; type O = Omit<{ a: number, b: string }, 'a'> -const o: O = { b: '' } +export const o: O = { b: '' } //// [indexedAccessRetainsIndexSignature.js] -var o = { b: '' }; +"use strict"; +exports.__esModule = true; +exports.o = { b: '' }; diff --git a/tests/baselines/reference/indexedAccessRetainsIndexSignature.symbols b/tests/baselines/reference/indexedAccessRetainsIndexSignature.symbols index f6d65f9cf6f..94b8fcd070f 100644 --- a/tests/baselines/reference/indexedAccessRetainsIndexSignature.symbols +++ b/tests/baselines/reference/indexedAccessRetainsIndexSignature.symbols @@ -55,8 +55,8 @@ type O = Omit<{ a: number, b: string }, 'a'> >a : Symbol(a, Decl(indexedAccessRetainsIndexSignature.ts, 8, 15)) >b : Symbol(b, Decl(indexedAccessRetainsIndexSignature.ts, 8, 26)) -const o: O = { b: '' } ->o : Symbol(o, Decl(indexedAccessRetainsIndexSignature.ts, 9, 5)) +export const o: O = { b: '' } +>o : Symbol(o, Decl(indexedAccessRetainsIndexSignature.ts, 9, 12)) >O : Symbol(O, Decl(indexedAccessRetainsIndexSignature.ts, 6, 67)) ->b : Symbol(b, Decl(indexedAccessRetainsIndexSignature.ts, 9, 14)) +>b : Symbol(b, Decl(indexedAccessRetainsIndexSignature.ts, 9, 21)) diff --git a/tests/baselines/reference/indexedAccessRetainsIndexSignature.types b/tests/baselines/reference/indexedAccessRetainsIndexSignature.types index 2f79f6f8498..5e92e67279d 100644 --- a/tests/baselines/reference/indexedAccessRetainsIndexSignature.types +++ b/tests/baselines/reference/indexedAccessRetainsIndexSignature.types @@ -21,7 +21,7 @@ type O = Omit<{ a: number, b: string }, 'a'> >a : number >b : string -const o: O = { b: '' } +export const o: O = { b: '' } >o : Pick<{ a: number; b: string; }, "b"> >{ b: '' } : { b: string; } >b : string diff --git a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.js b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.js index 2eeda64fc98..69e1108ad30 100644 --- a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.js +++ b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.js @@ -143,6 +143,8 @@ const Test1 = connect( null, mapDispatchToProps )(TestComponent); + +export {}; //// [reactReduxLikeDeferredInferenceAllowsAssignment.js] @@ -196,6 +198,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) { } }; var _this = this; +exports.__esModule = true; var simpleAction = function (payload) { return ({ type: "SIMPLE_ACTION", payload: payload diff --git a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.symbols b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.symbols index ec954dfde79..85daf38368a 100644 --- a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.symbols +++ b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.symbols @@ -469,3 +469,5 @@ const Test1 = connect( )(TestComponent); >TestComponent : Symbol(TestComponent, Decl(reactReduxLikeDeferredInferenceAllowsAssignment.ts, 134, 1)) +export {}; + diff --git a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.types b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.types index 767d94535cb..4772a806521 100644 --- a/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.types +++ b/tests/baselines/reference/reactReduxLikeDeferredInferenceAllowsAssignment.types @@ -286,3 +286,5 @@ const Test1 = connect( )(TestComponent); >TestComponent : typeof TestComponent +export {}; + From 71af02f7459dc812e85ac31365bfe23daf14b4e4 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Thu, 4 Apr 2019 10:16:43 -0700 Subject: [PATCH 15/15] Updated annoying 'globalTypes' list. --- src/harness/fourslash.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/harness/fourslash.ts b/src/harness/fourslash.ts index 089a2630dd8..9e117cdfd8f 100644 --- a/src/harness/fourslash.ts +++ b/src/harness/fourslash.ts @@ -4507,6 +4507,7 @@ namespace FourSlashInterface { typeEntry("Record"), typeEntry("Exclude"), typeEntry("Extract"), + typeEntry("Omit"), typeEntry("NonNullable"), typeEntry("Parameters"), typeEntry("ConstructorParameters"),