Skip to content

33 feat detect duplicate else if conditions as unreachable branches#34

Merged
SizzleUnrlsd merged 11 commits intomainfrom
33-feat-detect-duplicate-else-if-conditions-as-unreachable-branches
Feb 7, 2026
Merged

33 feat detect duplicate else if conditions as unreachable branches#34
SizzleUnrlsd merged 11 commits intomainfrom
33-feat-detect-duplicate-else-if-conditions-as-unreachable-branches

Conversation

@SizzleUnrlsd
Copy link
Contributor

We added a new analysis pass that detects duplicate else if conditions that are logically unreachable. The analyzer now emits a DuplicateIfCondition warning with precise source locations. This was integrated into the diagnostics pipeline, added to the error-code enum, and wired into the build. We also added a set of diagnostic test cases covering positive detections (including commuted operands and nested scenarios) and negative cases (distinct conditions and separate if blocks).

Architecture rationale: we implemented this as its own analysis module and hooked it into the existing analysis pipeline rather than embedding the logic inside the main analyzer. This keeps responsibilities separated, makes the check independently testable, and avoids coupling with other diagnostics. Using dominator information and a lightweight source check balances precision with implementation cost, reducing false positives without requiring full AST-level parsing

@SizzleUnrlsd SizzleUnrlsd self-assigned this Feb 7, 2026
@SizzleUnrlsd SizzleUnrlsd linked an issue Feb 7, 2026 that may be closed by this pull request
@SizzleUnrlsd SizzleUnrlsd merged commit 4794013 into main Feb 7, 2026
4 checks passed
@SizzleUnrlsd SizzleUnrlsd deleted the 33-feat-detect-duplicate-else-if-conditions-as-unreachable-branches branch February 7, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat : detect duplicate else-if conditions as unreachable branches

1 participant