mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-11109 Incorrect "Instance attribute defined outside __init__" in local classes
This commit is contained in:
@@ -951,6 +951,9 @@ public class PyClassImpl extends PyPresentableElementImpl<PyClassStub> implement
|
||||
final List<PyTargetExpression> result = new ArrayList<PyTargetExpression>();
|
||||
if (statementList != null) {
|
||||
statementList.accept(new PyRecursiveElementVisitor() {
|
||||
@Override
|
||||
public void visitPyClass(PyClass node) {}
|
||||
|
||||
public void visitPyAssignmentStatement(final PyAssignmentStatement node) {
|
||||
for (PyExpression expression : node.getTargets()) {
|
||||
if (expression instanceof PyTargetExpression) {
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
__author__ = 'ktisha'
|
||||
|
||||
|
||||
class A:
|
||||
def foo(self):
|
||||
class B:
|
||||
def __init__(self):
|
||||
self.x = 1
|
||||
+4
@@ -58,6 +58,10 @@ public class PyAttributeOutsideInitInspectionTest extends PyTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testInnerClass() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
myFixture.configureByFile("inspections/PyAttributeOutsideInitInspection/" + getTestName(true) + ".py");
|
||||
myFixture.enableInspections(PyAttributeOutsideInitInspection.class);
|
||||
|
||||
Reference in New Issue
Block a user