diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts
index 60feb4bd584a9..c14acb32f4a08 100644
--- a/src/compiler/builder.ts
+++ b/src/compiler/builder.ts
@@ -438,8 +438,23 @@ namespace ts {
removeSemanticDiagnosticsOf(state, f.resolvedPath)
);
}
+ // When a change affects the global scope, all files are considered to be affected without updating their signature
+ // That means when affected file is handled, its signature can be out of date
+ // To avoid this, ensure that we update the signature for any affected file in this scenario.
+ BuilderState.updateShapeSignature(
+ state,
+ Debug.checkDefined(state.program),
+ affectedFile,
+ Debug.checkDefined(state.currentAffectedFilesSignatures),
+ cancellationToken,
+ computeHash,
+ state.currentAffectedFilesExportedModulesMap
+ );
return;
}
+ else {
+ Debug.assert(state.hasCalledUpdateShapeSignature.has(affectedFile.resolvedPath) || state.currentAffectedFilesSignatures?.has(affectedFile.resolvedPath), `Signature not updated for affected file: ${affectedFile.fileName}`);
+ }
if (!state.compilerOptions.assumeChangesOnlyAffectDirectDependencies) {
forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, (state, path) => handleDtsMayChangeOf(state, path, cancellationToken, computeHash));
diff --git a/src/testRunner/unittests/tsc/incremental.ts b/src/testRunner/unittests/tsc/incremental.ts
index bc728cd32aa2d..d1acc0417b69d 100644
--- a/src/testRunner/unittests/tsc/incremental.ts
+++ b/src/testRunner/unittests/tsc/incremental.ts
@@ -236,6 +236,58 @@ const a: string = 10;`, "utf-8"),
}
});
+ verifyTscSerializedIncrementalEdits({
+ scenario: "incremental",
+ subScenario: `when global file is added, the signatures are updated`,
+ fs: () => loadProjectFromFiles({
+ "/src/project/src/main.ts": Utils.dedent`
+ ///
+ ///
+ function main() { }
+ `,
+ "/src/project/src/anotherFileWithSameReferenes.ts": Utils.dedent`
+ ///
+ ///
+ function anotherFileWithSameReferenes() { }
+ `,
+ "/src/project/src/filePresent.ts": `function something() { return 10; }`,
+ "/src/project/tsconfig.json": JSON.stringify({
+ compilerOptions: { composite: true, },
+ include: ["src/**/*.ts"]
+ }),
+ }),
+ commandLineArgs: ["--p", "src/project"],
+ incrementalScenarios: [
+ noChangeRun,
+ {
+ subScenario: "Modify main file",
+ buildKind: BuildKind.IncrementalDtsChange,
+ modifyFs: fs => appendText(fs, `/src/project/src/main.ts`, `something();`),
+ },
+ {
+ subScenario: "Add new file and update main file",
+ buildKind: BuildKind.IncrementalDtsChange,
+ modifyFs: fs => {
+ fs.writeFileSync(`/src/project/src/newFile.ts`, "function foo() { return 20; }");
+ prependText(fs, `/src/project/src/main.ts`, `///
+`);
+ appendText(fs, `/src/project/src/main.ts`, `foo();`);
+ },
+ },
+ {
+ subScenario: "Write file that could not be resolved",
+ buildKind: BuildKind.IncrementalDtsChange,
+ modifyFs: fs => fs.writeFileSync(`/src/project/src/fileNotFound.ts`, "function something2() { return 20; }"),
+ },
+ {
+ subScenario: "Modify main file",
+ buildKind: BuildKind.IncrementalDtsChange,
+ modifyFs: fs => appendText(fs, `/src/project/src/main.ts`, `something();`),
+ },
+ ],
+ baselinePrograms: true,
+ });
+
const jsxLibraryContent = `
export {};
declare global {
diff --git a/tests/baselines/reference/tsc/incremental/initial-build/when-global-file-is-added,-the-signatures-are-updated.js b/tests/baselines/reference/tsc/incremental/initial-build/when-global-file-is-added,-the-signatures-are-updated.js
new file mode 100644
index 0000000000000..7ab4035cf2d5e
--- /dev/null
+++ b/tests/baselines/reference/tsc/incremental/initial-build/when-global-file-is-added,-the-signatures-are-updated.js
@@ -0,0 +1,662 @@
+Input::
+//// [/lib/lib.d.ts]
+///
+interface Boolean {}
+interface Function {}
+interface CallableFunction {}
+interface NewableFunction {}
+interface IArguments {}
+interface Number { toExponential: any; }
+interface Object {}
+interface RegExp {}
+interface String { charAt: any; }
+interface Array { length: number; [n: number]: T; }
+interface ReadonlyArray {}
+declare const console: { log(msg: any): void; };
+
+//// [/src/project/src/anotherFileWithSameReferenes.ts]
+///
+///
+function anotherFileWithSameReferenes() { }
+
+
+//// [/src/project/src/filePresent.ts]
+function something() { return 10; }
+
+//// [/src/project/src/main.ts]
+///
+///
+function main() { }
+
+
+//// [/src/project/tsconfig.json]
+{"compilerOptions":{"composite":true},"include":["src/**/*.ts"]}
+
+
+
+Output::
+/lib/tsc --p src/project
+[96msrc/project/src/anotherFileWithSameReferenes.ts[0m:[93m2[0m:[93m22[0m - [91merror[0m[90m TS6053: [0mFile '/src/project/src/fileNotFound.ts' not found.
+
+[7m2[0m ///
+[7m [0m [91m ~~~~~~~~~~~~~~~~~[0m
+
+[96msrc/project/src/main.ts[0m:[93m2[0m:[93m22[0m - [91merror[0m[90m TS6053: [0mFile '/src/project/src/fileNotFound.ts' not found.
+
+[7m2[0m ///
+[7m [0m [91m ~~~~~~~~~~~~~~~~~[0m
+
+
+Found 2 errors.
+
+exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated
+Program root files: ["/src/project/src/anotherFileWithSameReferenes.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"]
+Program options: {"composite":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"}
+Program structureReused: Not
+Program files::
+/lib/lib.d.ts
+/src/project/src/filePresent.ts
+/src/project/src/anotherFileWithSameReferenes.ts
+/src/project/src/main.ts
+
+Semantic diagnostics in builder refreshed for::
+/lib/lib.d.ts
+/src/project/src/filePresent.ts
+/src/project/src/anotherFileWithSameReferenes.ts
+/src/project/src/main.ts
+
+
+//// [/src/project/src/anotherFileWithSameReferenes.d.ts]
+///
+declare function anotherFileWithSameReferenes(): void;
+
+
+//// [/src/project/src/anotherFileWithSameReferenes.js]
+///
+///
+function anotherFileWithSameReferenes() { }
+
+
+//// [/src/project/src/filePresent.d.ts]
+declare function something(): number;
+
+
+//// [/src/project/src/filePresent.js]
+function something() { return 10; }
+
+
+//// [/src/project/src/main.d.ts]
+///
+declare function main(): void;
+
+
+//// [/src/project/src/main.js]
+///
+///
+function main() { }
+
+
+//// [/src/project/tsconfig.tsbuildinfo]
+{"program":{"fileNames":["../../lib/lib.d.ts","./src/filepresent.ts","./src/anotherfilewithsamereferenes.ts","./src/main.ts","./src/filenotfound.ts"],"fileInfos":[{"version":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","signature":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},{"version":"-12346563362-function something() { return 10; }","signature":"-2893492081-declare function something(): number;\r\n","affectsGlobalScope":true},{"version":"-28237004260-/// \n/// \nfunction anotherFileWithSameReferenes() { }\n","signature":"5108835150-/// \r\ndeclare function anotherFileWithSameReferenes(): void;\r\n","affectsGlobalScope":true},{"version":"-21256825585-/// \n/// \nfunction main() { }\n","signature":"-7575087679-/// \r\ndeclare function main(): void;\r\n","affectsGlobalScope":true}],"options":{"composite":true,"project":"./","configFilePath":"./tsconfig.json"},"fileIdsList":[[1,4]],"referencedMap":[[2,0],[3,0]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[0,2,1,3]},"version":"FakeTSVersion"}
+
+//// [/src/project/tsconfig.tsbuildinfo.readable.baseline.txt]
+{
+ "program": {
+ "fileInfos": {
+ "../../lib/lib.d.ts": {
+ "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };",
+ "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true
+ },
+ "./src/filepresent.ts": {
+ "version": "-12346563362-function something() { return 10; }",
+ "signature": "-2893492081-declare function something(): number;\r\n",
+ "affectsGlobalScope": true
+ },
+ "./src/anotherfilewithsamereferenes.ts": {
+ "version": "-28237004260-/// \n/// \nfunction anotherFileWithSameReferenes() { }\n",
+ "signature": "5108835150-/// \r\ndeclare function anotherFileWithSameReferenes(): void;\r\n",
+ "affectsGlobalScope": true
+ },
+ "./src/main.ts": {
+ "version": "-21256825585-/// \n/// \nfunction main() { }\n",
+ "signature": "-7575087679-/// \r\ndeclare function main(): void;\r\n",
+ "affectsGlobalScope": true
+ }
+ },
+ "options": {
+ "composite": true,
+ "project": "./",
+ "configFilePath": "./tsconfig.json"
+ },
+ "referencedMap": {
+ "./src/anotherfilewithsamereferenes.ts": [
+ "./src/filepresent.ts",
+ "./src/filenotfound.ts"
+ ],
+ "./src/main.ts": [
+ "./src/filepresent.ts",
+ "./src/filenotfound.ts"
+ ]
+ },
+ "exportedModulesMap": {},
+ "semanticDiagnosticsPerFile": [
+ "../../lib/lib.d.ts",
+ "./src/anotherfilewithsamereferenes.ts",
+ "./src/filepresent.ts",
+ "./src/main.ts"
+ ]
+ },
+ "version": "FakeTSVersion"
+}
+
+
+
+Change:: no-change-run
+Input::
+
+
+Output::
+/lib/tsc --p src/project
+[96msrc/project/src/anotherFileWithSameReferenes.ts[0m:[93m2[0m:[93m22[0m - [91merror[0m[90m TS6053: [0mFile '/src/project/src/fileNotFound.ts' not found.
+
+[7m2[0m ///
+[7m [0m [91m ~~~~~~~~~~~~~~~~~[0m
+
+[96msrc/project/src/main.ts[0m:[93m2[0m:[93m22[0m - [91merror[0m[90m TS6053: [0mFile '/src/project/src/fileNotFound.ts' not found.
+
+[7m2[0m ///
+[7m [0m [91m ~~~~~~~~~~~~~~~~~[0m
+
+
+Found 2 errors.
+
+exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated
+Program root files: ["/src/project/src/anotherFileWithSameReferenes.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"]
+Program options: {"composite":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"}
+Program structureReused: Not
+Program files::
+/lib/lib.d.ts
+/src/project/src/filePresent.ts
+/src/project/src/anotherFileWithSameReferenes.ts
+/src/project/src/main.ts
+
+Semantic diagnostics in builder refreshed for::
+
+
+
+
+Change:: Modify main file
+Input::
+//// [/src/project/src/main.ts]
+///
+///
+function main() { }
+something();
+
+
+
+Output::
+/lib/tsc --p src/project
+[96msrc/project/src/anotherFileWithSameReferenes.ts[0m:[93m2[0m:[93m22[0m - [91merror[0m[90m TS6053: [0mFile '/src/project/src/fileNotFound.ts' not found.
+
+[7m2[0m ///
+[7m [0m [91m ~~~~~~~~~~~~~~~~~[0m
+
+[96msrc/project/src/main.ts[0m:[93m2[0m:[93m22[0m - [91merror[0m[90m TS6053: [0mFile '/src/project/src/fileNotFound.ts' not found.
+
+[7m2[0m ///
+[7m [0m [91m ~~~~~~~~~~~~~~~~~[0m
+
+
+Found 2 errors.
+
+exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated
+Program root files: ["/src/project/src/anotherFileWithSameReferenes.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts"]
+Program options: {"composite":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"}
+Program structureReused: Not
+Program files::
+/lib/lib.d.ts
+/src/project/src/filePresent.ts
+/src/project/src/anotherFileWithSameReferenes.ts
+/src/project/src/main.ts
+
+Semantic diagnostics in builder refreshed for::
+/src/project/src/main.ts
+
+
+//// [/src/project/src/main.d.ts] file written with same contents
+//// [/src/project/src/main.js]
+///
+///
+function main() { }
+something();
+
+
+//// [/src/project/tsconfig.tsbuildinfo]
+{"program":{"fileNames":["../../lib/lib.d.ts","./src/filepresent.ts","./src/anotherfilewithsamereferenes.ts","./src/main.ts","./src/filenotfound.ts"],"fileInfos":[{"version":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","signature":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},{"version":"-12346563362-function something() { return 10; }","signature":"-2893492081-declare function something(): number;\r\n","affectsGlobalScope":true},{"version":"-28237004260-/// \n/// \nfunction anotherFileWithSameReferenes() { }\n","signature":"5108835150-/// \r\ndeclare function anotherFileWithSameReferenes(): void;\r\n","affectsGlobalScope":true},{"version":"-24702349751-/// \n/// \nfunction main() { }\nsomething();","signature":"-7575087679-/// \r\ndeclare function main(): void;\r\n","affectsGlobalScope":true}],"options":{"composite":true,"project":"./","configFilePath":"./tsconfig.json"},"fileIdsList":[[1,4]],"referencedMap":[[2,0],[3,0]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[0,2,1,3]},"version":"FakeTSVersion"}
+
+//// [/src/project/tsconfig.tsbuildinfo.readable.baseline.txt]
+{
+ "program": {
+ "fileInfos": {
+ "../../lib/lib.d.ts": {
+ "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };",
+ "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true
+ },
+ "./src/filepresent.ts": {
+ "version": "-12346563362-function something() { return 10; }",
+ "signature": "-2893492081-declare function something(): number;\r\n",
+ "affectsGlobalScope": true
+ },
+ "./src/anotherfilewithsamereferenes.ts": {
+ "version": "-28237004260-/// \n/// \nfunction anotherFileWithSameReferenes() { }\n",
+ "signature": "5108835150-/// \r\ndeclare function anotherFileWithSameReferenes(): void;\r\n",
+ "affectsGlobalScope": true
+ },
+ "./src/main.ts": {
+ "version": "-24702349751-/// \n/// \nfunction main() { }\nsomething();",
+ "signature": "-7575087679-/// \r\ndeclare function main(): void;\r\n",
+ "affectsGlobalScope": true
+ }
+ },
+ "options": {
+ "composite": true,
+ "project": "./",
+ "configFilePath": "./tsconfig.json"
+ },
+ "referencedMap": {
+ "./src/anotherfilewithsamereferenes.ts": [
+ "./src/filepresent.ts",
+ "./src/filenotfound.ts"
+ ],
+ "./src/main.ts": [
+ "./src/filepresent.ts",
+ "./src/filenotfound.ts"
+ ]
+ },
+ "exportedModulesMap": {},
+ "semanticDiagnosticsPerFile": [
+ "../../lib/lib.d.ts",
+ "./src/anotherfilewithsamereferenes.ts",
+ "./src/filepresent.ts",
+ "./src/main.ts"
+ ]
+ },
+ "version": "FakeTSVersion"
+}
+
+
+
+Change:: Add new file and update main file
+Input::
+//// [/src/project/src/main.ts]
+///
+///
+///
+function main() { }
+something();foo();
+
+//// [/src/project/src/newFile.ts]
+function foo() { return 20; }
+
+
+
+Output::
+/lib/tsc --p src/project
+[96msrc/project/src/anotherFileWithSameReferenes.ts[0m:[93m2[0m:[93m22[0m - [91merror[0m[90m TS6053: [0mFile '/src/project/src/fileNotFound.ts' not found.
+
+[7m2[0m ///
+[7m [0m [91m ~~~~~~~~~~~~~~~~~[0m
+
+[96msrc/project/src/main.ts[0m:[93m3[0m:[93m22[0m - [91merror[0m[90m TS6053: [0mFile '/src/project/src/fileNotFound.ts' not found.
+
+[7m3[0m ///
+[7m [0m [91m ~~~~~~~~~~~~~~~~~[0m
+
+
+Found 2 errors.
+
+exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated
+Program root files: ["/src/project/src/anotherFileWithSameReferenes.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"]
+Program options: {"composite":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"}
+Program structureReused: Not
+Program files::
+/lib/lib.d.ts
+/src/project/src/filePresent.ts
+/src/project/src/anotherFileWithSameReferenes.ts
+/src/project/src/newFile.ts
+/src/project/src/main.ts
+
+Semantic diagnostics in builder refreshed for::
+/lib/lib.d.ts
+/src/project/src/filePresent.ts
+/src/project/src/anotherFileWithSameReferenes.ts
+/src/project/src/newFile.ts
+/src/project/src/main.ts
+
+
+//// [/src/project/src/anotherFileWithSameReferenes.d.ts] file written with same contents
+//// [/src/project/src/anotherFileWithSameReferenes.js] file written with same contents
+//// [/src/project/src/filePresent.d.ts] file written with same contents
+//// [/src/project/src/filePresent.js] file written with same contents
+//// [/src/project/src/main.d.ts]
+///
+///
+declare function main(): void;
+
+
+//// [/src/project/src/main.js]
+///
+///
+///
+function main() { }
+something();
+foo();
+
+
+//// [/src/project/src/newFile.d.ts]
+declare function foo(): number;
+
+
+//// [/src/project/src/newFile.js]
+function foo() { return 20; }
+
+
+//// [/src/project/tsconfig.tsbuildinfo]
+{"program":{"fileNames":["../../lib/lib.d.ts","./src/filepresent.ts","./src/anotherfilewithsamereferenes.ts","./src/newfile.ts","./src/main.ts","./src/filenotfound.ts"],"fileInfos":[{"version":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","signature":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},{"version":"-12346563362-function something() { return 10; }","signature":"-2893492081-declare function something(): number;\r\n","affectsGlobalScope":true},{"version":"-28237004260-/// \n/// \nfunction anotherFileWithSameReferenes() { }\n","signature":"5108835150-/// \r\ndeclare function anotherFileWithSameReferenes(): void;\r\n","affectsGlobalScope":true},{"version":"5451387573-function foo() { return 20; }","signature":"-94503195-declare function foo(): number;\r\n","affectsGlobalScope":true},{"version":"-5966033614-/// \n/// \n/// \nfunction main() { }\nsomething();foo();","signature":"23846498620-/// \r\n/// \r\ndeclare function main(): void;\r\n","affectsGlobalScope":true}],"options":{"composite":true,"project":"./","configFilePath":"./tsconfig.json"},"fileIdsList":[[1,5],[1,3,5]],"referencedMap":[[2,0],[4,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[0,2,1,4,3]},"version":"FakeTSVersion"}
+
+//// [/src/project/tsconfig.tsbuildinfo.readable.baseline.txt]
+{
+ "program": {
+ "fileInfos": {
+ "../../lib/lib.d.ts": {
+ "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };",
+ "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true
+ },
+ "./src/filepresent.ts": {
+ "version": "-12346563362-function something() { return 10; }",
+ "signature": "-2893492081-declare function something(): number;\r\n",
+ "affectsGlobalScope": true
+ },
+ "./src/anotherfilewithsamereferenes.ts": {
+ "version": "-28237004260-/// \n/// \nfunction anotherFileWithSameReferenes() { }\n",
+ "signature": "5108835150-/// \r\ndeclare function anotherFileWithSameReferenes(): void;\r\n",
+ "affectsGlobalScope": true
+ },
+ "./src/newfile.ts": {
+ "version": "5451387573-function foo() { return 20; }",
+ "signature": "-94503195-declare function foo(): number;\r\n",
+ "affectsGlobalScope": true
+ },
+ "./src/main.ts": {
+ "version": "-5966033614-/// \n/// \n/// \nfunction main() { }\nsomething();foo();",
+ "signature": "23846498620-/// \r\n/// \r\ndeclare function main(): void;\r\n",
+ "affectsGlobalScope": true
+ }
+ },
+ "options": {
+ "composite": true,
+ "project": "./",
+ "configFilePath": "./tsconfig.json"
+ },
+ "referencedMap": {
+ "./src/anotherfilewithsamereferenes.ts": [
+ "./src/filepresent.ts",
+ "./src/filenotfound.ts"
+ ],
+ "./src/main.ts": [
+ "./src/filepresent.ts",
+ "./src/newfile.ts",
+ "./src/filenotfound.ts"
+ ]
+ },
+ "exportedModulesMap": {},
+ "semanticDiagnosticsPerFile": [
+ "../../lib/lib.d.ts",
+ "./src/anotherfilewithsamereferenes.ts",
+ "./src/filepresent.ts",
+ "./src/main.ts",
+ "./src/newfile.ts"
+ ]
+ },
+ "version": "FakeTSVersion"
+}
+
+
+
+Change:: Write file that could not be resolved
+Input::
+//// [/src/project/src/fileNotFound.ts]
+function something2() { return 20; }
+
+
+
+Output::
+/lib/tsc --p src/project
+exitCode:: ExitStatus.Success
+Program root files: ["/src/project/src/anotherFileWithSameReferenes.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"]
+Program options: {"composite":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"}
+Program structureReused: Not
+Program files::
+/lib/lib.d.ts
+/src/project/src/filePresent.ts
+/src/project/src/fileNotFound.ts
+/src/project/src/anotherFileWithSameReferenes.ts
+/src/project/src/newFile.ts
+/src/project/src/main.ts
+
+Semantic diagnostics in builder refreshed for::
+/lib/lib.d.ts
+/src/project/src/filePresent.ts
+/src/project/src/fileNotFound.ts
+/src/project/src/anotherFileWithSameReferenes.ts
+/src/project/src/newFile.ts
+/src/project/src/main.ts
+
+
+//// [/src/project/src/anotherFileWithSameReferenes.d.ts]
+///
+///
+declare function anotherFileWithSameReferenes(): void;
+
+
+//// [/src/project/src/anotherFileWithSameReferenes.js] file written with same contents
+//// [/src/project/src/fileNotFound.d.ts]
+declare function something2(): number;
+
+
+//// [/src/project/src/fileNotFound.js]
+function something2() { return 20; }
+
+
+//// [/src/project/src/filePresent.d.ts] file written with same contents
+//// [/src/project/src/filePresent.js] file written with same contents
+//// [/src/project/src/main.d.ts]
+///
+///
+///
+declare function main(): void;
+
+
+//// [/src/project/src/main.js] file written with same contents
+//// [/src/project/src/newFile.d.ts] file written with same contents
+//// [/src/project/src/newFile.js] file written with same contents
+//// [/src/project/tsconfig.tsbuildinfo]
+{"program":{"fileNames":["../../lib/lib.d.ts","./src/filepresent.ts","./src/filenotfound.ts","./src/anotherfilewithsamereferenes.ts","./src/newfile.ts","./src/main.ts"],"fileInfos":[{"version":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","signature":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},{"version":"-12346563362-function something() { return 10; }","signature":"-2893492081-declare function something(): number;\r\n","affectsGlobalScope":true},{"version":"-9011934479-function something2() { return 20; }","signature":"-11552458975-declare function something2(): number;\r\n","affectsGlobalScope":true},{"version":"-28237004260-/// \n/// \nfunction anotherFileWithSameReferenes() { }\n","signature":"-13698947860-/// \r\n/// \r\ndeclare function anotherFileWithSameReferenes(): void;\r\n","affectsGlobalScope":true},{"version":"5451387573-function foo() { return 20; }","signature":"-94503195-declare function foo(): number;\r\n","affectsGlobalScope":true},{"version":"-5966033614-/// \n/// \n/// \nfunction main() { }\nsomething();foo();","signature":"25064093018-/// \r\n/// \r\n/// \r\ndeclare function main(): void;\r\n","affectsGlobalScope":true}],"options":{"composite":true,"project":"./","configFilePath":"./tsconfig.json"},"fileIdsList":[[1,2],[1,2,4]],"referencedMap":[[3,0],[5,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[0,3,2,1,5,4]},"version":"FakeTSVersion"}
+
+//// [/src/project/tsconfig.tsbuildinfo.readable.baseline.txt]
+{
+ "program": {
+ "fileInfos": {
+ "../../lib/lib.d.ts": {
+ "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };",
+ "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true
+ },
+ "./src/filepresent.ts": {
+ "version": "-12346563362-function something() { return 10; }",
+ "signature": "-2893492081-declare function something(): number;\r\n",
+ "affectsGlobalScope": true
+ },
+ "./src/filenotfound.ts": {
+ "version": "-9011934479-function something2() { return 20; }",
+ "signature": "-11552458975-declare function something2(): number;\r\n",
+ "affectsGlobalScope": true
+ },
+ "./src/anotherfilewithsamereferenes.ts": {
+ "version": "-28237004260-/// \n/// \nfunction anotherFileWithSameReferenes() { }\n",
+ "signature": "-13698947860-/// \r\n/// \r\ndeclare function anotherFileWithSameReferenes(): void;\r\n",
+ "affectsGlobalScope": true
+ },
+ "./src/newfile.ts": {
+ "version": "5451387573-function foo() { return 20; }",
+ "signature": "-94503195-declare function foo(): number;\r\n",
+ "affectsGlobalScope": true
+ },
+ "./src/main.ts": {
+ "version": "-5966033614-/// \n/// \n/// \nfunction main() { }\nsomething();foo();",
+ "signature": "25064093018-/// \r\n/// \r\n/// \r\ndeclare function main(): void;\r\n",
+ "affectsGlobalScope": true
+ }
+ },
+ "options": {
+ "composite": true,
+ "project": "./",
+ "configFilePath": "./tsconfig.json"
+ },
+ "referencedMap": {
+ "./src/anotherfilewithsamereferenes.ts": [
+ "./src/filepresent.ts",
+ "./src/filenotfound.ts"
+ ],
+ "./src/main.ts": [
+ "./src/filepresent.ts",
+ "./src/filenotfound.ts",
+ "./src/newfile.ts"
+ ]
+ },
+ "exportedModulesMap": {},
+ "semanticDiagnosticsPerFile": [
+ "../../lib/lib.d.ts",
+ "./src/anotherfilewithsamereferenes.ts",
+ "./src/filenotfound.ts",
+ "./src/filepresent.ts",
+ "./src/main.ts",
+ "./src/newfile.ts"
+ ]
+ },
+ "version": "FakeTSVersion"
+}
+
+
+
+Change:: Modify main file
+Input::
+//// [/src/project/src/main.ts]
+///
+///
+///
+function main() { }
+something();foo();something();
+
+
+
+Output::
+/lib/tsc --p src/project
+exitCode:: ExitStatus.Success
+Program root files: ["/src/project/src/anotherFileWithSameReferenes.ts","/src/project/src/fileNotFound.ts","/src/project/src/filePresent.ts","/src/project/src/main.ts","/src/project/src/newFile.ts"]
+Program options: {"composite":true,"project":"/src/project","configFilePath":"/src/project/tsconfig.json"}
+Program structureReused: Not
+Program files::
+/lib/lib.d.ts
+/src/project/src/filePresent.ts
+/src/project/src/fileNotFound.ts
+/src/project/src/anotherFileWithSameReferenes.ts
+/src/project/src/newFile.ts
+/src/project/src/main.ts
+
+Semantic diagnostics in builder refreshed for::
+/src/project/src/main.ts
+
+
+//// [/src/project/src/main.d.ts] file written with same contents
+//// [/src/project/src/main.js]
+///
+///
+///
+function main() { }
+something();
+foo();
+something();
+
+
+//// [/src/project/tsconfig.tsbuildinfo]
+{"program":{"fileNames":["../../lib/lib.d.ts","./src/filepresent.ts","./src/filenotfound.ts","./src/anotherfilewithsamereferenes.ts","./src/newfile.ts","./src/main.ts"],"fileInfos":[{"version":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","signature":"3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };","affectsGlobalScope":true},{"version":"-12346563362-function something() { return 10; }","signature":"-2893492081-declare function something(): number;\r\n","affectsGlobalScope":true},{"version":"-9011934479-function something2() { return 20; }","signature":"-11552458975-declare function something2(): number;\r\n","affectsGlobalScope":true},{"version":"-28237004260-/// \n/// \nfunction anotherFileWithSameReferenes() { }\n","signature":"-13698947860-/// \r\n/// \r\ndeclare function anotherFileWithSameReferenes(): void;\r\n","affectsGlobalScope":true},{"version":"5451387573-function foo() { return 20; }","signature":"-94503195-declare function foo(): number;\r\n","affectsGlobalScope":true},{"version":"54088428-/// \n/// \n/// \nfunction main() { }\nsomething();foo();something();","signature":"25064093018-/// \r\n/// \r\n/// \r\ndeclare function main(): void;\r\n","affectsGlobalScope":true}],"options":{"composite":true,"project":"./","configFilePath":"./tsconfig.json"},"fileIdsList":[[1,2],[1,2,4]],"referencedMap":[[3,0],[5,1]],"exportedModulesMap":[],"semanticDiagnosticsPerFile":[0,3,2,1,5,4]},"version":"FakeTSVersion"}
+
+//// [/src/project/tsconfig.tsbuildinfo.readable.baseline.txt]
+{
+ "program": {
+ "fileInfos": {
+ "../../lib/lib.d.ts": {
+ "version": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };",
+ "signature": "3858781397-/// \ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array { length: number; [n: number]: T; }\ninterface ReadonlyArray {}\ndeclare const console: { log(msg: any): void; };",
+ "affectsGlobalScope": true
+ },
+ "./src/filepresent.ts": {
+ "version": "-12346563362-function something() { return 10; }",
+ "signature": "-2893492081-declare function something(): number;\r\n",
+ "affectsGlobalScope": true
+ },
+ "./src/filenotfound.ts": {
+ "version": "-9011934479-function something2() { return 20; }",
+ "signature": "-11552458975-declare function something2(): number;\r\n",
+ "affectsGlobalScope": true
+ },
+ "./src/anotherfilewithsamereferenes.ts": {
+ "version": "-28237004260-/// \n/// \nfunction anotherFileWithSameReferenes() { }\n",
+ "signature": "-13698947860-/// \r\n/// \r\ndeclare function anotherFileWithSameReferenes(): void;\r\n",
+ "affectsGlobalScope": true
+ },
+ "./src/newfile.ts": {
+ "version": "5451387573-function foo() { return 20; }",
+ "signature": "-94503195-declare function foo(): number;\r\n",
+ "affectsGlobalScope": true
+ },
+ "./src/main.ts": {
+ "version": "54088428-/// \n/// \n/// \nfunction main() { }\nsomething();foo();something();",
+ "signature": "25064093018-/// \r\n/// \r\n/// \r\ndeclare function main(): void;\r\n",
+ "affectsGlobalScope": true
+ }
+ },
+ "options": {
+ "composite": true,
+ "project": "./",
+ "configFilePath": "./tsconfig.json"
+ },
+ "referencedMap": {
+ "./src/anotherfilewithsamereferenes.ts": [
+ "./src/filepresent.ts",
+ "./src/filenotfound.ts"
+ ],
+ "./src/main.ts": [
+ "./src/filepresent.ts",
+ "./src/filenotfound.ts",
+ "./src/newfile.ts"
+ ]
+ },
+ "exportedModulesMap": {},
+ "semanticDiagnosticsPerFile": [
+ "../../lib/lib.d.ts",
+ "./src/anotherfilewithsamereferenes.ts",
+ "./src/filenotfound.ts",
+ "./src/filepresent.ts",
+ "./src/main.ts",
+ "./src/newfile.ts"
+ ]
+ },
+ "version": "FakeTSVersion"
+}
+