-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix incrementalism when suppressed: #9717
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2db31c1
Fix incrementalism when suppressed:
chsienki a841229
Add comment
chsienki bb54da2
Amend test to check compilation chaging during suppression
chsienki a31a8f9
Update src/Compiler/Microsoft.NET.Sdk.Razor.SourceGenerators/Incremen…
chsienki 7d56659
Add parse options change to test
chsienki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I imagine this can happen?
analyzerConfigOptions
orparseOptions
) are changing and hence we are recomputing the output (razorSourceGeneratorOptions
). All is fine.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This scenario is handled (we test is here: https://github.com/dotnet/razor/pull/9717/files#diff-21bee42801ceadff30fba484ddb46162fb1af8d819b27b06e2c1ebcd612f4feeR2619)
Some of the inputs all have
EmptyOrCachedWhen
on them: that means when the suppression flag changes, we'll re-evaluate them, and realize that one of the items is different.The other inputs are all used in conjunction with
SuppressIfNeeded
that ensures they will also be re-evaluated when that value changes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I amended the test to cover the compilation changing too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test adds a document, does that change the inputs here (
analyzerConfigOptions
orparseOptions
)? Because I'm talking specifically aboutSuppressIfNeeded
which seems it won't re-run if the inputs change while the suppression was on - since the lambda comparer inside is returning true while suppressed, then when unsuppressed, it compares the old with the new - but the old could have changed during the suppression, hence the old would be equal to new, but could be different from the state when the suppression was off previously. For example:SuppressIfNeeded
reports "up to date" due to suppression)SuppressIfNeeded
compares the previous value of parseOptions = A with the current value A hence "up to date") - seems wrong, should be changed to A.Isn't that what could happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that should still work. Because we combine with the configOptions (which has to change to change suppression)
ComputeRazorSourceGeneratorOptions
still runs as needed and updates the options.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added more to the test to cover that scenario.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, thanks. Although it sounds like the SuppressIfNeeded works only due to the pipeline being constructed in a specific way (eg, here it works only because one of the inputs contains the suppression check). Might be worthwhile to add a warning to the doc comment of SuppressIfNeeded to make sure it's not used incorrectly in the future (if it can really behave as I describe if used on different inputs for example).