mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
PY-1359 "Unassigned local variable" inspection doesn't handle empty loops correctly
This commit is contained in:
@@ -81,7 +81,8 @@ public class PyUnboundLocalVariableInspection extends PyInspection {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (PyAssignmentStatementNavigator.getStatementByTarget(element) != null) {
|
||||
if (PyAssignmentStatementNavigator.getStatementByTarget(element) != null ||
|
||||
PyForStatementNavigator.getPyForStatementByIterable(element) != null) {
|
||||
resolves2LocalVariable = true;
|
||||
resolve2Scope = PsiTreeUtil.isAncestor(owner, element, false);
|
||||
break;
|
||||
|
||||
@@ -10,4 +10,9 @@
|
||||
<line>14</line>
|
||||
<description>"Name 'b' can be not defined"</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>test.py</file>
|
||||
<line>51</line>
|
||||
<description>"Name 'i' can be not defined"</description>
|
||||
</problem>
|
||||
</problems>
|
||||
Reference in New Issue
Block a user