mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Fixed unbound variable inspection for unreachable code (PY-6114)
This commit is contained in:
@@ -123,6 +123,9 @@ public class PyUnboundLocalVariableInspection extends PyInspection {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (PyUnreachableCodeInspection.isUnreachable(node)) {
|
||||
return;
|
||||
}
|
||||
if (owner instanceof PyFile) {
|
||||
if (isBuiltin) {
|
||||
return;
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
def test1(c, xs):
|
||||
if c:
|
||||
y = 1
|
||||
print(<warning descr="Local variable 'y' might be referenced before assignment">y</warning>)
|
||||
for x in xs:
|
||||
continue
|
||||
z = 1
|
||||
+5
@@ -173,6 +173,11 @@ public class PyUnboundLocalVariableInspectionTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// PY-6114
|
||||
public void testUnboundUnreachable() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
myFixture.configureByFile(TEST_DIRECTORY + getTestName(false) + ".py");
|
||||
myFixture.enableInspections(PyUnboundLocalVariableInspection.class);
|
||||
|
||||
Reference in New Issue
Block a user