Skip to content

[EnC] Allow deleting method#61806

Merged
davidwengier merged 44 commits intodotnet:mainfrom
davidwengier:EnCDeleteMethod
Jun 28, 2022
Merged

[EnC] Allow deleting method#61806
davidwengier merged 44 commits intodotnet:mainfrom
davidwengier:EnCDeleteMethod

Conversation

@davidwengier
Copy link
Member

@davidwengier davidwengier commented Jun 10, 2022

Fixes #61678
Part of #59264

This allows deleting a method in Edit and Continue/Hot Reload. When deleted, we emit a method that throws MissingMethodException in its place. If a method by the same is name is re-added, we emit an update, as though the method wasn't deleted in the first place.

@ghost ghost added the Area-Compilers label Jun 10, 2022
@davidwengier davidwengier force-pushed the EnCDeleteMethod branch 2 times, most recently from fe3ee19 to 253bae5 Compare June 15, 2022 09:08
}
""",
edits: new[] {
Edit(SemanticEditKind.Insert, symbolProvider: c => c.GetMember("C.M1")),
Copy link
Contributor

Choose a reason for hiding this comment

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

SemanticEditKind.Insert

Did I see a comment elsewhere that adding a method back would be treated as an update rather than an add (or insert)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but only during emit. So the analyzer still sees it as an insert and still reports the semantic edit as such, which is what this represents, but then in DeltaMetadataWriter (here) that gets treated as an update.

@davidwengier davidwengier requested a review from tmat June 24, 2022 06:44
@davidwengier
Copy link
Member Author

@dotnet/roslyn-compiler for a second review, please

@davidwengier
Copy link
Member Author

Ping @tmat

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:

@tmat
Copy link
Member

tmat commented Jun 27, 2022

Just a few minor things.

@davidwengier davidwengier enabled auto-merge (squash) June 28, 2022 00:16
@davidwengier davidwengier merged commit a301583 into dotnet:main Jun 28, 2022
@ghost ghost added this to the Next milestone Jun 28, 2022
@davidwengier davidwengier deleted the EnCDeleteMethod branch June 28, 2022 03:39
@tmat
Copy link
Member

tmat commented Jun 28, 2022

Nice!

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.

EnC: Allow deleting methods

5 participants