Skip to content

Commit

Permalink
Repro for FN 2589: Support redundant recursive pattern null check (#9234
Browse files Browse the repository at this point in the history
)
  • Loading branch information
gregory-paidis-sonarsource committed May 2, 2024
1 parent a2cd911 commit 75e2d7b
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -669,3 +669,17 @@ public void Method()
private string SomeString() => "";
private bool SomeBool() => true;
}

// https://github.com/SonarSource/sonar-dotnet/issues/9203
class Repro_9203
{
void RecursivePattern(string s)
{
s.GetHashCode();
if (s is { }) // FN: Recursive pattern null check is not supported
{ }

if (s is { }) // Compliant: not just null-check, the property value is also checked
{ }
}
}

0 comments on commit 75e2d7b

Please sign in to comment.