Skip to content

Commit

Permalink
S2589: Add FP repro for #7489 (#7491)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-mikula-sonarsource authored Jun 21, 2023
1 parent 32fc02e commit c66a9b2
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2929,3 +2929,21 @@ public void ReportOnConditional(object[] arg)
}
}
}

// https://github.com/SonarSource/sonar-dotnet/issues/7489
public class Repro_7489
{
public void Method()
{
int? value;
var hasValue = true;
while (hasValue) // Noncompliant FP when the tuple deconstruction is in the body
{
value = null;
hasValue = value.HasValue;

foreach (var (a, b) in new List<(int, int)>())
{ } // It only reproduces when this is present
}
}
}

0 comments on commit c66a9b2

Please sign in to comment.