Skip to content
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

Fix S2589 FN: No BoolConstraint from numerical constant patterns #7780

Closed
mary-georgiou-sonarsource opened this issue Aug 11, 2023 · 0 comments · Fixed by #7846
Closed

Fix S2589 FN: No BoolConstraint from numerical constant patterns #7780

mary-georgiou-sonarsource opened this issue Aug 11, 2023 · 0 comments · Fixed by #7846
Assignees
Labels
Area: C# C# rules related issues. Area: CFG/SE CFG and SE related issues. Area: VB.NET VB.NET rules related issues. Type: False Negative Rule is NOT triggered when it should be.
Milestone

Comments

@mary-georgiou-sonarsource
Copy link
Contributor

mary-georgiou-sonarsource commented Aug 11, 2023

Description

The SE engine does not learn a BoolConstraint from numerical constant patterns.

Repro steps

a = 0 switch
{
    1 => true            // FN
    , _ => false
};

Expected behavior

Should raise S2589 issue.

@mary-georgiou-sonarsource mary-georgiou-sonarsource added Type: False Negative Rule is NOT triggered when it should be. Area: CFG/SE CFG and SE related issues. Area: VB.NET VB.NET rules related issues. Area: C# C# rules related issues. labels Aug 11, 2023
@Tim-Pohlmann Tim-Pohlmann added this to the 9.9 milestone Aug 22, 2023
@Tim-Pohlmann Tim-Pohlmann self-assigned this Aug 22, 2023
@Tim-Pohlmann Tim-Pohlmann changed the title Fix S2589 FN: Capture numerical constrain knowledge Fix S2589 FN: No BoolConstraints from numerical constant patterns Aug 23, 2023
@Tim-Pohlmann Tim-Pohlmann changed the title Fix S2589 FN: No BoolConstraints from numerical constant patterns Fix S2589 FN: No BoolConstraint from numerical constant patterns Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: C# C# rules related issues. Area: CFG/SE CFG and SE related issues. Area: VB.NET VB.NET rules related issues. Type: False Negative Rule is NOT triggered when it should be.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants