From 4a55025f2043a5c7febc8453af44f622b488ee99 Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Wed, 17 Apr 2019 16:32:33 -0700 Subject: [PATCH] Code review feedback --- src/compiler/builder.ts | 19 +++++++++++++++---- src/testRunner/tsconfig.json | 2 +- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index 219a2c0cbc9..8ee04b26e1d 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -406,14 +406,13 @@ namespace ts { } /** - * Handles sematic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file + * Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change - * Similar to cleanSemanticDiagnosticsOfAffectedFile */ function handleDtsMayChangeOfAffectedFile(state: BuilderProgramState, affectedFile: SourceFile, cancellationToken: CancellationToken | undefined, computeHash: BuilderState.ComputeHash) { removeSemanticDiagnosticsOf(state, affectedFile.path); - // If affected files is everything except default librarry, then nothing more to do + // If affected files is everything except default library, then nothing more to do if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) { if (!state.cleanedDiagnosticsOfLibFiles) { state.cleanedDiagnosticsOfLibFiles = true; @@ -442,7 +441,19 @@ namespace ts { const program = Debug.assertDefined(state.program); const sourceFile = program.getSourceFileByPath(path); if (sourceFile) { - BuilderState.updateShapeSignature(state, program, sourceFile, Debug.assertDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap); + // Even though the js emit doesnt change and we are already handling dts emit and semantic diagnostics + // we need to update the signature to reflect correctness of the signature(which is output d.ts emit) of this file + // This ensures that we dont later during incremental builds considering wrong signature. + // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build + BuilderState.updateShapeSignature( + state, + program, + sourceFile, + Debug.assertDefined(state.currentAffectedFilesSignatures), + cancellationToken, + computeHash, + state.currentAffectedFilesExportedModulesMap + ); // If not dts emit, nothing more to do if (getEmitDeclarations(state.compilerOptions)) { addToAffectedFilesPendingEmit(state, [path]); diff --git a/src/testRunner/tsconfig.json b/src/testRunner/tsconfig.json index 52131bd6c28..9210aed9ab7 100644 --- a/src/testRunner/tsconfig.json +++ b/src/testRunner/tsconfig.json @@ -92,7 +92,7 @@ "unittests/tsbuild/amdModulesWithOut.ts", "unittests/tsbuild/emptyFiles.ts", "unittests/tsbuild/graphOrdering.ts", - "unittests/tsbuild//inferredTypeFromTransitiveModule.ts", + "unittests/tsbuild/inferredTypeFromTransitiveModule.ts", "unittests/tsbuild/missingExtendedFile.ts", "unittests/tsbuild/outFile.ts", "unittests/tsbuild/referencesWithRootDirInParent.ts",