-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix incremental emit issue where dependency relations implied by synt…
…hesized imports would not be detected (#41346) * Fix incremental emit issue where dependency relations implies by synthesized imports would not be detected * Update src/compiler/program.ts Co-authored-by: Daniel Rosenwasser <DanielRosenwasser@users.noreply.github.com>
- Loading branch information
1 parent
6bef0cb
commit 816af71
Showing
10 changed files
with
1,258 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
181 changes: 181 additions & 0 deletions
181
...selines/reference/tscWatch/incremental/importHelpers-backing-types-removed-incremental.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
Input:: | ||
//// [/a/lib/lib.d.ts] | ||
/// <reference no-default-lib="true"/> | ||
interface Boolean {} | ||
interface Function {} | ||
interface CallableFunction {} | ||
interface NewableFunction {} | ||
interface IArguments {} | ||
interface Number { toExponential: any; } | ||
interface Object {} | ||
interface RegExp {} | ||
interface String { charAt: any; } | ||
interface Array<T> { length: number; [n: number]: T; } | ||
interface ReadonlyArray<T> {} | ||
declare const console: { log(msg: any): void; }; | ||
|
||
//// [/users/username/projects/project/node_modules/tslib/index.d.ts] | ||
export function __assign(...args: any[]): any; | ||
|
||
//// [/users/username/projects/project/node_modules/tslib/package.json] | ||
{"name":"tslib","version":"0.0.1"} | ||
|
||
//// [/users/username/projects/project/index.tsx] | ||
export const x = {...{}}; | ||
|
||
//// [/users/username/projects/project/tsconfig.json] | ||
{"compilerOptions":{"importHelpers":true}} | ||
|
||
|
||
/a/lib/tsc.js -i | ||
Output:: | ||
|
||
|
||
Program root files: ["/users/username/projects/project/index.tsx"] | ||
Program options: {"importHelpers":true,"incremental":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} | ||
Program structureReused: Not | ||
Program files:: | ||
/a/lib/lib.d.ts | ||
/users/username/projects/project/node_modules/tslib/index.d.ts | ||
/users/username/projects/project/index.tsx | ||
|
||
Semantic diagnostics in builder refreshed for:: | ||
/a/lib/lib.d.ts | ||
/users/username/projects/project/node_modules/tslib/index.d.ts | ||
/users/username/projects/project/index.tsx | ||
|
||
WatchedFiles:: | ||
|
||
FsWatches:: | ||
|
||
FsWatchesRecursive:: | ||
|
||
exitCode:: ExitStatus.Success | ||
|
||
//// [/users/username/projects/project/index.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.x = void 0; | ||
var tslib_1 = require("tslib"); | ||
exports.x = tslib_1.__assign({}); | ||
|
||
|
||
//// [/users/username/projects/project/tsconfig.tsbuildinfo] | ||
{ | ||
"program": { | ||
"fileInfos": { | ||
"../../../../a/lib/lib.d.ts": { | ||
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };", | ||
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };", | ||
"affectsGlobalScope": true | ||
}, | ||
"./node_modules/tslib/index.d.ts": { | ||
"version": "1620578607-export function __assign(...args: any[]): any;", | ||
"signature": "1620578607-export function __assign(...args: any[]): any;", | ||
"affectsGlobalScope": false | ||
}, | ||
"./index.tsx": { | ||
"version": "-14168389096-export const x = {...{}};", | ||
"signature": "-6508651827-export declare const x: {};\n", | ||
"affectsGlobalScope": false | ||
} | ||
}, | ||
"options": { | ||
"importHelpers": true, | ||
"incremental": true, | ||
"configFilePath": "./tsconfig.json" | ||
}, | ||
"referencedMap": { | ||
"./index.tsx": [ | ||
"./node_modules/tslib/index.d.ts" | ||
] | ||
}, | ||
"exportedModulesMap": {}, | ||
"semanticDiagnosticsPerFile": [ | ||
"../../../../a/lib/lib.d.ts", | ||
"./index.tsx", | ||
"./node_modules/tslib/index.d.ts" | ||
] | ||
}, | ||
"version": "FakeTSVersion" | ||
} | ||
|
||
|
||
Change:: | ||
|
||
Input:: | ||
//// [/users/username/projects/project/node_modules/tslib/index.d.ts] deleted | ||
//// [/users/username/projects/project/node_modules/tslib/package.json] deleted | ||
|
||
Output:: | ||
[96mindex.tsx[0m:[93m1[0m:[93m19[0m - [91merror[0m[90m TS2354: [0mThis syntax requires an imported helper but module 'tslib' cannot be found. | ||
|
||
[7m1[0m export const x = {...{}}; | ||
[7m [0m [91m ~~~~~[0m | ||
|
||
|
||
Found 1 error. | ||
|
||
|
||
|
||
Program root files: ["/users/username/projects/project/index.tsx"] | ||
Program options: {"importHelpers":true,"incremental":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} | ||
Program structureReused: Not | ||
Program files:: | ||
/a/lib/lib.d.ts | ||
/users/username/projects/project/index.tsx | ||
|
||
Semantic diagnostics in builder refreshed for:: | ||
/users/username/projects/project/index.tsx | ||
|
||
WatchedFiles:: | ||
|
||
FsWatches:: | ||
|
||
FsWatchesRecursive:: | ||
|
||
exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated | ||
|
||
//// [/users/username/projects/project/index.js] file written with same contents | ||
//// [/users/username/projects/project/tsconfig.tsbuildinfo] | ||
{ | ||
"program": { | ||
"fileInfos": { | ||
"../../../../a/lib/lib.d.ts": { | ||
"version": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };", | ||
"signature": "3858781397-/// <reference no-default-lib=\"true\"/>\ninterface Boolean {}\ninterface Function {}\ninterface CallableFunction {}\ninterface NewableFunction {}\ninterface IArguments {}\ninterface Number { toExponential: any; }\ninterface Object {}\ninterface RegExp {}\ninterface String { charAt: any; }\ninterface Array<T> { length: number; [n: number]: T; }\ninterface ReadonlyArray<T> {}\ndeclare const console: { log(msg: any): void; };", | ||
"affectsGlobalScope": true | ||
}, | ||
"./index.tsx": { | ||
"version": "-14168389096-export const x = {...{}};", | ||
"signature": "-6508651827-export declare const x: {};\n", | ||
"affectsGlobalScope": false | ||
} | ||
}, | ||
"options": { | ||
"importHelpers": true, | ||
"incremental": true, | ||
"configFilePath": "./tsconfig.json" | ||
}, | ||
"referencedMap": {}, | ||
"exportedModulesMap": {}, | ||
"semanticDiagnosticsPerFile": [ | ||
"../../../../a/lib/lib.d.ts", | ||
[ | ||
"./index.tsx", | ||
[ | ||
{ | ||
"file": "./index.tsx", | ||
"start": 18, | ||
"length": 5, | ||
"messageText": "This syntax requires an imported helper but module 'tslib' cannot be found.", | ||
"category": 1, | ||
"code": 2354 | ||
} | ||
] | ||
] | ||
] | ||
}, | ||
"version": "FakeTSVersion" | ||
} | ||
|
133 changes: 133 additions & 0 deletions
133
tests/baselines/reference/tscWatch/incremental/importHelpers-backing-types-removed-watch.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
Input:: | ||
//// [/a/lib/lib.d.ts] | ||
/// <reference no-default-lib="true"/> | ||
interface Boolean {} | ||
interface Function {} | ||
interface CallableFunction {} | ||
interface NewableFunction {} | ||
interface IArguments {} | ||
interface Number { toExponential: any; } | ||
interface Object {} | ||
interface RegExp {} | ||
interface String { charAt: any; } | ||
interface Array<T> { length: number; [n: number]: T; } | ||
interface ReadonlyArray<T> {} | ||
declare const console: { log(msg: any): void; }; | ||
|
||
//// [/users/username/projects/project/node_modules/tslib/index.d.ts] | ||
export function __assign(...args: any[]): any; | ||
|
||
//// [/users/username/projects/project/node_modules/tslib/package.json] | ||
{"name":"tslib","version":"0.0.1"} | ||
|
||
//// [/users/username/projects/project/index.tsx] | ||
export const x = {...{}}; | ||
|
||
//// [/users/username/projects/project/tsconfig.json] | ||
{"compilerOptions":{"importHelpers":true}} | ||
|
||
|
||
/a/lib/tsc.js -w | ||
Output:: | ||
>> Screen clear | ||
[[90m12:00:29 AM[0m] Starting compilation in watch mode... | ||
|
||
[[90m12:00:32 AM[0m] Found 0 errors. Watching for file changes. | ||
|
||
|
||
|
||
Program root files: ["/users/username/projects/project/index.tsx"] | ||
Program options: {"importHelpers":true,"watch":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} | ||
Program structureReused: Not | ||
Program files:: | ||
/a/lib/lib.d.ts | ||
/users/username/projects/project/node_modules/tslib/index.d.ts | ||
/users/username/projects/project/index.tsx | ||
|
||
Semantic diagnostics in builder refreshed for:: | ||
/a/lib/lib.d.ts | ||
/users/username/projects/project/node_modules/tslib/index.d.ts | ||
/users/username/projects/project/index.tsx | ||
|
||
WatchedFiles:: | ||
/users/username/projects/project/tsconfig.json: | ||
{"fileName":"/users/username/projects/project/tsconfig.json","pollingInterval":250} | ||
/users/username/projects/project/index.tsx: | ||
{"fileName":"/users/username/projects/project/index.tsx","pollingInterval":250} | ||
/users/username/projects/project/node_modules/tslib/index.d.ts: | ||
{"fileName":"/users/username/projects/project/node_modules/tslib/index.d.ts","pollingInterval":250} | ||
/a/lib/lib.d.ts: | ||
{"fileName":"/a/lib/lib.d.ts","pollingInterval":250} | ||
|
||
FsWatches:: | ||
|
||
FsWatchesRecursive:: | ||
/users/username/projects/project/node_modules: | ||
{"directoryName":"/users/username/projects/project/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} | ||
/users/username/projects/project/node_modules/@types: | ||
{"directoryName":"/users/username/projects/project/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} | ||
/users/username/projects/project: | ||
{"directoryName":"/users/username/projects/project","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} | ||
|
||
exitCode:: ExitStatus.undefined | ||
|
||
//// [/users/username/projects/project/index.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.x = void 0; | ||
var tslib_1 = require("tslib"); | ||
exports.x = tslib_1.__assign({}); | ||
|
||
|
||
|
||
Change:: | ||
|
||
Input:: | ||
//// [/users/username/projects/project/node_modules/tslib/index.d.ts] deleted | ||
//// [/users/username/projects/project/node_modules/tslib/package.json] deleted | ||
|
||
Output:: | ||
>> Screen clear | ||
[[90m12:00:35 AM[0m] Starting compilation in watch mode... | ||
|
||
[96mindex.tsx[0m:[93m1[0m:[93m19[0m - [91merror[0m[90m TS2354: [0mThis syntax requires an imported helper but module 'tslib' cannot be found. | ||
|
||
[7m1[0m export const x = {...{}}; | ||
[7m [0m [91m ~~~~~[0m | ||
|
||
[[90m12:00:39 AM[0m] Found 1 error. Watching for file changes. | ||
|
||
|
||
|
||
Program root files: ["/users/username/projects/project/index.tsx"] | ||
Program options: {"importHelpers":true,"watch":true,"configFilePath":"/users/username/projects/project/tsconfig.json"} | ||
Program structureReused: Not | ||
Program files:: | ||
/a/lib/lib.d.ts | ||
/users/username/projects/project/index.tsx | ||
|
||
Semantic diagnostics in builder refreshed for:: | ||
/a/lib/lib.d.ts | ||
/users/username/projects/project/index.tsx | ||
|
||
WatchedFiles:: | ||
/users/username/projects/project/tsconfig.json: | ||
{"fileName":"/users/username/projects/project/tsconfig.json","pollingInterval":250} | ||
/users/username/projects/project/index.tsx: | ||
{"fileName":"/users/username/projects/project/index.tsx","pollingInterval":250} | ||
/a/lib/lib.d.ts: | ||
{"fileName":"/a/lib/lib.d.ts","pollingInterval":250} | ||
|
||
FsWatches:: | ||
|
||
FsWatchesRecursive:: | ||
/users/username/projects/project/node_modules: | ||
{"directoryName":"/users/username/projects/project/node_modules","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} | ||
/users/username/projects/project/node_modules/@types: | ||
{"directoryName":"/users/username/projects/project/node_modules/@types","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} | ||
/users/username/projects/project: | ||
{"directoryName":"/users/username/projects/project","fallbackPollingInterval":500,"fallbackOptions":{"watchFile":"PriorityPollingInterval"}} | ||
|
||
exitCode:: ExitStatus.undefined | ||
|
||
//// [/users/username/projects/project/index.js] file written with same contents |
Oops, something went wrong.