-
Notifications
You must be signed in to change notification settings - Fork 1.9k
C#: Increase precision of cs/constant-condition.
#18976
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C#: Increase precision of cs/constant-condition.
#18976
Conversation
… the use of wildcards when there is a condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
hvitved
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A small stylistic suggestion, otherwise LGTM.
Co-authored-by: Tom Hvitved <hvitved@github.com>
In this PR we start to take conditions into account for matching in switch statements and expressions. That is, we allow match all (discard) patterns, if there is a condition. Furthermore, we also apply the logic to switch/case statements.
Example
This reduces the number of false positives.
DCA looks good.