Skip to content
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] Support more symbol deletes #62151

Merged
merged 6 commits into from
Jul 10, 2022
Merged

Conversation

davidwengier
Copy link
Contributor

@davidwengier davidwengier commented Jun 27, 2022

Part of #59264 and follow up to #61806

This allows deleting of properties, indexers, operators and constructors, since they're all just methods with fancy hats.

@davidwengier davidwengier marked this pull request as ready for review June 28, 2022 03:48
@davidwengier davidwengier requested review from a team as code owners June 28, 2022 03:48
@davidwengier
Copy link
Contributor Author

@tmat PTAL. Ignore the commit list, no idea why GitHub didn't compress it after the other branch merged

@davidwengier

This comment was marked as outdated.

@tmat
Copy link
Member

tmat commented Jul 1, 2022

                                    // the delete of the symbol as it will be deleted by the delete of the associated member.

Does this comment need to be updated?


Refers to: src/Features/Core/Portable/EditAndContinue/AbstractEditAndContinueAnalyzer.cs:2653 in 293e17b. [](commit_id = 293e17b, deletion_comment = False)

@@ -2655,7 +2655,7 @@ public ConstructorEdit(INamedTypeSymbol oldType)
// Associated member declarations must be in the same document as the symbol, so we don't need to resolve their symbol.
// In some cases the symbol even can't be resolved unambiguously. Consider e.g. resolving a method with its parameter deleted -
// we wouldn't know which overload to resolve to.
if (TryGetAssociatedMemberDeclaration(oldDeclaration, out var oldAssociatedMemberDeclaration))
if (TryGetAssociatedMemberDeclaration(oldDeclaration, EditKind.Delete, out var oldAssociatedMemberDeclaration))
Copy link
Member

Choose a reason for hiding this comment

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

EditKind

I'm not sure I understand why this is needed. When a property is deleted we want to create semantic edits for all of its accessors, but not for the property itself. If an accessor is deleted we want a single semantic edit just for that accessor. Correct?

If the entire property is deleted wouldn't we want to skip creating deletes for its accessors represented by the deletes of their syntax nodes, since we will add deletes for all of the accessor for the deleted property node?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this was just for ease of control flow, so that a delete of a single accessor didn't end up in passing this if, failing the inner one, and then not being considered as a method symbol delete. If I take your other suggestion about extracting the below to a method, I should be able to call that new method here and revert this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Though, that would mean this branch would look identical to the next branch, but I can't combine them without effectively bringing this change back 🤷‍♂️

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, don't think I can do anything meaningful about this... The problem is type parameters, which would fail the newContainingType == null check below. So to remove this, means adding a "is type parameter" check around that, which doesn't seem like it actually saves anything.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tmat how strongly do you feel about this? The other feedback has been addressed.

Copy link
Member

@tmat tmat left a comment

Choose a reason for hiding this comment

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

:shipit:

@davidwengier davidwengier merged commit 6a5f643 into dotnet:main Jul 10, 2022
@davidwengier davidwengier deleted the EnCMoreDeletes branch July 10, 2022 21:59
@ghost ghost added this to the Next milestone Jul 10, 2022
adamperlin pushed a commit to adamperlin/roslyn that referenced this pull request Jul 19, 2022
@allisonchou allisonchou modified the milestones: Next, 17.4 P1 Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants