From 9a741bc99c9a3c2cfd7d43be2e1b73f023b42bda Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Mon, 15 Jun 2020 12:55:00 -0700 Subject: [PATCH 1/2] Some tests --- src/testRunner/unittests/tsbuild/helpers.ts | 6 +- src/testRunner/unittests/tsc/incremental.ts | 119 +++ .../initial-build/noEmit-changes-composite.js | 919 +++++++++++++++++ .../noEmit-changes-incremental-declaration.js | 922 ++++++++++++++++++ .../noEmit-changes-incremental.js | 872 +++++++++++++++++ ...t-changes-with-initial-noEmit-composite.js | 603 ++++++++++++ ...-initial-noEmit-incremental-declaration.js | 606 ++++++++++++ ...changes-with-initial-noEmit-incremental.js | 556 +++++++++++ 8 files changed, 4600 insertions(+), 3 deletions(-) create mode 100644 tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-composite.js create mode 100644 tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-incremental-declaration.js create mode 100644 tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-incremental.js create mode 100644 tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-composite.js create mode 100644 tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-incremental-declaration.js create mode 100644 tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-incremental.js diff --git a/src/testRunner/unittests/tsbuild/helpers.ts b/src/testRunner/unittests/tsbuild/helpers.ts index 9f9143f6a3985..4f4fe6e4702f1 100644 --- a/src/testRunner/unittests/tsbuild/helpers.ts +++ b/src/testRunner/unittests/tsbuild/helpers.ts @@ -423,7 +423,7 @@ interface Symbol { subScenario, baseFs, newSys, - commandLineArgs, + commandLineArgs: incrementalCommandLineArgs || commandLineArgs, incrementalModifyFs, modifyFs, tick @@ -515,12 +515,12 @@ interface Symbol { })); }); describe("incremental correctness", () => { - incrementalScenarios.forEach((_, index) => verifyIncrementalCorrectness(() => ({ + incrementalScenarios.forEach(({ commandLineArgs: incrementalCommandLineArgs }, index) => verifyIncrementalCorrectness(() => ({ scenario, subScenario, baseFs, newSys: incrementalSys[index], - commandLineArgs, + commandLineArgs: incrementalCommandLineArgs || commandLineArgs, incrementalModifyFs: fs => { for (let i = 0; i <= index; i++) { incrementalScenarios[i].modifyFs(fs); diff --git a/src/testRunner/unittests/tsc/incremental.ts b/src/testRunner/unittests/tsc/incremental.ts index b231b439858dc..fd42ccddf1843 100644 --- a/src/testRunner/unittests/tsc/incremental.ts +++ b/src/testRunner/unittests/tsc/incremental.ts @@ -116,5 +116,124 @@ const a: string = "hello";`, "utf-8"), const a: string = 10;`, "utf-8"), ); }); + + describe("when noEmit changes between compilation", () => { + verifyNoEmitChanges({ incremental: true }); + verifyNoEmitChanges({ incremental: true, declaration: true }); + verifyNoEmitChanges({ composite: true }); + + function verifyNoEmitChanges(compilerOptions: CompilerOptions) { + const noChangeRunWithNoEmit: TscIncremental = { + subScenario: "No Change run with noEmit", + commandLineArgs: ["--p", "src/project", "--noEmit"], + ...noChangeRun, + }; + const noChangeRunWithEmit: TscIncremental = { + subScenario: "No Change run with emit", + commandLineArgs: ["--p", "src/project"], + ...noChangeRun, + }; + let optionsString = ""; + for (const key in compilerOptions) { + if (hasProperty(compilerOptions, key)) { + optionsString += ` ${key}`; + } + } + + verifyTscSerializedIncrementalEdits({ + scenario: "incremental", + subScenario: `noEmit changes${optionsString}`, + commandLineArgs: ["--p", "src/project"], + fs, + incrementalScenarios: [ + noChangeRunWithNoEmit, + noChangeRunWithNoEmit, + { + subScenario: "Introduce error but still noEmit", + commandLineArgs: ["--p", "src/project", "--noEmit"], + modifyFs: fs => replaceText(fs, "/src/project/src/class.ts", "prop", "prop1"), + buildKind: BuildKind.IncrementalDtsChange + }, + { + subScenario: "Fix error and emit", + modifyFs: fs => replaceText(fs, "/src/project/src/class.ts", "prop1", "prop"), + buildKind: BuildKind.IncrementalDtsChange + }, + noChangeRunWithEmit, + noChangeRunWithNoEmit, + noChangeRunWithNoEmit, + noChangeRunWithEmit, + { + subScenario: "Introduce error and emit", + modifyFs: fs => replaceText(fs, "/src/project/src/class.ts", "prop", "prop1"), + buildKind: BuildKind.IncrementalDtsChange + }, + noChangeRunWithEmit, + noChangeRunWithNoEmit, + noChangeRunWithNoEmit, + noChangeRunWithEmit, + { + subScenario: "Fix error and no emit", + commandLineArgs: ["--p", "src/project", "--noEmit"], + modifyFs: fs => replaceText(fs, "/src/project/src/class.ts", "prop1", "prop"), + buildKind: BuildKind.IncrementalDtsChange + }, + noChangeRunWithEmit, + noChangeRunWithNoEmit, + noChangeRunWithNoEmit, + noChangeRunWithEmit, + ], + }); + + verifyTscSerializedIncrementalEdits({ + scenario: "incremental", + subScenario: `noEmit changes with initial noEmit${optionsString}`, + commandLineArgs: ["--p", "src/project", "--noEmit"], + fs, + incrementalScenarios: [ + noChangeRunWithEmit, + { + subScenario: "Introduce error with emit", + commandLineArgs: ["--p", "src/project"], + modifyFs: fs => replaceText(fs, "/src/project/src/class.ts", "prop", "prop1"), + buildKind: BuildKind.IncrementalDtsChange + }, + { + subScenario: "Fix error and no emit", + modifyFs: fs => replaceText(fs, "/src/project/src/class.ts", "prop1", "prop"), + buildKind: BuildKind.IncrementalDtsChange + }, + noChangeRunWithEmit, + ], + }); + + function fs() { + return loadProjectFromFiles({ + "/src/project/src/class.ts": Utils.dedent` + export class classC { + prop = 1; + }`, + "/src/project/src/indirectClass.ts": Utils.dedent` + import { classC } from './class'; + export class indirectClass { + classC = new classC(); + }`, + "/src/project/src/directUse.ts": Utils.dedent` + import { indirectClass } from './indirectClass'; + new indirectClass().classC.prop;`, + "/src/project/src/indirectUse.ts": Utils.dedent` + import { indirectClass } from './indirectClass'; + new indirectClass().classC.prop;`, + "/src/project/src/noChangeFile.ts": Utils.dedent` + export function writeLog(s: string) { + }`, + "/src/project/src/noChangeFileWithEmitSpecificError.ts": Utils.dedent` + function someFunc(arguments: boolean, ...rest: any[]) { + }`, + "/src/project/tsconfig.json": JSON.stringify({ compilerOptions }), + }); + } + } + }); }); } diff --git a/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-composite.js b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-composite.js new file mode 100644 index 0000000000000..98e0de00dff85 --- /dev/null +++ b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-composite.js @@ -0,0 +1,919 @@ +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/class.ts] +export class classC { + prop = 1; +} + +//// [/src/project/src/directUse.ts] +import { indirectClass } from './indirectClass'; +new indirectClass().classC.prop; + +//// [/src/project/src/indirectClass.ts] +import { classC } from './class'; +export class indirectClass { + classC = new classC(); +} + +//// [/src/project/src/indirectUse.ts] +import { indirectClass } from './indirectClass'; +new indirectClass().classC.prop; + +//// [/src/project/src/noChangeFile.ts] +export function writeLog(s: string) { +} + +//// [/src/project/src/noChangeFileWithEmitSpecificError.ts] +function someFunc(arguments: boolean, ...rest: any[]) { +} + +//// [/src/project/tsconfig.json] +{"compilerOptions":{"composite":true}} + + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/class.d.ts] +export declare class classC { + prop: number; +} + + +//// [/src/project/src/class.js] +"use strict"; +exports.__esModule = true; +exports.classC = void 0; +var classC = /** @class */ (function () { + function classC() { + this.prop = 1; + } + return classC; +}()); +exports.classC = classC; + + +//// [/src/project/src/directUse.d.ts] +export {}; + + +//// [/src/project/src/directUse.js] +"use strict"; +exports.__esModule = true; +var indirectClass_1 = require("./indirectClass"); +new indirectClass_1.indirectClass().classC.prop; + + +//// [/src/project/src/indirectClass.d.ts] +import { classC } from './class'; +export declare class indirectClass { + classC: classC; +} + + +//// [/src/project/src/indirectClass.js] +"use strict"; +exports.__esModule = true; +exports.indirectClass = void 0; +var class_1 = require("./class"); +var indirectClass = /** @class */ (function () { + function indirectClass() { + this.classC = new class_1.classC(); + } + return indirectClass; +}()); +exports.indirectClass = indirectClass; + + +//// [/src/project/src/indirectUse.d.ts] +export {}; + + +//// [/src/project/src/indirectUse.js] +"use strict"; +exports.__esModule = true; +var indirectClass_1 = require("./indirectClass"); +new indirectClass_1.indirectClass().classC.prop; + + +//// [/src/project/src/noChangeFile.d.ts] +export declare function writeLog(s: string): void; + + +//// [/src/project/src/noChangeFile.js] +"use strict"; +exports.__esModule = true; +exports.writeLog = void 0; +function writeLog(s) { +} +exports.writeLog = writeLog; + + +//// [/src/project/src/noChangeFileWithEmitSpecificError.d.ts] +declare function someFunc(arguments: boolean, ...rest: any[]): void; + + +//// [/src/project/src/noChangeFileWithEmitSpecificError.js] +function someFunc(arguments) { + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } +} + + +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396 + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. + +1 {"compilerOptions":{"composite":true}} +   ~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. + +1 {"compilerOptions":{"composite":true}} +   ~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: Introduce error but still noEmit +Input:: +//// [/src/project/src/class.ts] +export class classC { + prop1 = 1; +} + + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. + +1 {"compilerOptions":{"composite":true}} +   ~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: Fix error and emit +Input:: +//// [/src/project/src/class.ts] +export class classC { + prop = 1; +} + + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. + +1 {"compilerOptions":{"composite":true}} +   ~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. + +1 {"compilerOptions":{"composite":true}} +   ~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + + + +Change:: Introduce error and emit +Input:: +//// [/src/project/src/class.ts] +export class classC { + prop1 = 1; +} + + + +Output:: +/lib/tsc --p src/project +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 3 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/class.d.ts] +export declare class classC { + prop1: number; +} + + +//// [/src/project/src/class.js] +"use strict"; +exports.__esModule = true; +exports.classC = void 0; +var classC = /** @class */ (function () { + function classC() { + this.prop1 = 1; + } + return classC; +}()); +exports.classC = classC; + + +//// [/src/project/src/directUse.d.ts] file written with same contents +//// [/src/project/src/indirectClass.d.ts] file written with same contents +//// [/src/project/src/indirectClass.js] file written with same contents +//// [/src/project/src/indirectUse.d.ts] file written with same contents +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "1786859709-export class classC {\n prop1 = 1;\n}", + "signature": "-3790894605-export declare class classC {\r\n prop1: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + [ + "./src/directuse.ts", + [ + { + "file": "./src/directuse.ts", + "start": 76, + "length": 4, + "code": 2551, + "category": 1, + "messageText": "Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'?", + "relatedInformation": [ + { + "file": "./src/class.ts", + "start": 26, + "length": 5, + "messageText": "'prop1' is declared here.", + "category": 3, + "code": 2728 + } + ] + } + ] + ], + "./src/indirectclass.ts", + [ + "./src/indirectuse.ts", + [ + { + "file": "./src/indirectuse.ts", + "start": 76, + "length": 4, + "code": 2551, + "category": 1, + "messageText": "Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'?", + "relatedInformation": [ + { + "file": "./src/class.ts", + "start": 26, + "length": 5, + "messageText": "'prop1' is declared here.", + "category": 3, + "code": 2728 + } + ] + } + ] + ], + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396 + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 3 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. + +1 {"compilerOptions":{"composite":true}} +   ~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. + +1 {"compilerOptions":{"composite":true}} +   ~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 3 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + + + +Change:: Fix error and no emit +Input:: +//// [/src/project/src/class.ts] +export class classC { + prop = 1; +} + + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. + +1 {"compilerOptions":{"composite":true}} +   ~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/class.d.ts] +export declare class classC { + prop: number; +} + + +//// [/src/project/src/class.js] +"use strict"; +exports.__esModule = true; +exports.classC = void 0; +var classC = /** @class */ (function () { + function classC() { + this.prop = 1; + } + return classC; +}()); +exports.classC = classC; + + +//// [/src/project/src/directUse.d.ts] file written with same contents +//// [/src/project/src/indirectClass.d.ts] file written with same contents +//// [/src/project/src/indirectClass.js] file written with same contents +//// [/src/project/src/indirectUse.d.ts] file written with same contents +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396 + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. + +1 {"compilerOptions":{"composite":true}} +   ~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. + +1 {"compilerOptions":{"composite":true}} +   ~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + diff --git a/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-incremental-declaration.js b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-incremental-declaration.js new file mode 100644 index 0000000000000..12c232adeb038 --- /dev/null +++ b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-incremental-declaration.js @@ -0,0 +1,922 @@ +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/class.ts] +export class classC { + prop = 1; +} + +//// [/src/project/src/directUse.ts] +import { indirectClass } from './indirectClass'; +new indirectClass().classC.prop; + +//// [/src/project/src/indirectClass.ts] +import { classC } from './class'; +export class indirectClass { + classC = new classC(); +} + +//// [/src/project/src/indirectUse.ts] +import { indirectClass } from './indirectClass'; +new indirectClass().classC.prop; + +//// [/src/project/src/noChangeFile.ts] +export function writeLog(s: string) { +} + +//// [/src/project/src/noChangeFileWithEmitSpecificError.ts] +function someFunc(arguments: boolean, ...rest: any[]) { +} + +//// [/src/project/tsconfig.json] +{"compilerOptions":{"incremental":true,"declaration":true}} + + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/class.d.ts] +export declare class classC { + prop: number; +} + + +//// [/src/project/src/class.js] +"use strict"; +exports.__esModule = true; +exports.classC = void 0; +var classC = /** @class */ (function () { + function classC() { + this.prop = 1; + } + return classC; +}()); +exports.classC = classC; + + +//// [/src/project/src/directUse.d.ts] +export {}; + + +//// [/src/project/src/directUse.js] +"use strict"; +exports.__esModule = true; +var indirectClass_1 = require("./indirectClass"); +new indirectClass_1.indirectClass().classC.prop; + + +//// [/src/project/src/indirectClass.d.ts] +import { classC } from './class'; +export declare class indirectClass { + classC: classC; +} + + +//// [/src/project/src/indirectClass.js] +"use strict"; +exports.__esModule = true; +exports.indirectClass = void 0; +var class_1 = require("./class"); +var indirectClass = /** @class */ (function () { + function indirectClass() { + this.classC = new class_1.classC(); + } + return indirectClass; +}()); +exports.indirectClass = indirectClass; + + +//// [/src/project/src/indirectUse.d.ts] +export {}; + + +//// [/src/project/src/indirectUse.js] +"use strict"; +exports.__esModule = true; +var indirectClass_1 = require("./indirectClass"); +new indirectClass_1.indirectClass().classC.prop; + + +//// [/src/project/src/noChangeFile.d.ts] +export declare function writeLog(s: string): void; + + +//// [/src/project/src/noChangeFile.js] +"use strict"; +exports.__esModule = true; +exports.writeLog = void 0; +function writeLog(s) { +} +exports.writeLog = writeLog; + + +//// [/src/project/src/noChangeFileWithEmitSpecificError.d.ts] +declare function someFunc(arguments: boolean, ...rest: any[]): void; + + +//// [/src/project/src/noChangeFileWithEmitSpecificError.js] +function someFunc(arguments) { + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } +} + + +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "declaration": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396 + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true,"declaration":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true,"declaration":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: Introduce error but still noEmit +Input:: +//// [/src/project/src/class.ts] +export class classC { + prop1 = 1; +} + + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true,"declaration":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: Fix error and emit +Input:: +//// [/src/project/src/class.ts] +export class classC { + prop = 1; +} + + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true,"declaration":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true,"declaration":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + + + +Change:: Introduce error and emit +Input:: +//// [/src/project/src/class.ts] +export class classC { + prop1 = 1; +} + + + +Output:: +/lib/tsc --p src/project +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 3 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/class.d.ts] +export declare class classC { + prop1: number; +} + + +//// [/src/project/src/class.js] +"use strict"; +exports.__esModule = true; +exports.classC = void 0; +var classC = /** @class */ (function () { + function classC() { + this.prop1 = 1; + } + return classC; +}()); +exports.classC = classC; + + +//// [/src/project/src/directUse.d.ts] file written with same contents +//// [/src/project/src/indirectClass.d.ts] file written with same contents +//// [/src/project/src/indirectClass.js] file written with same contents +//// [/src/project/src/indirectUse.d.ts] file written with same contents +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "1786859709-export class classC {\n prop1 = 1;\n}", + "signature": "-3790894605-export declare class classC {\r\n prop1: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "declaration": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + [ + "./src/directuse.ts", + [ + { + "file": "./src/directuse.ts", + "start": 76, + "length": 4, + "code": 2551, + "category": 1, + "messageText": "Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'?", + "relatedInformation": [ + { + "file": "./src/class.ts", + "start": 26, + "length": 5, + "messageText": "'prop1' is declared here.", + "category": 3, + "code": 2728 + } + ] + } + ] + ], + "./src/indirectclass.ts", + [ + "./src/indirectuse.ts", + [ + { + "file": "./src/indirectuse.ts", + "start": 76, + "length": 4, + "code": 2551, + "category": 1, + "messageText": "Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'?", + "relatedInformation": [ + { + "file": "./src/class.ts", + "start": 26, + "length": 5, + "messageText": "'prop1' is declared here.", + "category": 3, + "code": 2728 + } + ] + } + ] + ], + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396 + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 3 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true,"declaration":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true,"declaration":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 3 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + + + +Change:: Fix error and no emit +Input:: +//// [/src/project/src/class.ts] +export class classC { + prop = 1; +} + + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true,"declaration":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/class.d.ts] +export declare class classC { + prop: number; +} + + +//// [/src/project/src/class.js] +"use strict"; +exports.__esModule = true; +exports.classC = void 0; +var classC = /** @class */ (function () { + function classC() { + this.prop = 1; + } + return classC; +}()); +exports.classC = classC; + + +//// [/src/project/src/directUse.d.ts] file written with same contents +//// [/src/project/src/indirectClass.d.ts] file written with same contents +//// [/src/project/src/indirectClass.js] file written with same contents +//// [/src/project/src/indirectUse.d.ts] file written with same contents +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "declaration": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396 + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true,"declaration":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true,"declaration":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + diff --git a/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-incremental.js b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-incremental.js new file mode 100644 index 0000000000000..7f7d7f0dd508a --- /dev/null +++ b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-incremental.js @@ -0,0 +1,872 @@ +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/class.ts] +export class classC { + prop = 1; +} + +//// [/src/project/src/directUse.ts] +import { indirectClass } from './indirectClass'; +new indirectClass().classC.prop; + +//// [/src/project/src/indirectClass.ts] +import { classC } from './class'; +export class indirectClass { + classC = new classC(); +} + +//// [/src/project/src/indirectUse.ts] +import { indirectClass } from './indirectClass'; +new indirectClass().classC.prop; + +//// [/src/project/src/noChangeFile.ts] +export function writeLog(s: string) { +} + +//// [/src/project/src/noChangeFileWithEmitSpecificError.ts] +function someFunc(arguments: boolean, ...rest: any[]) { +} + +//// [/src/project/tsconfig.json] +{"compilerOptions":{"incremental":true}} + + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/class.js] +"use strict"; +exports.__esModule = true; +exports.classC = void 0; +var classC = /** @class */ (function () { + function classC() { + this.prop = 1; + } + return classC; +}()); +exports.classC = classC; + + +//// [/src/project/src/directUse.js] +"use strict"; +exports.__esModule = true; +var indirectClass_1 = require("./indirectClass"); +new indirectClass_1.indirectClass().classC.prop; + + +//// [/src/project/src/indirectClass.js] +"use strict"; +exports.__esModule = true; +exports.indirectClass = void 0; +var class_1 = require("./class"); +var indirectClass = /** @class */ (function () { + function indirectClass() { + this.classC = new class_1.classC(); + } + return indirectClass; +}()); +exports.indirectClass = indirectClass; + + +//// [/src/project/src/indirectUse.js] +"use strict"; +exports.__esModule = true; +var indirectClass_1 = require("./indirectClass"); +new indirectClass_1.indirectClass().classC.prop; + + +//// [/src/project/src/noChangeFile.js] +"use strict"; +exports.__esModule = true; +exports.writeLog = void 0; +function writeLog(s) { +} +exports.writeLog = writeLog; + + +//// [/src/project/src/noChangeFileWithEmitSpecificError.js] +function someFunc(arguments) { + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } +} + + +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396 + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: Introduce error but still noEmit +Input:: +//// [/src/project/src/class.ts] +export class classC { + prop1 = 1; +} + + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: Fix error and emit +Input:: +//// [/src/project/src/class.ts] +export class classC { + prop = 1; +} + + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + + + +Change:: Introduce error and emit +Input:: +//// [/src/project/src/class.ts] +export class classC { + prop1 = 1; +} + + + +Output:: +/lib/tsc --p src/project +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 3 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/class.js] +"use strict"; +exports.__esModule = true; +exports.classC = void 0; +var classC = /** @class */ (function () { + function classC() { + this.prop1 = 1; + } + return classC; +}()); +exports.classC = classC; + + +//// [/src/project/src/indirectClass.js] file written with same contents +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "1786859709-export class classC {\n prop1 = 1;\n}", + "signature": "-3790894605-export declare class classC {\r\n prop1: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + [ + "./src/directuse.ts", + [ + { + "file": "./src/directuse.ts", + "start": 76, + "length": 4, + "code": 2551, + "category": 1, + "messageText": "Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'?", + "relatedInformation": [ + { + "file": "./src/class.ts", + "start": 26, + "length": 5, + "messageText": "'prop1' is declared here.", + "category": 3, + "code": 2728 + } + ] + } + ] + ], + "./src/indirectclass.ts", + [ + "./src/indirectuse.ts", + [ + { + "file": "./src/indirectuse.ts", + "start": 76, + "length": 4, + "code": 2551, + "category": 1, + "messageText": "Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'?", + "relatedInformation": [ + { + "file": "./src/class.ts", + "start": 26, + "length": 5, + "messageText": "'prop1' is declared here.", + "category": 3, + "code": 2728 + } + ] + } + ] + ], + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396 + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 3 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 3 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + + + +Change:: Fix error and no emit +Input:: +//// [/src/project/src/class.ts] +export class classC { + prop = 1; +} + + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/class.js] +"use strict"; +exports.__esModule = true; +exports.classC = void 0; +var classC = /** @class */ (function () { + function classC() { + this.prop = 1; + } + return classC; +}()); +exports.classC = classC; + + +//// [/src/project/src/indirectClass.js] file written with same contents +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396 + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with noEmit +Input:: + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + diff --git a/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-composite.js b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-composite.js new file mode 100644 index 0000000000000..45bf871517dad --- /dev/null +++ b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-composite.js @@ -0,0 +1,603 @@ +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/class.ts] +export class classC { + prop = 1; +} + +//// [/src/project/src/directUse.ts] +import { indirectClass } from './indirectClass'; +new indirectClass().classC.prop; + +//// [/src/project/src/indirectClass.ts] +import { classC } from './class'; +export class indirectClass { + classC = new classC(); +} + +//// [/src/project/src/indirectUse.ts] +import { indirectClass } from './indirectClass'; +new indirectClass().classC.prop; + +//// [/src/project/src/noChangeFile.ts] +export function writeLog(s: string) { +} + +//// [/src/project/src/noChangeFileWithEmitSpecificError.ts] +function someFunc(arguments: boolean, ...rest: any[]) { +} + +//// [/src/project/tsconfig.json] +{"compilerOptions":{"composite":true}} + + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. + +1 {"compilerOptions":{"composite":true}} +   ~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/class.d.ts] +export declare class classC { + prop: number; +} + + +//// [/src/project/src/class.js] +"use strict"; +exports.__esModule = true; +exports.classC = void 0; +var classC = /** @class */ (function () { + function classC() { + this.prop = 1; + } + return classC; +}()); +exports.classC = classC; + + +//// [/src/project/src/directUse.d.ts] +export {}; + + +//// [/src/project/src/directUse.js] +"use strict"; +exports.__esModule = true; +var indirectClass_1 = require("./indirectClass"); +new indirectClass_1.indirectClass().classC.prop; + + +//// [/src/project/src/indirectClass.d.ts] +import { classC } from './class'; +export declare class indirectClass { + classC: classC; +} + + +//// [/src/project/src/indirectClass.js] +"use strict"; +exports.__esModule = true; +exports.indirectClass = void 0; +var class_1 = require("./class"); +var indirectClass = /** @class */ (function () { + function indirectClass() { + this.classC = new class_1.classC(); + } + return indirectClass; +}()); +exports.indirectClass = indirectClass; + + +//// [/src/project/src/indirectUse.d.ts] +export {}; + + +//// [/src/project/src/indirectUse.js] +"use strict"; +exports.__esModule = true; +var indirectClass_1 = require("./indirectClass"); +new indirectClass_1.indirectClass().classC.prop; + + +//// [/src/project/src/noChangeFile.d.ts] +export declare function writeLog(s: string): void; + + +//// [/src/project/src/noChangeFile.js] +"use strict"; +exports.__esModule = true; +exports.writeLog = void 0; +function writeLog(s) { +} +exports.writeLog = writeLog; + + +//// [/src/project/src/noChangeFileWithEmitSpecificError.d.ts] +declare function someFunc(arguments: boolean, ...rest: any[]): void; + + +//// [/src/project/src/noChangeFileWithEmitSpecificError.js] +function someFunc(arguments) { + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } +} + + +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396 + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: Introduce error with emit +Input:: +//// [/src/project/src/class.ts] +export class classC { + prop1 = 1; +} + + + +Output:: +/lib/tsc --p src/project +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 3 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/class.d.ts] +export declare class classC { + prop1: number; +} + + +//// [/src/project/src/class.js] +"use strict"; +exports.__esModule = true; +exports.classC = void 0; +var classC = /** @class */ (function () { + function classC() { + this.prop1 = 1; + } + return classC; +}()); +exports.classC = classC; + + +//// [/src/project/src/directUse.d.ts] file written with same contents +//// [/src/project/src/indirectClass.d.ts] file written with same contents +//// [/src/project/src/indirectClass.js] file written with same contents +//// [/src/project/src/indirectUse.d.ts] file written with same contents +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "1786859709-export class classC {\n prop1 = 1;\n}", + "signature": "-3790894605-export declare class classC {\r\n prop1: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + [ + "./src/directuse.ts", + [ + { + "file": "./src/directuse.ts", + "start": 76, + "length": 4, + "code": 2551, + "category": 1, + "messageText": "Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'?", + "relatedInformation": [ + { + "file": "./src/class.ts", + "start": 26, + "length": 5, + "messageText": "'prop1' is declared here.", + "category": 3, + "code": 2728 + } + ] + } + ] + ], + "./src/indirectclass.ts", + [ + "./src/indirectuse.ts", + [ + { + "file": "./src/indirectuse.ts", + "start": 76, + "length": 4, + "code": 2551, + "category": 1, + "messageText": "Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'?", + "relatedInformation": [ + { + "file": "./src/class.ts", + "start": 26, + "length": 5, + "messageText": "'prop1' is declared here.", + "category": 3, + "code": 2728 + } + ] + } + ] + ], + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396 + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: Fix error and no emit +Input:: +//// [/src/project/src/class.ts] +export class classC { + prop = 1; +} + + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. + +1 {"compilerOptions":{"composite":true}} +   ~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/class.d.ts] +export declare class classC { + prop: number; +} + + +//// [/src/project/src/class.js] +"use strict"; +exports.__esModule = true; +exports.classC = void 0; +var classC = /** @class */ (function () { + function classC() { + this.prop = 1; + } + return classC; +}()); +exports.classC = classC; + + +//// [/src/project/src/directUse.d.ts] file written with same contents +//// [/src/project/src/indirectClass.d.ts] file written with same contents +//// [/src/project/src/indirectClass.js] file written with same contents +//// [/src/project/src/indirectUse.d.ts] file written with same contents +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396 + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-incremental-declaration.js b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-incremental-declaration.js new file mode 100644 index 0000000000000..9dbfef53d8374 --- /dev/null +++ b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-incremental-declaration.js @@ -0,0 +1,606 @@ +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/class.ts] +export class classC { + prop = 1; +} + +//// [/src/project/src/directUse.ts] +import { indirectClass } from './indirectClass'; +new indirectClass().classC.prop; + +//// [/src/project/src/indirectClass.ts] +import { classC } from './class'; +export class indirectClass { + classC = new classC(); +} + +//// [/src/project/src/indirectUse.ts] +import { indirectClass } from './indirectClass'; +new indirectClass().classC.prop; + +//// [/src/project/src/noChangeFile.ts] +export function writeLog(s: string) { +} + +//// [/src/project/src/noChangeFileWithEmitSpecificError.ts] +function someFunc(arguments: boolean, ...rest: any[]) { +} + +//// [/src/project/tsconfig.json] +{"compilerOptions":{"incremental":true,"declaration":true}} + + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true,"declaration":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/class.d.ts] +export declare class classC { + prop: number; +} + + +//// [/src/project/src/class.js] +"use strict"; +exports.__esModule = true; +exports.classC = void 0; +var classC = /** @class */ (function () { + function classC() { + this.prop = 1; + } + return classC; +}()); +exports.classC = classC; + + +//// [/src/project/src/directUse.d.ts] +export {}; + + +//// [/src/project/src/directUse.js] +"use strict"; +exports.__esModule = true; +var indirectClass_1 = require("./indirectClass"); +new indirectClass_1.indirectClass().classC.prop; + + +//// [/src/project/src/indirectClass.d.ts] +import { classC } from './class'; +export declare class indirectClass { + classC: classC; +} + + +//// [/src/project/src/indirectClass.js] +"use strict"; +exports.__esModule = true; +exports.indirectClass = void 0; +var class_1 = require("./class"); +var indirectClass = /** @class */ (function () { + function indirectClass() { + this.classC = new class_1.classC(); + } + return indirectClass; +}()); +exports.indirectClass = indirectClass; + + +//// [/src/project/src/indirectUse.d.ts] +export {}; + + +//// [/src/project/src/indirectUse.js] +"use strict"; +exports.__esModule = true; +var indirectClass_1 = require("./indirectClass"); +new indirectClass_1.indirectClass().classC.prop; + + +//// [/src/project/src/noChangeFile.d.ts] +export declare function writeLog(s: string): void; + + +//// [/src/project/src/noChangeFile.js] +"use strict"; +exports.__esModule = true; +exports.writeLog = void 0; +function writeLog(s) { +} +exports.writeLog = writeLog; + + +//// [/src/project/src/noChangeFileWithEmitSpecificError.d.ts] +declare function someFunc(arguments: boolean, ...rest: any[]): void; + + +//// [/src/project/src/noChangeFileWithEmitSpecificError.js] +function someFunc(arguments) { + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } +} + + +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "declaration": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396 + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: Introduce error with emit +Input:: +//// [/src/project/src/class.ts] +export class classC { + prop1 = 1; +} + + + +Output:: +/lib/tsc --p src/project +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 3 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/class.d.ts] +export declare class classC { + prop1: number; +} + + +//// [/src/project/src/class.js] +"use strict"; +exports.__esModule = true; +exports.classC = void 0; +var classC = /** @class */ (function () { + function classC() { + this.prop1 = 1; + } + return classC; +}()); +exports.classC = classC; + + +//// [/src/project/src/directUse.d.ts] file written with same contents +//// [/src/project/src/indirectClass.d.ts] file written with same contents +//// [/src/project/src/indirectClass.js] file written with same contents +//// [/src/project/src/indirectUse.d.ts] file written with same contents +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "1786859709-export class classC {\n prop1 = 1;\n}", + "signature": "-3790894605-export declare class classC {\r\n prop1: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "declaration": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + [ + "./src/directuse.ts", + [ + { + "file": "./src/directuse.ts", + "start": 76, + "length": 4, + "code": 2551, + "category": 1, + "messageText": "Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'?", + "relatedInformation": [ + { + "file": "./src/class.ts", + "start": 26, + "length": 5, + "messageText": "'prop1' is declared here.", + "category": 3, + "code": 2728 + } + ] + } + ] + ], + "./src/indirectclass.ts", + [ + "./src/indirectuse.ts", + [ + { + "file": "./src/indirectuse.ts", + "start": 76, + "length": 4, + "code": 2551, + "category": 1, + "messageText": "Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'?", + "relatedInformation": [ + { + "file": "./src/class.ts", + "start": 26, + "length": 5, + "messageText": "'prop1' is declared here.", + "category": 3, + "code": 2728 + } + ] + } + ] + ], + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396 + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: Fix error and no emit +Input:: +//// [/src/project/src/class.ts] +export class classC { + prop = 1; +} + + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true,"declaration":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/class.d.ts] +export declare class classC { + prop: number; +} + + +//// [/src/project/src/class.js] +"use strict"; +exports.__esModule = true; +exports.classC = void 0; +var classC = /** @class */ (function () { + function classC() { + this.prop = 1; + } + return classC; +}()); +exports.classC = classC; + + +//// [/src/project/src/directUse.d.ts] file written with same contents +//// [/src/project/src/indirectClass.d.ts] file written with same contents +//// [/src/project/src/indirectClass.js] file written with same contents +//// [/src/project/src/indirectUse.d.ts] file written with same contents +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "declaration": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396 + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + diff --git a/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-incremental.js b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-incremental.js new file mode 100644 index 0000000000000..0cac48cd710b4 --- /dev/null +++ b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-incremental.js @@ -0,0 +1,556 @@ +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/class.ts] +export class classC { + prop = 1; +} + +//// [/src/project/src/directUse.ts] +import { indirectClass } from './indirectClass'; +new indirectClass().classC.prop; + +//// [/src/project/src/indirectClass.ts] +import { classC } from './class'; +export class indirectClass { + classC = new classC(); +} + +//// [/src/project/src/indirectUse.ts] +import { indirectClass } from './indirectClass'; +new indirectClass().classC.prop; + +//// [/src/project/src/noChangeFile.ts] +export function writeLog(s: string) { +} + +//// [/src/project/src/noChangeFileWithEmitSpecificError.ts] +function someFunc(arguments: boolean, ...rest: any[]) { +} + +//// [/src/project/tsconfig.json] +{"compilerOptions":{"incremental":true}} + + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/class.js] +"use strict"; +exports.__esModule = true; +exports.classC = void 0; +var classC = /** @class */ (function () { + function classC() { + this.prop = 1; + } + return classC; +}()); +exports.classC = classC; + + +//// [/src/project/src/directUse.js] +"use strict"; +exports.__esModule = true; +var indirectClass_1 = require("./indirectClass"); +new indirectClass_1.indirectClass().classC.prop; + + +//// [/src/project/src/indirectClass.js] +"use strict"; +exports.__esModule = true; +exports.indirectClass = void 0; +var class_1 = require("./class"); +var indirectClass = /** @class */ (function () { + function indirectClass() { + this.classC = new class_1.classC(); + } + return indirectClass; +}()); +exports.indirectClass = indirectClass; + + +//// [/src/project/src/indirectUse.js] +"use strict"; +exports.__esModule = true; +var indirectClass_1 = require("./indirectClass"); +new indirectClass_1.indirectClass().classC.prop; + + +//// [/src/project/src/noChangeFile.js] +"use strict"; +exports.__esModule = true; +exports.writeLog = void 0; +function writeLog(s) { +} +exports.writeLog = writeLog; + + +//// [/src/project/src/noChangeFileWithEmitSpecificError.js] +function someFunc(arguments) { + var rest = []; + for (var _i = 1; _i < arguments.length; _i++) { + rest[_i - 1] = arguments[_i]; + } +} + + +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396 + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: Introduce error with emit +Input:: +//// [/src/project/src/class.ts] +export class classC { + prop1 = 1; +} + + + +Output:: +/lib/tsc --p src/project +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 3 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/class.js] +"use strict"; +exports.__esModule = true; +exports.classC = void 0; +var classC = /** @class */ (function () { + function classC() { + this.prop1 = 1; + } + return classC; +}()); +exports.classC = classC; + + +//// [/src/project/src/indirectClass.js] file written with same contents +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "1786859709-export class classC {\n prop1 = 1;\n}", + "signature": "-3790894605-export declare class classC {\r\n prop1: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + [ + "./src/directuse.ts", + [ + { + "file": "./src/directuse.ts", + "start": 76, + "length": 4, + "code": 2551, + "category": 1, + "messageText": "Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'?", + "relatedInformation": [ + { + "file": "./src/class.ts", + "start": 26, + "length": 5, + "messageText": "'prop1' is declared here.", + "category": 3, + "code": 2728 + } + ] + } + ] + ], + "./src/indirectclass.ts", + [ + "./src/indirectuse.ts", + [ + { + "file": "./src/indirectuse.ts", + "start": 76, + "length": 4, + "code": 2551, + "category": 1, + "messageText": "Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'?", + "relatedInformation": [ + { + "file": "./src/class.ts", + "start": 26, + "length": 5, + "messageText": "'prop1' is declared here.", + "category": 3, + "code": 2728 + } + ] + } + ] + ], + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396 + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + + + +Change:: Fix error and no emit +Input:: +//// [/src/project/src/class.ts] +export class classC { + prop = 1; +} + + + +Output:: +/lib/tsc --p src/project --noEmit +src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. + +1 {"compilerOptions":{"incremental":true}} +   ~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped + + + + +Change:: No Change run with emit +Input:: + + +Output:: +/lib/tsc --p src/project +src/project/src/noChangeFileWithEmitSpecificError.ts:1:19 - error TS2396: Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters. + +1 function someFunc(arguments: boolean, ...rest: any[]) { +   ~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/src/class.js] +"use strict"; +exports.__esModule = true; +exports.classC = void 0; +var classC = /** @class */ (function () { + function classC() { + this.prop = 1; + } + return classC; +}()); +exports.classC = classC; + + +//// [/src/project/src/indirectClass.js] file written with same contents +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396 + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + From e18dd33e4db39378a55dc17da5d0cfdf9a3ca1cb Mon Sep 17 00:00:00 2001 From: Sheetal Nandi Date: Tue, 16 Jun 2020 11:49:30 -0700 Subject: [PATCH 2/2] Allow noEmit with incremental and composite Fixes #38440 --- src/compiler/builder.ts | 7 +- src/compiler/checker.ts | 35 +- src/compiler/commandLineParser.ts | 1 - src/compiler/diagnosticMessages.json | 4 + src/compiler/emitter.ts | 2 +- src/compiler/program.ts | 26 +- src/compiler/types.ts | 1 + src/testRunner/unittests/tsbuild/helpers.ts | 22 +- .../unittests/tsc/projectReferences.ts | 21 + .../unittests/tscWatch/incremental.ts | 3 +- .../reference/noEmitAndComposite.errors.txt | 19 - .../reference/noEmitAndIncremental.errors.txt | 20 - .../initial-build/noEmit-changes-composite.js | 499 ++++++++++++++--- .../noEmit-changes-incremental-declaration.js | 502 +++++++++++++++--- .../noEmit-changes-incremental.js | 479 ++++++++++++++--- ...t-changes-with-initial-noEmit-composite.js | 249 ++++++++- ...-initial-noEmit-incremental-declaration.js | 251 ++++++++- ...changes-with-initial-noEmit-incremental.js | 241 ++++++++- ...eferences-composite-project-with-noEmit.js | 48 ++ 19 files changed, 2058 insertions(+), 372 deletions(-) delete mode 100644 tests/baselines/reference/noEmitAndComposite.errors.txt delete mode 100644 tests/baselines/reference/noEmitAndIncremental.errors.txt create mode 100644 tests/baselines/reference/tsc/projectReferences/initial-build/when-project-references-composite-project-with-noEmit.js diff --git a/src/compiler/builder.ts b/src/compiler/builder.ts index 5f3bc171bb525..44bf1fbea623c 100644 --- a/src/compiler/builder.ts +++ b/src/compiler/builder.ts @@ -5,6 +5,7 @@ namespace ts { reportsUnnecessary?: {}; source?: string; relatedInformation?: ReusableDiagnosticRelatedInformation[]; + skippedOn?: keyof CompilerOptions; } export interface ReusableDiagnosticRelatedInformation { @@ -268,6 +269,7 @@ namespace ts { const result: Diagnostic = convertToDiagnosticRelatedInformation(diagnostic, newProgram, toPath); result.reportsUnnecessary = diagnostic.reportsUnnecessary; result.source = diagnostic.source; + result.skippedOn = diagnostic.skippedOn; const { relatedInformation } = diagnostic; result.relatedInformation = relatedInformation ? relatedInformation.length ? @@ -676,7 +678,7 @@ namespace ts { const cachedDiagnostics = state.semanticDiagnosticsPerFile.get(path); // Report the bind and check diagnostics from the cache if we already have those diagnostics present if (cachedDiagnostics) { - return cachedDiagnostics; + return filterSemanticDiagnotics(cachedDiagnostics, state.compilerOptions); } } @@ -685,7 +687,7 @@ namespace ts { if (state.semanticDiagnosticsPerFile) { state.semanticDiagnosticsPerFile.set(path, diagnostics); } - return diagnostics; + return filterSemanticDiagnotics(diagnostics, state.compilerOptions); } export type ProgramBuildInfoDiagnostic = string | [string, readonly ReusableDiagnostic[]]; @@ -816,6 +818,7 @@ namespace ts { const result: ReusableDiagnostic = convertToReusableDiagnosticRelatedInformation(diagnostic, relativeToBuildInfo); result.reportsUnnecessary = diagnostic.reportsUnnecessary; result.source = diagnostic.source; + result.skippedOn = diagnostic.skippedOn; const { relatedInformation } = diagnostic; result.relatedInformation = relatedInformation ? relatedInformation.length ? diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 93b2834178eec..7988383da3d19 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -1013,6 +1013,12 @@ namespace ts { } } + function errorSkippedOn(key: keyof CompilerOptions, location: Node | undefined, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): Diagnostic { + const diagnostic = error(location, message, arg0, arg1, arg2, arg3); + diagnostic.skippedOn = key; + return diagnostic; + } + function error(location: Node | undefined, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): Diagnostic { const diagnostic = location ? createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) @@ -32030,13 +32036,13 @@ namespace ts { function checkCollisionWithArgumentsInGeneratedCode(node: SignatureDeclaration) { // no rest parameters \ declaration context \ overload - no codegen impact - if (languageVersion >= ScriptTarget.ES2015 || compilerOptions.noEmit || !hasRestParameter(node) || node.flags & NodeFlags.Ambient || nodeIsMissing((node).body)) { + if (languageVersion >= ScriptTarget.ES2015 || !hasRestParameter(node) || node.flags & NodeFlags.Ambient || nodeIsMissing((node).body)) { return; } forEach(node.parameters, p => { if (p.name && !isBindingPattern(p.name) && p.name.escapedText === argumentsSymbol.escapedName) { - error(p, Diagnostics.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters); + errorSkippedOn("noEmit", p, Diagnostics.Duplicate_identifier_arguments_Compiler_uses_arguments_to_initialize_rest_parameters); } }); } @@ -32106,13 +32112,13 @@ namespace ts { function checkWeakMapCollision(node: Node) { const enclosingBlockScope = getEnclosingBlockScopeContainer(node); if (getNodeCheckFlags(enclosingBlockScope) & NodeCheckFlags.ContainsClassWithPrivateIdentifiers) { - error(node, Diagnostics.Compiler_reserves_name_0_when_emitting_private_identifier_downlevel, "WeakMap"); + errorSkippedOn("noEmit", node, Diagnostics.Compiler_reserves_name_0_when_emitting_private_identifier_downlevel, "WeakMap"); } } function checkCollisionWithRequireExportsInGeneratedCode(node: Node, name: Identifier) { // No need to check for require or exports for ES6 modules and later - if (moduleKind >= ModuleKind.ES2015 || compilerOptions.noEmit) { + if (moduleKind >= ModuleKind.ES2015) { return; } @@ -32129,13 +32135,13 @@ namespace ts { const parent = getDeclarationContainer(node); if (parent.kind === SyntaxKind.SourceFile && isExternalOrCommonJsModule(parent)) { // If the declaration happens to be in external module, report error that require and exports are reserved keywords - error(name, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, + errorSkippedOn("noEmit", name, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, declarationNameToString(name), declarationNameToString(name)); } } function checkCollisionWithGlobalPromiseInGeneratedCode(node: Node, name: Identifier): void { - if (languageVersion >= ScriptTarget.ES2017 || compilerOptions.noEmit || !needCollisionCheckForIdentifier(node, name, "Promise")) { + if (languageVersion >= ScriptTarget.ES2017 || !needCollisionCheckForIdentifier(node, name, "Promise")) { return; } @@ -32148,7 +32154,7 @@ namespace ts { const parent = getDeclarationContainer(node); if (parent.kind === SyntaxKind.SourceFile && isExternalOrCommonJsModule(parent) && parent.flags & NodeFlags.HasAsyncFunctions) { // If the declaration happens to be in external module, report error that Promise is a reserved identifier. - error(name, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, + errorSkippedOn("noEmit", name, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, declarationNameToString(name), declarationNameToString(name)); } } @@ -32366,7 +32372,7 @@ namespace ts { } checkCollisionWithRequireExportsInGeneratedCode(node, node.name); checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name); - if (!compilerOptions.noEmit && languageVersion < ScriptTarget.ESNext && needCollisionCheckForIdentifier(node, node.name, "WeakMap")) { + if (languageVersion < ScriptTarget.ESNext && needCollisionCheckForIdentifier(node, node.name, "WeakMap")) { potentialWeakMapCollisions.push(node); } } @@ -38267,7 +38273,7 @@ namespace ts { const moduleKind = getEmitModuleKind(compilerOptions); - if (moduleKind < ModuleKind.ES2015 && moduleKind !== ModuleKind.System && !compilerOptions.noEmit && + if (moduleKind < ModuleKind.ES2015 && moduleKind !== ModuleKind.System && !(node.parent.parent.flags & NodeFlags.Ambient) && hasSyntacticModifier(node.parent.parent, ModifierFlags.Export)) { checkESModuleMarker(node.name); } @@ -38287,7 +38293,7 @@ namespace ts { function checkESModuleMarker(name: Identifier | BindingPattern): boolean { if (name.kind === SyntaxKind.Identifier) { if (idText(name) === "__esModule") { - return grammarErrorOnNode(name, Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules); + return grammarErrorOnNodeSkippedOn("noEmit", name, Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules); } } else { @@ -38397,6 +38403,15 @@ namespace ts { return false; } + function grammarErrorOnNodeSkippedOn(key: keyof CompilerOptions, node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean { + const sourceFile = getSourceFileOfNode(node); + if (!hasParseDiagnostics(sourceFile)) { + errorSkippedOn(key, node, message, arg0, arg1, arg2); + return true; + } + return false; + } + function grammarErrorOnNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean { const sourceFile = getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { diff --git a/src/compiler/commandLineParser.ts b/src/compiler/commandLineParser.ts index f217bae5c1006..e93b9741d45bc 100644 --- a/src/compiler/commandLineParser.ts +++ b/src/compiler/commandLineParser.ts @@ -462,7 +462,6 @@ namespace ts { { name: "noEmit", type: "boolean", - affectsEmit: true, showInSimplifiedHelpView: true, category: Diagnostics.Basic_Options, description: Diagnostics.Do_not_emit_outputs, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index e863de12537d6..d49603f368685 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -4458,6 +4458,10 @@ "category": "Error", "code": 6309 }, + "Referenced project '{0}' may not disable emit.": { + "category": "Error", + "code": 6310 + }, "Project '{0}' is out of date because oldest output '{1}' is older than newest input '{2}'": { "category": "Message", "code": 6350 diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index afbcb53f81612..aa520167afb8e 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -333,7 +333,7 @@ namespace ts { // Write build information if applicable if (!buildInfoPath || targetSourceFile || emitSkipped) return; const program = host.getProgramBuildInfo(); - if (host.isEmitBlocked(buildInfoPath) || compilerOptions.noEmit) { + if (host.isEmitBlocked(buildInfoPath)) { emitSkipped = true; return; } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 8cd92ddd285cd..64867d2038652 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -1719,7 +1719,7 @@ namespace ts { function getSemanticDiagnosticsForFile(sourceFile: SourceFile, cancellationToken: CancellationToken | undefined): readonly Diagnostic[] { return concatenate( - getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken), + filterSemanticDiagnotics(getBindAndCheckDiagnosticsForFile(sourceFile, cancellationToken), options), getProgramDiagnostics(sourceFile) ); } @@ -3011,10 +3011,6 @@ namespace ts { programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified)); } - if (!options.listFilesOnly && options.noEmit && isIncrementalCompilation(options)) { - createDiagnosticForOptionName(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", options.incremental ? "incremental" : "composite"); - } - verifyProjectReferences(); // List of collected files is complete; validate exhautiveness if this is a project with a file list @@ -3269,7 +3265,7 @@ namespace ts { } function verifyProjectReferences() { - const buildInfoPath = !options.noEmit && !options.suppressOutputPathCheck ? getTsBuildInfoEmitOutputFilePath(options) : undefined; + const buildInfoPath = !options.suppressOutputPathCheck ? getTsBuildInfoEmitOutputFilePath(options) : undefined; forEachProjectReference(projectReferences, resolvedProjectReferences, (resolvedRef, index, parent) => { const ref = (parent ? parent.commandLine.projectReferences : projectReferences)![index]; const parentFile = parent && parent.sourceFile as JsonSourceFile; @@ -3278,11 +3274,12 @@ namespace ts { return; } const options = resolvedRef.commandLine.options; - if (!options.composite) { + if (!options.composite || options.noEmit) { // ok to not have composite if the current program is container only const inputs = parent ? parent.commandLine.fileNames : rootNames; if (inputs.length) { - createDiagnosticForReference(parentFile, index, Diagnostics.Referenced_project_0_must_have_setting_composite_Colon_true, ref.path); + if (!options.composite) createDiagnosticForReference(parentFile, index, Diagnostics.Referenced_project_0_must_have_setting_composite_Colon_true, ref.path); + if (options.noEmit) createDiagnosticForReference(parentFile, index, Diagnostics.Referenced_project_0_may_not_disable_emit, ref.path); } } if (ref.prepend) { @@ -3648,7 +3645,13 @@ namespace ts { cancellationToken: CancellationToken | undefined ): EmitResult | undefined { const options = program.getCompilerOptions(); - if (options.noEmit) return emitSkippedWithNoDiagnostics; + if (options.noEmit) { + // Cache the semantic diagnostics + program.getSemanticDiagnostics(sourceFile, cancellationToken); + return sourceFile || outFile(options) ? + emitSkippedWithNoDiagnostics : + program.emitBuildInfo(writeFile, cancellationToken); + } // If the noEmitOnError flag is set, then check if we have any errors so far. If so, // immediately bail out. Note that we pass 'undefined' for 'sourceFile' so that we @@ -3675,6 +3678,11 @@ namespace ts { return { diagnostics, sourceMaps: undefined, emittedFiles, emitSkipped: true }; } + /*@internal*/ + export function filterSemanticDiagnotics(diagnostic: readonly Diagnostic[], option: CompilerOptions): readonly Diagnostic[] { + return filter(diagnostic, d => !d.skippedOn || !option[d.skippedOn]); + } + /*@internal*/ interface CompilerHostLike { useCaseSensitiveFileNames(): boolean; diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 5c4e6f0c1592b..30efd1c68f970 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -5522,6 +5522,7 @@ namespace ts { reportsUnnecessary?: {}; source?: string; relatedInformation?: DiagnosticRelatedInformation[]; + /* @internal */ skippedOn?: keyof CompilerOptions; } export interface DiagnosticRelatedInformation { diff --git a/src/testRunner/unittests/tsbuild/helpers.ts b/src/testRunner/unittests/tsbuild/helpers.ts index 4f4fe6e4702f1..2fcca3613d1ed 100644 --- a/src/testRunner/unittests/tsbuild/helpers.ts +++ b/src/testRunner/unittests/tsbuild/helpers.ts @@ -296,9 +296,9 @@ interface Symbol { } else if (actualText !== expectedText) { // Verify build info without affectedFilesPendingEmit - const { text: actualBuildInfoText, affectedFilesPendingEmit: actualAffectedFilesPendingEmit } = getBuildInfoWithoutAffectedFilesPendingEmit(actualText); - const { text: expectedBuildInfoText, affectedFilesPendingEmit: expectedAffectedFilesPendingEmit } = getBuildInfoWithoutAffectedFilesPendingEmit(expectedText); - assert.equal(actualBuildInfoText, expectedBuildInfoText, `TsBuild info text without affectedFilesPendingEmit: ${outputFile}::\nIncremental buildInfoText:: ${actualText}\nClean buildInfoText:: ${expectedText}`); + const { buildInfo: actualBuildInfo, affectedFilesPendingEmit: actualAffectedFilesPendingEmit } = getBuildInfoForIncrementalCorrectnessCheck(actualText); + const { buildInfo: expectedBuildInfo, affectedFilesPendingEmit: expectedAffectedFilesPendingEmit } = getBuildInfoForIncrementalCorrectnessCheck(expectedText); + assert.deepEqual(actualBuildInfo, expectedBuildInfo, `TsBuild info text without affectedFilesPendingEmit: ${outputFile}::\nIncremental buildInfoText:: ${actualText}\nClean buildInfoText:: ${expectedText}`); // Verify that incrementally pending affected file emit are in clean build since clean build can contain more files compared to incremental depending of noEmitOnError option if (actualAffectedFilesPendingEmit) { assert.isDefined(expectedAffectedFilesPendingEmit, `Incremental build contains affectedFilesPendingEmit, clean build should also have it: ${outputFile}::\nIncremental buildInfoText:: ${actualText}\nClean buildInfoText:: ${expectedText}`); @@ -314,15 +314,19 @@ interface Symbol { }); } - function getBuildInfoWithoutAffectedFilesPendingEmit(text: string | undefined): { text: string | undefined; affectedFilesPendingEmit?: ProgramBuildInfo["affectedFilesPendingEmit"]; } { + function getBuildInfoForIncrementalCorrectnessCheck(text: string | undefined): { buildInfo: BuildInfo | undefined; affectedFilesPendingEmit?: ProgramBuildInfo["affectedFilesPendingEmit"]; } { const buildInfo = text ? getBuildInfo(text) : undefined; - if (!buildInfo?.program?.affectedFilesPendingEmit) return { text }; - const { program: { affectedFilesPendingEmit, ...programRest }, ...rest } = buildInfo; + if (!buildInfo?.program) return { buildInfo }; + // Ignore noEmit since that shouldnt be reason to emit the tsbuild info and presence of it in the buildinfo file does not matter + const { program: { affectedFilesPendingEmit, options: { noEmit, ...optionsRest}, ...programRest }, ...rest } = buildInfo; return { - text: getBuildInfoText({ + buildInfo: { ...rest, - program: programRest - }), + program: { + options: optionsRest, + ...programRest + } + }, affectedFilesPendingEmit }; } diff --git a/src/testRunner/unittests/tsc/projectReferences.ts b/src/testRunner/unittests/tsc/projectReferences.ts index 06e68018dd6ce..765bdfdb53cf1 100644 --- a/src/testRunner/unittests/tsc/projectReferences.ts +++ b/src/testRunner/unittests/tsc/projectReferences.ts @@ -17,5 +17,26 @@ namespace ts { }), commandLineArgs: ["--p", "src/project"], }); + + verifyTsc({ + scenario: "projectReferences", + subScenario: "when project references composite project with noEmit", + fs: () => loadProjectFromFiles({ + "/src/utils/index.ts": "export const x = 10;", + "/src/utils/tsconfig.json": JSON.stringify({ + compilerOptions: { + composite: true, + noEmit: true, + } + }), + "/src/project/index.ts": `import { x } from "../utils";`, + "/src/project/tsconfig.json": JSON.stringify({ + references: [ + { path: "../utils" } + ] + }), + }), + commandLineArgs: ["--p", "src/project"] + }); }); } diff --git a/src/testRunner/unittests/tscWatch/incremental.ts b/src/testRunner/unittests/tscWatch/incremental.ts index d8a61636e141b..b8bc2d33eb260 100644 --- a/src/testRunner/unittests/tscWatch/incremental.ts +++ b/src/testRunner/unittests/tscWatch/incremental.ts @@ -194,7 +194,8 @@ namespace ts.tscWatch { messageText: "Type 'number' is not assignable to type 'string'.", relatedInformation: undefined, reportsUnnecessary: undefined, - source: undefined + source: undefined, + skippedOn: undefined, }]); }); }); diff --git a/tests/baselines/reference/noEmitAndComposite.errors.txt b/tests/baselines/reference/noEmitAndComposite.errors.txt deleted file mode 100644 index fe6de6ae441ac..0000000000000 --- a/tests/baselines/reference/noEmitAndComposite.errors.txt +++ /dev/null @@ -1,19 +0,0 @@ -/tsconfig.json(3,9): error TS5053: Option 'noEmit' cannot be specified with option 'composite'. -/tsconfig.json(4,9): error TS5053: Option 'noEmit' cannot be specified with option 'composite'. - - -==== /tsconfig.json (2 errors) ==== - { - "compilerOptions": { - "noEmit": true, - ~~~~~~~~ -!!! error TS5053: Option 'noEmit' cannot be specified with option 'composite'. - "composite": true - ~~~~~~~~~~~ -!!! error TS5053: Option 'noEmit' cannot be specified with option 'composite'. - } - } - -==== /a.ts (0 errors) ==== - const x = 10; - \ No newline at end of file diff --git a/tests/baselines/reference/noEmitAndIncremental.errors.txt b/tests/baselines/reference/noEmitAndIncremental.errors.txt deleted file mode 100644 index c257e9ba5402f..0000000000000 --- a/tests/baselines/reference/noEmitAndIncremental.errors.txt +++ /dev/null @@ -1,20 +0,0 @@ -/tsconfig.json(3,9): error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. -/tsconfig.json(4,9): error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - - -==== /tsconfig.json (2 errors) ==== - { - "compilerOptions": { - "noEmit": true, - ~~~~~~~~ -!!! error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - "incremental": true - ~~~~~~~~~~~~~ -!!! error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - } - } - - -==== /a.ts (0 errors) ==== - const x = 10; - \ No newline at end of file diff --git a/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-composite.js b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-composite.js index 98e0de00dff85..b9393ff3f07b6 100644 --- a/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-composite.js +++ b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-composite.js @@ -224,7 +224,8 @@ function someFunc(arguments) { "length": 18, "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", "category": 1, - "code": 2396 + "code": 2396, + "skippedOn": "noEmit" } ] ] @@ -241,15 +242,7 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. - -1 {"compilerOptions":{"composite":true}} -   ~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success @@ -260,15 +253,7 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. - -1 {"compilerOptions":{"composite":true}} -   ~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success @@ -284,17 +269,182 @@ export class classC { Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? -1 {"compilerOptions":{"composite":true}} -   ~~~~~~~~~~~ +2 new indirectClass().classC.prop; +   ~~~~ + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. -Found 1 error. +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + + +Found 2 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "1786859709-export class classC {\n prop1 = 1;\n}", + "signature": "-3790894605-export declare class classC {\r\n prop1: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "project": "./", + "noEmit": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + [ + "./src/directuse.ts", + [ + { + "file": "./src/directuse.ts", + "start": 76, + "length": 4, + "code": 2551, + "category": 1, + "messageText": "Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'?", + "relatedInformation": [ + { + "file": "./src/class.ts", + "start": 26, + "length": 5, + "messageText": "'prop1' is declared here.", + "category": 3, + "code": 2728 + } + ] + } + ] + ], + "./src/indirectclass.ts", + [ + "./src/indirectuse.ts", + [ + { + "file": "./src/indirectuse.ts", + "start": 76, + "length": 4, + "code": 2551, + "category": 1, + "messageText": "Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'?", + "relatedInformation": [ + { + "file": "./src/class.ts", + "start": 26, + "length": 5, + "messageText": "'prop1' is declared here.", + "category": 3, + "code": 2728 + } + ] + } + ] + ], + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396, + "skippedOn": "noEmit" + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./src/class.ts", + 1 + ], + [ + "./src/directuse.ts", + 0 + ], + [ + "./src/indirectclass.ts", + 1 + ], + [ + "./src/indirectuse.ts", + 0 + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: Fix error and emit @@ -319,6 +469,99 @@ Found 1 error. exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated +//// [/src/project/src/class.d.ts] file written with same contents +//// [/src/project/src/class.js] file written with same contents +//// [/src/project/src/directUse.d.ts] file written with same contents +//// [/src/project/src/indirectClass.d.ts] file written with same contents +//// [/src/project/src/indirectClass.js] file written with same contents +//// [/src/project/src/indirectUse.d.ts] file written with same contents +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396, + "skippedOn": "noEmit" + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: No Change run with emit @@ -346,15 +589,7 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. - -1 {"compilerOptions":{"composite":true}} -   ~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success @@ -365,15 +600,7 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. - -1 {"compilerOptions":{"composite":true}} -   ~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success @@ -583,7 +810,8 @@ exports.classC = classC; "length": 18, "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", "category": 1, - "code": 2396 + "code": 2396, + "skippedOn": "noEmit" } ] ] @@ -639,13 +867,28 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? -1 {"compilerOptions":{"composite":true}} -   ~~~~~~~~~~~ +2 new indirectClass().classC.prop; +   ~~~~ + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. -Found 1 error. +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + + +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped @@ -658,13 +901,28 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? -1 {"compilerOptions":{"composite":true}} -   ~~~~~~~~~~~ +2 new indirectClass().classC.prop; +   ~~~~ + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. -Found 1 error. +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + + +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped @@ -721,17 +979,115 @@ export class classC { Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. - -1 {"compilerOptions":{"composite":true}} -   ~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "project": "./", + "noEmit": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396, + "skippedOn": "noEmit" + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./src/class.ts", + 1 + ], + [ + "./src/directuse.ts", + 0 + ], + [ + "./src/indirectclass.ts", + 1 + ], + [ + "./src/indirectuse.ts", + 0 + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: No Change run with emit @@ -851,7 +1207,8 @@ exports.classC = classC; "length": 18, "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", "category": 1, - "code": 2396 + "code": 2396, + "skippedOn": "noEmit" } ] ] @@ -868,15 +1225,7 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. - -1 {"compilerOptions":{"composite":true}} -   ~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success @@ -887,15 +1236,7 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. - -1 {"compilerOptions":{"composite":true}} -   ~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success diff --git a/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-incremental-declaration.js b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-incremental-declaration.js index 12c232adeb038..557af80a87bf8 100644 --- a/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-incremental-declaration.js +++ b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-incremental-declaration.js @@ -225,7 +225,8 @@ function someFunc(arguments) { "length": 18, "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", "category": 1, - "code": 2396 + "code": 2396, + "skippedOn": "noEmit" } ] ] @@ -242,15 +243,7 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - -1 {"compilerOptions":{"incremental":true,"declaration":true}} -   ~~~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success @@ -261,15 +254,7 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - -1 {"compilerOptions":{"incremental":true,"declaration":true}} -   ~~~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success @@ -285,17 +270,183 @@ export class classC { Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? -1 {"compilerOptions":{"incremental":true,"declaration":true}} -   ~~~~~~~~~~~~~ +2 new indirectClass().classC.prop; +   ~~~~ + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. -Found 1 error. +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + + +Found 2 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "1786859709-export class classC {\n prop1 = 1;\n}", + "signature": "-3790894605-export declare class classC {\r\n prop1: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "declaration": true, + "project": "./", + "noEmit": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + [ + "./src/directuse.ts", + [ + { + "file": "./src/directuse.ts", + "start": 76, + "length": 4, + "code": 2551, + "category": 1, + "messageText": "Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'?", + "relatedInformation": [ + { + "file": "./src/class.ts", + "start": 26, + "length": 5, + "messageText": "'prop1' is declared here.", + "category": 3, + "code": 2728 + } + ] + } + ] + ], + "./src/indirectclass.ts", + [ + "./src/indirectuse.ts", + [ + { + "file": "./src/indirectuse.ts", + "start": 76, + "length": 4, + "code": 2551, + "category": 1, + "messageText": "Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'?", + "relatedInformation": [ + { + "file": "./src/class.ts", + "start": 26, + "length": 5, + "messageText": "'prop1' is declared here.", + "category": 3, + "code": 2728 + } + ] + } + ] + ], + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396, + "skippedOn": "noEmit" + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./src/class.ts", + 1 + ], + [ + "./src/directuse.ts", + 0 + ], + [ + "./src/indirectclass.ts", + 1 + ], + [ + "./src/indirectuse.ts", + 0 + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: Fix error and emit @@ -320,6 +471,100 @@ Found 1 error. exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated +//// [/src/project/src/class.d.ts] file written with same contents +//// [/src/project/src/class.js] file written with same contents +//// [/src/project/src/directUse.d.ts] file written with same contents +//// [/src/project/src/indirectClass.d.ts] file written with same contents +//// [/src/project/src/indirectClass.js] file written with same contents +//// [/src/project/src/indirectUse.d.ts] file written with same contents +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "declaration": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396, + "skippedOn": "noEmit" + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: No Change run with emit @@ -347,15 +592,7 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - -1 {"compilerOptions":{"incremental":true,"declaration":true}} -   ~~~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success @@ -366,15 +603,7 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - -1 {"compilerOptions":{"incremental":true,"declaration":true}} -   ~~~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success @@ -585,7 +814,8 @@ exports.classC = classC; "length": 18, "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", "category": 1, - "code": 2396 + "code": 2396, + "skippedOn": "noEmit" } ] ] @@ -641,13 +871,28 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? -1 {"compilerOptions":{"incremental":true,"declaration":true}} -   ~~~~~~~~~~~~~ +2 new indirectClass().classC.prop; +   ~~~~ + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. -Found 1 error. +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + + +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped @@ -660,13 +905,28 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? -1 {"compilerOptions":{"incremental":true,"declaration":true}} -   ~~~~~~~~~~~~~ +2 new indirectClass().classC.prop; +   ~~~~ + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. -Found 1 error. + +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped @@ -723,17 +983,116 @@ export class classC { Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - -1 {"compilerOptions":{"incremental":true,"declaration":true}} -   ~~~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "declaration": true, + "project": "./", + "noEmit": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396, + "skippedOn": "noEmit" + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./src/class.ts", + 1 + ], + [ + "./src/directuse.ts", + 0 + ], + [ + "./src/indirectclass.ts", + 1 + ], + [ + "./src/indirectuse.ts", + 0 + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: No Change run with emit @@ -854,7 +1213,8 @@ exports.classC = classC; "length": 18, "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", "category": 1, - "code": 2396 + "code": 2396, + "skippedOn": "noEmit" } ] ] @@ -871,15 +1231,7 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - -1 {"compilerOptions":{"incremental":true,"declaration":true}} -   ~~~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success @@ -890,15 +1242,7 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - -1 {"compilerOptions":{"incremental":true,"declaration":true}} -   ~~~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success diff --git a/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-incremental.js b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-incremental.js index 7f7d7f0dd508a..2c210ce4758d6 100644 --- a/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-incremental.js +++ b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-incremental.js @@ -195,7 +195,8 @@ function someFunc(arguments) { "length": 18, "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", "category": 1, - "code": 2396 + "code": 2396, + "skippedOn": "noEmit" } ] ] @@ -212,15 +213,7 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - -1 {"compilerOptions":{"incremental":true}} -   ~~~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success @@ -231,15 +224,7 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - -1 {"compilerOptions":{"incremental":true}} -   ~~~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success @@ -255,17 +240,174 @@ export class classC { Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? -1 {"compilerOptions":{"incremental":true}} -   ~~~~~~~~~~~~~ +2 new indirectClass().classC.prop; +   ~~~~ + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. -Found 1 error. +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + + +Found 2 errors. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "1786859709-export class classC {\n prop1 = 1;\n}", + "signature": "-3790894605-export declare class classC {\r\n prop1: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "project": "./", + "noEmit": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + [ + "./src/directuse.ts", + [ + { + "file": "./src/directuse.ts", + "start": 76, + "length": 4, + "code": 2551, + "category": 1, + "messageText": "Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'?", + "relatedInformation": [ + { + "file": "./src/class.ts", + "start": 26, + "length": 5, + "messageText": "'prop1' is declared here.", + "category": 3, + "code": 2728 + } + ] + } + ] + ], + "./src/indirectclass.ts", + [ + "./src/indirectuse.ts", + [ + { + "file": "./src/indirectuse.ts", + "start": 76, + "length": 4, + "code": 2551, + "category": 1, + "messageText": "Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'?", + "relatedInformation": [ + { + "file": "./src/class.ts", + "start": 26, + "length": 5, + "messageText": "'prop1' is declared here.", + "category": 3, + "code": 2728 + } + ] + } + ] + ], + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396, + "skippedOn": "noEmit" + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./src/class.ts", + 1 + ], + [ + "./src/indirectclass.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: Fix error and emit @@ -290,6 +432,95 @@ Found 1 error. exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated +//// [/src/project/src/class.js] file written with same contents +//// [/src/project/src/indirectClass.js] file written with same contents +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "project": "./", + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396, + "skippedOn": "noEmit" + } + ] + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: No Change run with emit @@ -317,15 +548,7 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - -1 {"compilerOptions":{"incremental":true}} -   ~~~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success @@ -336,15 +559,7 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - -1 {"compilerOptions":{"incremental":true}} -   ~~~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success @@ -545,7 +760,8 @@ exports.classC = classC; "length": 18, "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", "category": 1, - "code": 2396 + "code": 2396, + "skippedOn": "noEmit" } ] ] @@ -601,13 +817,28 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. -1 {"compilerOptions":{"incremental":true}} -   ~~~~~~~~~~~~~ +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. -Found 1 error. + +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped @@ -620,13 +851,28 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. +src/project/src/directUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? -1 {"compilerOptions":{"incremental":true}} -   ~~~~~~~~~~~~~ +2 new indirectClass().classC.prop; +   ~~~~ + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. -Found 1 error. +src/project/src/indirectUse.ts:2:28 - error TS2551: Property 'prop' does not exist on type 'classC'. Did you mean 'prop1'? + +2 new indirectClass().classC.prop; +   ~~~~ + + src/project/src/class.ts:2:5 + 2 prop1 = 1; +    ~~~~~ + 'prop1' is declared here. + + +Found 2 errors. exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped @@ -683,17 +929,107 @@ export class classC { Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - -1 {"compilerOptions":{"incremental":true}} -   ~~~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "project": "./", + "noEmit": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396, + "skippedOn": "noEmit" + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./src/class.ts", + 1 + ], + [ + "./src/indirectclass.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: No Change run with emit @@ -804,7 +1140,8 @@ exports.classC = classC; "length": 18, "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", "category": 1, - "code": 2396 + "code": 2396, + "skippedOn": "noEmit" } ] ] @@ -821,15 +1158,7 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - -1 {"compilerOptions":{"incremental":true}} -   ~~~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success @@ -840,15 +1169,7 @@ Input:: Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - -1 {"compilerOptions":{"incremental":true}} -   ~~~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success diff --git a/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-composite.js b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-composite.js index 45bf871517dad..75d42a6e6c103 100644 --- a/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-composite.js +++ b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-composite.js @@ -48,17 +48,123 @@ function someFunc(arguments: boolean, ...rest: any[]) { Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. - -1 {"compilerOptions":{"composite":true}} -   ~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "project": "./", + "noEmit": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396, + "skippedOn": "noEmit" + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./src/class.ts", + 1 + ], + [ + "./src/directuse.ts", + 1 + ], + [ + "./src/indirectclass.ts", + 1 + ], + [ + "./src/indirectuse.ts", + 1 + ], + [ + "./src/nochangefile.ts", + 1 + ], + [ + "./src/nochangefilewithemitspecificerror.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: No Change run with emit @@ -243,7 +349,8 @@ function someFunc(arguments) { "length": 18, "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", "category": 1, - "code": 2396 + "code": 2396, + "skippedOn": "noEmit" } ] ] @@ -440,7 +547,8 @@ exports.classC = classC; "length": 18, "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", "category": 1, - "code": 2396 + "code": 2396, + "skippedOn": "noEmit" } ] ] @@ -462,17 +570,115 @@ export class classC { Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'composite'. - -1 {"compilerOptions":{"composite":true}} -   ~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "composite": true, + "project": "./", + "noEmit": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396, + "skippedOn": "noEmit" + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./src/class.ts", + 1 + ], + [ + "./src/directuse.ts", + 0 + ], + [ + "./src/indirectclass.ts", + 1 + ], + [ + "./src/indirectuse.ts", + 0 + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: No Change run with emit @@ -592,7 +798,8 @@ exports.classC = classC; "length": 18, "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", "category": 1, - "code": 2396 + "code": 2396, + "skippedOn": "noEmit" } ] ] diff --git a/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-incremental-declaration.js b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-incremental-declaration.js index 9dbfef53d8374..767f6b30912a9 100644 --- a/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-incremental-declaration.js +++ b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-incremental-declaration.js @@ -48,17 +48,124 @@ function someFunc(arguments: boolean, ...rest: any[]) { Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - -1 {"compilerOptions":{"incremental":true,"declaration":true}} -   ~~~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "declaration": true, + "project": "./", + "noEmit": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396, + "skippedOn": "noEmit" + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./src/class.ts", + 1 + ], + [ + "./src/directuse.ts", + 1 + ], + [ + "./src/indirectclass.ts", + 1 + ], + [ + "./src/indirectuse.ts", + 1 + ], + [ + "./src/nochangefile.ts", + 1 + ], + [ + "./src/nochangefilewithemitspecificerror.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: No Change run with emit @@ -244,7 +351,8 @@ function someFunc(arguments) { "length": 18, "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", "category": 1, - "code": 2396 + "code": 2396, + "skippedOn": "noEmit" } ] ] @@ -442,7 +550,8 @@ exports.classC = classC; "length": 18, "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", "category": 1, - "code": 2396 + "code": 2396, + "skippedOn": "noEmit" } ] ] @@ -464,17 +573,116 @@ export class classC { Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - -1 {"compilerOptions":{"incremental":true,"declaration":true}} -   ~~~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "declaration": true, + "project": "./", + "noEmit": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396, + "skippedOn": "noEmit" + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./src/class.ts", + 1 + ], + [ + "./src/directuse.ts", + 0 + ], + [ + "./src/indirectclass.ts", + 1 + ], + [ + "./src/indirectuse.ts", + 0 + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: No Change run with emit @@ -595,7 +803,8 @@ exports.classC = classC; "length": 18, "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", "category": 1, - "code": 2396 + "code": 2396, + "skippedOn": "noEmit" } ] ] diff --git a/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-incremental.js b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-incremental.js index 0cac48cd710b4..a1824d46678dc 100644 --- a/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-incremental.js +++ b/tests/baselines/reference/tsc/incremental/initial-build/noEmit-changes-with-initial-noEmit-incremental.js @@ -48,17 +48,123 @@ function someFunc(arguments: boolean, ...rest: any[]) { Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - -1 {"compilerOptions":{"incremental":true}} -   ~~~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "project": "./", + "noEmit": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396, + "skippedOn": "noEmit" + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./src/class.ts", + 1 + ], + [ + "./src/directuse.ts", + 1 + ], + [ + "./src/indirectclass.ts", + 1 + ], + [ + "./src/indirectuse.ts", + 1 + ], + [ + "./src/nochangefile.ts", + 1 + ], + [ + "./src/nochangefilewithemitspecificerror.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: No Change run with emit @@ -214,7 +320,8 @@ function someFunc(arguments) { "length": 18, "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", "category": 1, - "code": 2396 + "code": 2396, + "skippedOn": "noEmit" } ] ] @@ -402,7 +509,8 @@ exports.classC = classC; "length": 18, "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", "category": 1, - "code": 2396 + "code": 2396, + "skippedOn": "noEmit" } ] ] @@ -424,17 +532,107 @@ export class classC { Output:: /lib/tsc --p src/project --noEmit -src/project/tsconfig.json:1:21 - error TS5053: Option 'noEmit' cannot be specified with option 'incremental'. - -1 {"compilerOptions":{"incremental":true}} -   ~~~~~~~~~~~~~ - - -Found 1 error. - -exitCode:: ExitStatus.DiagnosticsPresent_OutputsSkipped +exitCode:: ExitStatus.Success +//// [/src/project/tsconfig.tsbuildinfo] +{ + "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/class.ts": { + "version": "545032748-export class classC {\n prop = 1;\n}", + "signature": "-6712382238-export declare class classC {\r\n prop: number;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/indirectclass.ts": { + "version": "6324910780-import { classC } from './class';\nexport class indirectClass {\n classC = new classC();\n}", + "signature": "-9860349972-import { classC } from './class';\r\nexport declare class indirectClass {\r\n classC: classC;\r\n}\r\n", + "affectsGlobalScope": false + }, + "./src/directuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/indirectuse.ts": { + "version": "-8953710208-import { indirectClass } from './indirectClass';\nnew indirectClass().classC.prop;", + "signature": "-4882119183-export {};\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefile.ts": { + "version": "6714567633-export function writeLog(s: string) {\n}", + "signature": "8117292349-export declare function writeLog(s: string): void;\r\n", + "affectsGlobalScope": false + }, + "./src/nochangefilewithemitspecificerror.ts": { + "version": "-19339541508-function someFunc(arguments: boolean, ...rest: any[]) {\n}", + "signature": "-4920141752-declare function someFunc(arguments: boolean, ...rest: any[]): void;\r\n", + "affectsGlobalScope": true + } + }, + "options": { + "incremental": true, + "project": "./", + "noEmit": true, + "configFilePath": "./tsconfig.json" + }, + "referencedMap": { + "./src/directuse.ts": [ + "./src/indirectclass.ts" + ], + "./src/indirectclass.ts": [ + "./src/class.ts" + ], + "./src/indirectuse.ts": [ + "./src/indirectclass.ts" + ] + }, + "exportedModulesMap": { + "./src/indirectclass.ts": [ + "./src/class.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../../lib/lib.d.ts", + "./src/class.ts", + "./src/directuse.ts", + "./src/indirectclass.ts", + "./src/indirectuse.ts", + "./src/nochangefile.ts", + [ + "./src/nochangefilewithemitspecificerror.ts", + [ + { + "file": "./src/nochangefilewithemitspecificerror.ts", + "start": 18, + "length": 18, + "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", + "category": 1, + "code": 2396, + "skippedOn": "noEmit" + } + ] + ] + ], + "affectedFilesPendingEmit": [ + [ + "./src/class.ts", + 1 + ], + [ + "./src/indirectclass.ts", + 1 + ] + ] + }, + "version": "FakeTSVersion" +} + Change:: No Change run with emit @@ -545,7 +743,8 @@ exports.classC = classC; "length": 18, "messageText": "Duplicate identifier 'arguments'. Compiler uses 'arguments' to initialize rest parameters.", "category": 1, - "code": 2396 + "code": 2396, + "skippedOn": "noEmit" } ] ] diff --git a/tests/baselines/reference/tsc/projectReferences/initial-build/when-project-references-composite-project-with-noEmit.js b/tests/baselines/reference/tsc/projectReferences/initial-build/when-project-references-composite-project-with-noEmit.js new file mode 100644 index 0000000000000..fbdfa2fa4d2d0 --- /dev/null +++ b/tests/baselines/reference/tsc/projectReferences/initial-build/when-project-references-composite-project-with-noEmit.js @@ -0,0 +1,48 @@ +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/index.ts] +import { x } from "../utils"; + +//// [/src/project/tsconfig.json] +{"references":[{"path":"../utils"}]} + +//// [/src/utils/index.ts] + + +//// [/src/utils/tsconfig.json] +{"compilerOptions":{"composite":true,"noEmit":true}} + + + +Output:: +/lib/tsc --p src/project +src/project/tsconfig.json:1:16 - error TS6310: Referenced project '/src/utils' may not disable emit. + +1 {"references":[{"path":"../utils"}]} +   ~~~~~~~~~~~~~~~~~~~ + + +Found 1 error. + +exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated + + +//// [/src/project/index.js] +"use strict"; +exports.__esModule = true; + +