Skip to content

Builder handles changes in resolution/references when file's contents dont change#18960

Merged
sheetalkamat merged 4 commits into
masterfrom
builderHandlesChangeInResolution
Oct 11, 2017
Merged

Builder handles changes in resolution/references when file's contents dont change#18960
sheetalkamat merged 4 commits into
masterfrom
builderHandlesChangeInResolution

Conversation

@sheetalkamat

Copy link
Copy Markdown
Member

Let builder find out from imports/typereference directives if file references have changed.
This is needed to ensure that the ambient module addition takes effect
Fixes #15632

…ferences have changed.

This is needed to ensure that the ambient module addition takes effect
Fixes #15632
@sheetalkamat

Copy link
Copy Markdown
Member Author

@mhegazy or @Andy-MS can you please take a look

Comment thread src/compiler/builder.ts
*/
onUpdateSourceFile(program: Program, sourceFile: SourceFile): void;
/**
* Called when source file has not changed but has some of the resolutions invalidated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Called when source file has not changed" sounds strange -- it's unusual to invoke a callback when something doesn't happen. How about:

For all source files, either "onUpdateSourceFile" or "onUpdateSourceFileWithSameVersion" will be called.
If the builder is sure that the source file needs an update, "onUpdateSourceFile" will be called;
otherwise "onUpdateSourceFileWithSameVersion" will be called.
This should return whether the source file should be marked as changed (meaning that something associated with file has changed, e.g. module resolution).

content: `
declare module "fs" {
export interface Stats {
isFile(): boolean;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you cut down on the properties here -- just enough so that the bug would reproduce (without this fix)?

Comment thread src/harness/unittests/tscWatchMode.ts Outdated

host.reloadFS(filesWithNodeType);
host.runQueuedTimeoutCallbacks();
checkOutputDoesNotContain(host, [fsNotFound]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if the error message changed slightly the test would pass.. can't we just assert that there are no errors at all?

@sheetalkamat sheetalkamat merged commit bce77fd into master Oct 11, 2017
@sheetalkamat sheetalkamat deleted the builderHandlesChangeInResolution branch October 11, 2017 19:11
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant