Skip to content

C#: Avoid recursive operator simplification - #22345

Open
theinfosecguy wants to merge 1 commit into
github:mainfrom
theinfosecguy:csharp-simplifiable-operator-recursion
Open

C#: Avoid recursive operator simplification#22345
theinfosecguy wants to merge 1 commit into
github:mainfrom
theinfosecguy:csharp-simplifiable-operator-recursion

Conversation

@theinfosecguy

Copy link
Copy Markdown
Contributor

Fixes #22190.

In build-mode: none databases, an overloaded comparison may be extracted as a binary operation. Avoid suggesting a rewrite when the replacement could recursively call an enclosing user-defined operator.

Tests cover all comparison pairs, nested callables, and safe built-in comparisons.

Validated with focused query tests, query formatting, and strict compilation.

@theinfosecguy
theinfosecguy marked this pull request as ready for review August 14, 2026 05:27
@theinfosecguy
theinfosecguy requested a review from a team as a code owner August 14, 2026 05:27
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.

[C#] False positive in cs/simplifiable-boolean-expression for operator != implementation

1 participant