Skip to content

Commit

Permalink
S2589: Add FP repro for #7096 (#7100)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-mikula-sonarsource authored Apr 24, 2023
1 parent e83f17d commit d43973e
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,23 @@ public void NotPattern()
}
}
}

// https://github.com/SonarSource/sonar-dotnet/issues/7096
namespace Repro_7096
{
public interface I { }
public class A : I { }
public class B : I { }

class C
{
public bool OrElsePattern(I obj) =>
obj is A { } || obj is B { }; // Noncompliant FP

public bool OrElse(I obj) =>
obj is A || obj is B;

public bool Or(I obj) =>
obj is A { } or B { };
}
}

0 comments on commit d43973e

Please sign in to comment.