Skip to content

C#: Improve TreeVisitor combining and handle null expression statements#7435

Merged
macsux merged 1 commit intomainfrom
macsux/rebase-on-main
Apr 21, 2026
Merged

C#: Improve TreeVisitor combining and handle null expression statements#7435
macsux merged 1 commit intomainfrom
macsux/rebase-on-main

Conversation

@macsux
Copy link
Copy Markdown
Contributor

@macsux macsux commented Apr 20, 2026

Summary

  • Generalized CombinedTreeVisitor to support combining an arbitrary number of visitors via IEnumerable, replacing the previous two-visitor-only implementation
  • Added Preconditions.And overloads: an extension method on ITreeVisitor and a Recipe[]-based variant for composing preconditions from recipes
  • Fixed CSharpVisitor.visitExpressionStatement to handle null from visitRightPadded, allowing expression statement deletion via visitor return-null semantics

Test plan

  • Verify C# dotnet tests pass (dotnet test in rewrite-csharp/csharp)
  • Verify Java-side compilation (./gradlew :rewrite-csharp:assemble)

@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Apr 20, 2026
@macsux macsux merged commit 517ffa7 into main Apr 21, 2026
1 check passed
@macsux macsux deleted the macsux/rebase-on-main branch April 21, 2026 16:14
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant