Skip to content

fix(mutation): improve mutation of interpolated strings - #4046

Merged
rouke-broersma merged 2 commits into
masterfrom
keep_interpolated_string_type
Nov 26, 2026
Merged

rouke-broersma merged 2 commits into
masterfrom
keep_interpolated_string_type

Conversation

@dupdob

@dupdob dupdob commented Nov 25, 2026

Copy link
Copy Markdown
Member

ensure interpolated string type is kept during mutation

Copilot AI balanced review requested due to automatic review settings November 25, 2026 22:04
@dupdob
dupdob force-pushed the keep_interpolated_string_type branch from bf730f6 to cf7d2f2 Compare November 25, 2026 22:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Critical guard gaps allow invalid conditional injection in void-returning lambdas, other void-bodied contexts, and for-loop initializer/incrementor lists, producing mutants that cannot compile.

2 open issues
What changed in this PR

This PR improves Stryker.NET’s interpolated-string mutation placement to preserve conversions to interpolated-string handlers and FormattableString.

Changes:

  • Adds and registers an orchestrator that defers mutations requiring interpolated-string conversions.
  • Prevents conditional injection in expression statements and void method arrow bodies.
  • Adds regression tests and enables an existing top-level statement test.
File Description
src/​Stryker.Core/​Stryker.Core/​Mutators/​InterpolatedStringMutator.cs Makes the empty-string factory static with a specific syntax return type.
src/​Stryker.Core/​Stryker.Core/​Mutants/​MutationStore.cs Adds guards for contexts that cannot use conditional expressions.
src/​Stryker.Core/​Stryker.Core/​Mutants/​CsharpNodeOrchestrators/​InvocationExpressionOrchestrator.cs Adjusts whitespace only.
src/​Stryker.Core/​Stryker.Core/​Mutants/​CsharpNodeOrchestrators/​InterpolatedStringOrchestrator.cs Defers mutation placement for special interpolated-string conversions.
src/​Stryker.Core/​Stryker.Core/​Mutants/​CsharpMutantOrchestrator.cs Registers the interpolated-string orchestrator.
src/​Stryker.Core/​Stryker.Core.UnitTest/​Mutants/​CsharpMutantOrchestratorTests.cs Adds conversion and placement tests; enables an existing test.

Review effort: Balanced

@dupdob
dupdob force-pushed the keep_interpolated_string_type branch 2 times, most recently from 0dd08e1 to bf01a5c Compare November 25, 2026 22:49
@dupdob
dupdob force-pushed the keep_interpolated_string_type branch from bf01a5c to 2e2eeb8 Compare November 26, 2026 06:16
@sonarqubecloud

Copy link
Copy Markdown

@rouke-broersma
rouke-broersma merged commit 6e44654 into master Nov 26, 2026
42 checks passed
@rouke-broersma
rouke-broersma deleted the keep_interpolated_string_type branch November 26, 2026 12:04
This was referenced Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants