Ensure that when new file affecting global scope is added, the signatures are updated (#43084)

* Ensure that when new file affecting global scope is added, the signatures are updated

* Update src/compiler/builder.ts

* Better comment
This commit is contained in:
Sheetal Nandi 2021-03-09 17:40:02 -08:00 committed by GitHub
parent 6e4456b3b4
commit acc8f2fb05
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 729 additions and 0 deletions

View file

@ -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));

View file

@ -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`
/// <reference path="./filePresent.ts"/>
/// <reference path="./fileNotFound.ts"/>
function main() { }
`,
"/src/project/src/anotherFileWithSameReferenes.ts": Utils.dedent`
/// <reference path="./filePresent.ts"/>
/// <reference path="./fileNotFound.ts"/>
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`, `/// <reference path="./newFile.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 {

View file

@ -0,0 +1,662 @@
Input::
//// [/lib/lib.d.ts]
/// <reference no-default-lib="true"/>
interface Boolean {}
interface Function {}
interface CallableFunction {}
interface NewableFunction {}
interface IArguments {}
interface Number { toExponential: any; }
interface Object {}
interface RegExp {}
interface String { charAt: any; }
interface Array<T> { length: number; [n: number]: T; }
interface ReadonlyArray<T> {}
declare const console: { log(msg: any): void; };
//// [/src/project/src/anotherFileWithSameReferenes.ts]
/// <reference path="./filePresent.ts"/>
/// <reference path="./fileNotFound.ts"/>
function anotherFileWithSameReferenes() { }
//// [/src/project/src/filePresent.ts]
function something() { return 10; }
//// [/src/project/src/main.ts]
/// <reference path="./filePresent.ts"/>
/// <reference path="./fileNotFound.ts"/>
function main() { }
//// [/src/project/tsconfig.json]
{"compilerOptions":{"composite":true},"include":["src/**/*.ts"]}
Output::
/lib/tsc --p src/project
src/project/src/anotherFileWithSameReferenes.ts:2:22 - error TS6053: File '/src/project/src/fileNotFound.ts' not found.
2 /// <reference path="./fileNotFound.ts"/>
   ~~~~~~~~~~~~~~~~~
src/project/src/main.ts:2:22 - error TS6053: File '/src/project/src/fileNotFound.ts' not found.
2 /// <reference path="./fileNotFound.ts"/>
   ~~~~~~~~~~~~~~~~~
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]
/// <reference path="filePresent.d.ts" />
declare function anotherFileWithSameReferenes(): void;
//// [/src/project/src/anotherFileWithSameReferenes.js]
/// <reference path="./filePresent.ts"/>
/// <reference path="./fileNotFound.ts"/>
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]
/// <reference path="filePresent.d.ts" />
declare function main(): void;
//// [/src/project/src/main.js]
/// <reference path="./filePresent.ts"/>
/// <reference path="./fileNotFound.ts"/>
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-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","signature":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\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-/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction anotherFileWithSameReferenes() { }\n","signature":"5108835150-/// <reference path=\"filePresent.d.ts\" />\r\ndeclare function anotherFileWithSameReferenes(): void;\r\n","affectsGlobalScope":true},{"version":"-21256825585-/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction main() { }\n","signature":"-7575087679-/// <reference path=\"filePresent.d.ts\" />\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-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\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-/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction anotherFileWithSameReferenes() { }\n",
"signature": "5108835150-/// <reference path=\"filePresent.d.ts\" />\r\ndeclare function anotherFileWithSameReferenes(): void;\r\n",
"affectsGlobalScope": true
},
"./src/main.ts": {
"version": "-21256825585-/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction main() { }\n",
"signature": "-7575087679-/// <reference path=\"filePresent.d.ts\" />\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
src/project/src/anotherFileWithSameReferenes.ts:2:22 - error TS6053: File '/src/project/src/fileNotFound.ts' not found.
2 /// <reference path="./fileNotFound.ts"/>
   ~~~~~~~~~~~~~~~~~
src/project/src/main.ts:2:22 - error TS6053: File '/src/project/src/fileNotFound.ts' not found.
2 /// <reference path="./fileNotFound.ts"/>
   ~~~~~~~~~~~~~~~~~
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]
/// <reference path="./filePresent.ts"/>
/// <reference path="./fileNotFound.ts"/>
function main() { }
something();
Output::
/lib/tsc --p src/project
src/project/src/anotherFileWithSameReferenes.ts:2:22 - error TS6053: File '/src/project/src/fileNotFound.ts' not found.
2 /// <reference path="./fileNotFound.ts"/>
   ~~~~~~~~~~~~~~~~~
src/project/src/main.ts:2:22 - error TS6053: File '/src/project/src/fileNotFound.ts' not found.
2 /// <reference path="./fileNotFound.ts"/>
   ~~~~~~~~~~~~~~~~~
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]
/// <reference path="./filePresent.ts"/>
/// <reference path="./fileNotFound.ts"/>
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-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","signature":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\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-/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction anotherFileWithSameReferenes() { }\n","signature":"5108835150-/// <reference path=\"filePresent.d.ts\" />\r\ndeclare function anotherFileWithSameReferenes(): void;\r\n","affectsGlobalScope":true},{"version":"-24702349751-/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction main() { }\nsomething();","signature":"-7575087679-/// <reference path=\"filePresent.d.ts\" />\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-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\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-/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction anotherFileWithSameReferenes() { }\n",
"signature": "5108835150-/// <reference path=\"filePresent.d.ts\" />\r\ndeclare function anotherFileWithSameReferenes(): void;\r\n",
"affectsGlobalScope": true
},
"./src/main.ts": {
"version": "-24702349751-/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction main() { }\nsomething();",
"signature": "-7575087679-/// <reference path=\"filePresent.d.ts\" />\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]
/// <reference path="./newFile.ts"/>
/// <reference path="./filePresent.ts"/>
/// <reference path="./fileNotFound.ts"/>
function main() { }
something();foo();
//// [/src/project/src/newFile.ts]
function foo() { return 20; }
Output::
/lib/tsc --p src/project
src/project/src/anotherFileWithSameReferenes.ts:2:22 - error TS6053: File '/src/project/src/fileNotFound.ts' not found.
2 /// <reference path="./fileNotFound.ts"/>
   ~~~~~~~~~~~~~~~~~
src/project/src/main.ts:3:22 - error TS6053: File '/src/project/src/fileNotFound.ts' not found.
3 /// <reference path="./fileNotFound.ts"/>
   ~~~~~~~~~~~~~~~~~
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]
/// <reference path="newFile.d.ts" />
/// <reference path="filePresent.d.ts" />
declare function main(): void;
//// [/src/project/src/main.js]
/// <reference path="./newFile.ts"/>
/// <reference path="./filePresent.ts"/>
/// <reference path="./fileNotFound.ts"/>
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-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","signature":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\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-/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction anotherFileWithSameReferenes() { }\n","signature":"5108835150-/// <reference path=\"filePresent.d.ts\" />\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-/// <reference path=\"./newFile.ts\"/>\n/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction main() { }\nsomething();foo();","signature":"23846498620-/// <reference path=\"newFile.d.ts\" />\r\n/// <reference path=\"filePresent.d.ts\" />\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-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\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-/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction anotherFileWithSameReferenes() { }\n",
"signature": "5108835150-/// <reference path=\"filePresent.d.ts\" />\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-/// <reference path=\"./newFile.ts\"/>\n/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction main() { }\nsomething();foo();",
"signature": "23846498620-/// <reference path=\"newFile.d.ts\" />\r\n/// <reference path=\"filePresent.d.ts\" />\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]
/// <reference path="filePresent.d.ts" />
/// <reference path="fileNotFound.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]
/// <reference path="newFile.d.ts" />
/// <reference path="filePresent.d.ts" />
/// <reference path="fileNotFound.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-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","signature":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\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-/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction anotherFileWithSameReferenes() { }\n","signature":"-13698947860-/// <reference path=\"filePresent.d.ts\" />\r\n/// <reference path=\"fileNotFound.d.ts\" />\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-/// <reference path=\"./newFile.ts\"/>\n/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction main() { }\nsomething();foo();","signature":"25064093018-/// <reference path=\"newFile.d.ts\" />\r\n/// <reference path=\"filePresent.d.ts\" />\r\n/// <reference path=\"fileNotFound.d.ts\" />\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-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\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-/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction anotherFileWithSameReferenes() { }\n",
"signature": "-13698947860-/// <reference path=\"filePresent.d.ts\" />\r\n/// <reference path=\"fileNotFound.d.ts\" />\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-/// <reference path=\"./newFile.ts\"/>\n/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction main() { }\nsomething();foo();",
"signature": "25064093018-/// <reference path=\"newFile.d.ts\" />\r\n/// <reference path=\"filePresent.d.ts\" />\r\n/// <reference path=\"fileNotFound.d.ts\" />\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]
/// <reference path="./newFile.ts"/>
/// <reference path="./filePresent.ts"/>
/// <reference path="./fileNotFound.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]
/// <reference path="./newFile.ts"/>
/// <reference path="./filePresent.ts"/>
/// <reference path="./fileNotFound.ts"/>
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-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };","signature":"3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\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-/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction anotherFileWithSameReferenes() { }\n","signature":"-13698947860-/// <reference path=\"filePresent.d.ts\" />\r\n/// <reference path=\"fileNotFound.d.ts\" />\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-/// <reference path=\"./newFile.ts\"/>\n/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction main() { }\nsomething();foo();something();","signature":"25064093018-/// <reference path=\"newFile.d.ts\" />\r\n/// <reference path=\"filePresent.d.ts\" />\r\n/// <reference path=\"fileNotFound.d.ts\" />\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-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };",
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\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-/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction anotherFileWithSameReferenes() { }\n",
"signature": "-13698947860-/// <reference path=\"filePresent.d.ts\" />\r\n/// <reference path=\"fileNotFound.d.ts\" />\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-/// <reference path=\"./newFile.ts\"/>\n/// <reference path=\"./filePresent.ts\"/>\n/// <reference path=\"./fileNotFound.ts\"/>\nfunction main() { }\nsomething();foo();something();",
"signature": "25064093018-/// <reference path=\"newFile.d.ts\" />\r\n/// <reference path=\"filePresent.d.ts\" />\r\n/// <reference path=\"fileNotFound.d.ts\" />\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"
}