Skip to content

Refresh semantic diagnostics when compiler options affecting semantic diagnostics generation changes#26200

Merged
sheetalkamat merged 4 commits into
masterfrom
watchWithStrict
Aug 10, 2018
Merged

Refresh semantic diagnostics when compiler options affecting semantic diagnostics generation changes#26200
sheetalkamat merged 4 commits into
masterfrom
watchWithStrict

Conversation

@sheetalkamat
Copy link
Copy Markdown
Member

Fixes #26195

Comment thread src/compiler/utilities.ts Outdated
}

return changedCompileOptionValueOf(newOptions, oldOptions, [
"noImplicitReturns",
Copy link
Copy Markdown
Member

@DanielRosenwasser DanielRosenwasser Aug 4, 2018

Choose a reason for hiding this comment

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

I wonder if, instead of placing the list here, we use our central list of compiler options and mark them all with an internal field called "semantic" or something. I feel like otherwise, we will forget to update this list.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

That sounds good, but we still have these strict flags which should check their total value (from individual flag and strict flag) to see if it has really changed so we would need that part either ways.

Copy link
Copy Markdown
Member

@weswigham weswigham left a comment

Choose a reason for hiding this comment

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

Looks ok. esModuleInterop and allowSyntheticDefaultImports also need to be flagged, though, since the error they can report is also a semantic one.

Copy link
Copy Markdown
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

One question and one suggestion.

Comment thread src/compiler/utilities.ts Outdated
return false;
}

for (const option of optionDeclarations) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

return forEach(optionDeclarations, option => return (option.stringFlag && ... reads a little better to me.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

some over forEach, probably.

{
name: "noUnusedParameters",
type: "boolean",
affectsSemanticDiagnostics: true,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What determines whether affectsSemanticDiagnostics is true?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The flags is true if changing value of the option, affects the semantic diagnostics reported(more/less) even if there is no change in file content. ( in turn whether to we need to throw away semantic diagnostics from cache(in --w mode) ) Eg. --noUnusedLocals can report more errors when turned on so it will have the flag true

Copy link
Copy Markdown
Member

@sandersn sandersn Aug 10, 2018

Choose a reason for hiding this comment

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

It seems easy to forget to set this when adding a new flag. Would making it required help? It would be annoying then, though.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah I don't think we want this required.

@sheetalkamat sheetalkamat merged commit c5b74db into master Aug 10, 2018
@sheetalkamat sheetalkamat deleted the watchWithStrict branch August 10, 2018 23:15
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
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.

5 participants