-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
[EnC] Upgrade change types for containing types #68368
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
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
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.
AddContainingTypesAndNamespaces
will add properties/methods withSymbolChange.Updated
Can
edits
have one edit with some symbol contained within a property (with any level of nested), and another edit with the property itself?If this can happen, then
AddContainingTypesAndNamespaces
would add the property with SymbolChange.Updated for the first edit, then when processing the second edit for the property itself, we will try to add it again.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.
It shouldn't be possible, but then again this bug shouldn't have been possible either. In general I would say that this area of the compiler is full of nastiness if you stray from the happy path, and EnC is no exception. This code is written assuming the edits will be of a certain known form. In fact, this bug could probably be fixed equally by changes to the
AbstractEditAndContinueAnalyzer
where it creates the edits, to ensure it checks for containing types in the Replace scenario, or inEditSession
where it merges the semantic edits from all documents, to ensure a predictable order. I chose this fix because it seemed the easiest, but also deliberately left the call to.Add
so that its not masking any future odd scenarios.We'll have to wait and see where Tomas thinks that was the right call :)
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.
Should we assert that
member
is aINamedTypeSymbol
? I think this only happens for nested types, right?We don't have great coverage for nested combo updates in the IDE layer, we should add the following tests:
The last one demonstrates it's not an issue just for
Replace
edit, but we can also have "nested"Update
edits.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 don't think it demostrates that. The last two tests here would not have hit the bug. For the bug to repro, the edit for the nested type has to come first. I couldn't find a single-document repro of this issue (which is why I suspect it was never hit in the wild in .cshtml files). It is possible that the first test you have here could be made to hit it, if the compiler say the second document first, but none of the EnC test infra can do that end-to-end type of test that I'm aware of.
Have added the tests and assert either way :)
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.
That can be arranged if we split into partial in two documents like in the first test. What I meant is that it can occur with two Updates rather then just Replace and Update.