Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,11 @@ private string DisplayName(SyntaxNode initNode) =>
not null => initNode.Parent == null ? "whole file" : "the current node",
};


// errors that must trigger a deep removal of mutations
// usage of uninitialized variables (165)
Comment on lines +316 to +317
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

The comment describing CS0165 as “usage of uninitialized variables” is inaccurate/misleading (CS0165 is “use of unassigned local variable”). Updating this comment to the correct wording will make it clearer why this diagnostic needs recursive rollback.

Suggested change
// errors that must trigger a deep removal of mutations
// usage of uninitialized variables (165)
// Errors that must trigger a deep removal of mutations.
// CS0165: use of unassigned local variable.

Copilot uses AI. Check for mistakes.
private static readonly HashSet<string> ErrorsRequiringRecursiveRemoval = ["CS0165"];
Comment on lines +316 to +318
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

The PR description says this should fix #3542, but that issue’s concrete example is CS0161 (“not all code paths return a value”) from removing a trailing throw. This change only adds special handling for CS0165; please either (a) clarify in the PR description how CS0165 relates to #3542, or (b) include CS0161 (and any other intended diagnostics) in the set of errors that trigger recursive removal.

Copilot uses AI. Check for mistakes.

private Collection<SyntaxNode> IdentifyMutationsAndFlagForRollback(IEnumerable<Diagnostic> diagnosticInfo,
SyntaxNode rollbackRoot, out Diagnostic[] diagnostics)
{
Expand All @@ -326,7 +331,7 @@ private Collection<SyntaxNode> IdentifyMutationsAndFlagForRollback(IEnumerable<D
continue;
}

if (MutantPlacer.RequiresRemovingChildMutations(mutationIf))
if (MutantPlacer.RequiresRemovingChildMutations(mutationIf) || ErrorsRequiringRecursiveRemoval.Contains(diagnostic.Id))
{
Comment on lines +334 to 335
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

The new CS0165-specific branch changes rollback behavior (it will recursively remove child mutations instead of only the enclosing mutation). This is a functional change in compile-error recovery logic but there’s no unit test exercising the CS0165 scenario; please add coverage in Stryker.Core.UnitTest/Compiling/CSharpRollbackProcessTests validating that on a CS0165 diagnostic, the rollback process removes child mutations as intended (i.e., multiple mutant ids are rolled back in one pass, and the follow-up compilation succeeds).

Copilot generated this review using guidance from repository custom instructions.
FlagChildrenMutationsForRollback(mutationIf, brokenMutations);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1154,9 +1154,9 @@ public TestableRunner(

public override void Dispose(bool disposing)
{
var disposedField = typeof(SingleMicrosoftTestPlatformRunner).GetField("_disposed",
var disposedField = typeof(SingleMicrosoftTestPlatformRunner).GetField("_disposed",
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);

var wasDisposedBefore = (bool)disposedField!.GetValue(this)!;

base.Dispose(disposing);
Expand Down
Loading