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 S3655 FP: Recognize ??= for nullable types #7308

Closed
pavel-mikula-sonarsource opened this issue May 30, 2023 · 0 comments · Fixed by #7312
Closed

Fix S3655 FP: Recognize ??= for nullable types #7308

pavel-mikula-sonarsource opened this issue May 30, 2023 · 0 comments · Fixed by #7312
Assignees
Labels
Area: C# C# rules related issues. Area: CFG/SE CFG and SE related issues. Sprint: SE Short-lived* label for epic MMF-3077 *troll Type: CFG/SE FPs Rule IS triggered when it shouldn't be for CFG and SE rules.
Projects
Milestone

Comments

@pavel-mikula-sonarsource
Copy link
Contributor

The ??= doesn't call property int?.HasValue, but invokes int?.HasValue.get method instead.

We need to recognize that in the engine and make them behave the same.

int? i = null;
i ??= 1;
var r1 = (int)i;    // Noncompliant FP
@pavel-mikula-sonarsource pavel-mikula-sonarsource added Area: CFG/SE CFG and SE related issues. Area: C# C# rules related issues. Type: CFG/SE FPs Rule IS triggered when it shouldn't be for CFG and SE rules. Sprint: SE Short-lived* label for epic MMF-3077 *troll labels May 30, 2023
@pavel-mikula-sonarsource pavel-mikula-sonarsource added this to the 9.3 milestone May 30, 2023
@github-actions github-actions bot added this to To do in Best Kanban May 30, 2023
@pavel-mikula-sonarsource pavel-mikula-sonarsource moved this from To do to In progress in Best Kanban May 30, 2023
@github-actions github-actions bot moved this from In progress to Review in progress in Best Kanban May 31, 2023
@github-actions github-actions bot moved this from Review in progress to Review approved in Best Kanban Jun 1, 2023
@gregory-paidis-sonarsource gregory-paidis-sonarsource modified the milestones: 9.3, 9.4 Jun 6, 2023
@pavel-mikula-sonarsource pavel-mikula-sonarsource changed the title Fix S1944 FP: Recognize ??= for nullable types Fix S3655 FP: Recognize ??= for nullable types Jun 6, 2023
Best Kanban automation moved this from Review approved to Validate Peach Jun 6, 2023
@pavel-mikula-sonarsource pavel-mikula-sonarsource moved this from Validate Peach to Done in Best Kanban Jun 7, 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. Sprint: SE Short-lived* label for epic MMF-3077 *troll Type: CFG/SE FPs Rule IS triggered when it shouldn't be for CFG and SE rules.
Projects
Best Kanban
  
Done
Development

Successfully merging a pull request may close this issue.

4 participants