Open jnyrup opened 6 months ago
Hey,
That is a good find. As you might know, recursive pattern can be tricky, as it can appear in many, many forms. I will document it with a reproducer in our unit tests, and it will be taken care of at some point in the future, when we tackle Symbolic Execution FP/FNs.
Thanks for raising the issue.
PS: FluentAssertions is awesome!
Thanks for looking into this and for the kind words regarding Fluent Assertions
As you might know, recursive pattern can be tricky, as it can appear in many, many forms.
Yeah, I did think of the many forms recursive patterns can take.
Without having the faintest insights into your analyzers, I wondered if perhaps is { }
could somehow be special cased to be equivalent to a null check and then (for now) ignore the more complex patterns.
Description
When using a property pattern
is { }
as a null check S2589 does not recognize it as redundant. Is that a bug or a deliberate design decision?Repro steps
Expected behavior
E()
should report S2589Actual behavior
E()
does not report S2589Known workarounds
Use
is not null
instead ofis {}
to trigger S2589Related information