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

SE: Fix FN S2583/S2589 Equals #7704

Closed
2 tasks done
mary-georgiou-sonarsource opened this issue Jul 28, 2023 · 0 comments · Fixed by #7906
Closed
2 tasks done

SE: Fix FN S2583/S2589 Equals #7704

mary-georgiou-sonarsource opened this issue Jul 28, 2023 · 0 comments · Fixed by #7906
Assignees
Labels
Area: C# C# rules 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 Jul 28, 2023

When invoking Equals currently the engine is learning only object constraints.
It should also learn bool and number constraints.

Examples:

int i = 10;
if (object.Equals(i, i)) { }  // FN
  
bool a, b;
a = b = true;
if (object.Equals(a, b)) { }   // FN
  • Learn bool constraint from equals when parameters are bool.
  • Learn bool constraint from equals result when parameters are numerical values.
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: 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.

3 participants