Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions src/Features/CSharpTest/EditAndContinue/TopLevelEditingTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10257,6 +10257,17 @@ public void Method_Partial_DeleteImplementation()
]);
}

[Fact]
public void Method_Partial_DeleteDefinition()
{
var src1 = "partial class C { partial void F(); }";
var src2 = "partial class C { }";

var edits = GetTopEdits(src1, src2);

edits.VerifySemantics();
}

[Fact]
public void Method_Partial_DeleteBoth()
{
Expand All @@ -10269,8 +10280,7 @@ public void Method_Partial_DeleteBoth()
EditAndContinueValidation.VerifySemantics(
[GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2)],
[
DocumentResults(
semanticEdits: [SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C")]),
DocumentResults(),
DocumentResults(
semanticEdits: [SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.F").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C")]),
]);
Expand Down Expand Up @@ -11830,11 +11840,7 @@ public void Constructor_Parameter_Insert_Primary_Record_WithCustomDeconstructor_
SemanticEdit(SemanticEditKind.Delete, c => c.GetPrimaryConstructor("C"), deletedSymbolContainerProvider: c => c.GetMember("C")),
SemanticEdit(SemanticEditKind.Insert, c => c.GetPrimaryConstructor("C")),
]),
DocumentResults(
semanticEdits:
[
SemanticEdit(SemanticEditKind.Delete, c => c.GetPrimaryDeconstructor("C").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"),
]),
DocumentResults(),
],
capabilities: EditAndContinueCapabilities.AddMethodToExistingType | EditAndContinueCapabilities.AddInstanceFieldToExistingType);
}
Expand Down Expand Up @@ -19301,12 +19307,7 @@ public void Property_Partial_DeleteBoth()
EditAndContinueValidation.VerifySemantics(
[GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2)],
[
DocumentResults(
semanticEdits:
[
SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IPropertySymbol>("C.P").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C"),
SemanticEdit(SemanticEditKind.Delete, c => c.GetMember<IMethodSymbol>("C.get_P").PartialImplementationPart, deletedSymbolContainerProvider: c => c.GetMember("C"), partialType: "C")
]),
DocumentResults(),
DocumentResults(
semanticEdits:
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2721,8 +2721,8 @@ newSymbol is IPropertySymbol newProperty &&
}

// If a partial method/property/indexer definition is deleted (and not moved to another partial type declaration, which is handled above)
// so must be the implementation. An edit will be issued for the implementation change.
if (newSymbol?.IsPartialDefinition() == true)
// so must be the implementation (if it exists). An edit will be issued for the implementation change.
if (oldSymbol.IsPartialDefinition())
{
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6029,11 +6029,7 @@ End Interface
EditAndContinueValidation.VerifySemantics(
{GetTopEdits(srcA1, srcA2), GetTopEdits(srcB1, srcB2)},
{
DocumentResults(
semanticEdits:=
{
SemanticEdit(SemanticEditKind.Delete, Function(c) c.GetMember(Of MethodSymbol)("C.F").PartialImplementationPart, deletedSymbolContainerProvider:=Function(c) c.GetMember("C"), partialType:="C")
}),
DocumentResults(),
DocumentResults(
semanticEdits:=
{
Expand Down
Loading