mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 22:17:05 +07:00
This commit disables PyUnboundLocalVariableInspection for PSI elements that are "UnreachableByControlFlow". This means that in code blocks that are "ReachableForInspection", but "UnreachableByControlFlow" (such as `assert_never` branch in exhaustive match/case statement) there can appear false negatives (although in very rare specific situations). This solution is a bit hacky, but is the simplest way to combine old DFA analysis used by PyUnboundLocalVariableInspection with reachability analysis in PyDataFlow used by the type inference logic, as they tend to handle ASSERTTYPE:Never instructions differently. These kinds of problems can also arise for other inspections that disable themselves based on reachability (see PyUnresolvedReferencesVisitor, which does not report unresolved elements in unreachable code). The solution to these problem is subject to discussion and future fixes GitOrigin-RevId: cefd7c404712d214bd93b882a192c0d581f31514