Add minimal binary pattern support for null checks in DFA - #6877
Merged
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #6877 +/- ##
==========================================
- Coverage 96.39% 96.39% -0.01%
==========================================
Files 1403 1403
Lines 330977 331075 +98
Branches 10890 10900 +10
==========================================
+ Hits 319055 319148 +93
- Misses 9188 9191 +3
- Partials 2734 2736 +2 |
Youssef1313
force-pushed
the
dfa-binary-pattern
branch
from
August 20, 2023 17:30
0212991 to
b1d9dc2
Compare
mavasani
reviewed
Aug 29, 2023
| predicateValueKind = PredicateValueKind.Unknown; | ||
|
|
||
| // We special case common null check to reduce false positives. But this implementation for BinaryPattern is very incomplete. | ||
| if (FlowBranchConditionKind == ControlFlowConditionKind.WhenFalse) |
There was a problem hiding this comment.
This is a nice optimization! Generic flow analysis handling for binary pattern operations is going to be non-trivial as there are sort of conditional branches with the and and or operators. I think this is a good starting point to handle the most important cases.
This was referenced Jul 28, 2025
Closed
Closed
This was referenced Aug 4, 2025
This was referenced Aug 25, 2025
This was referenced Sep 14, 2025
This was referenced Oct 28, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6755
@mavasani I have added very very minimal handling for binary patterns.
This doesn't handle declaration patterns, etc etc.
I can try to go further with the implementation whenever I get time again :)
I know my implementation might not be good enough. So, feel free if you wanted to close this PR and have a completely different fix.