diff --git a/python/src/com/jetbrains/python/psi/impl/PyAssignmentStatementImpl.java b/python/src/com/jetbrains/python/psi/impl/PyAssignmentStatementImpl.java index 18bb6fc6f60e..75f9b08225dc 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyAssignmentStatementImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyAssignmentStatementImpl.java @@ -58,7 +58,9 @@ public class PyAssignmentStatementImpl extends PyElementImpl implements PyAssign List candidates = PyUtil.flattenedParens(psi_nodes); // put all possible tuples to one level List targets = new ArrayList(); for (PyExpression expr : candidates) { // only filter out targets - if (expr instanceof PyTargetExpression || expr instanceof PySubscriptionExpression) { + if (expr instanceof PyTargetExpression || + expr instanceof PyReferenceExpression || + expr instanceof PySubscriptionExpression) { targets.add(expr); } } diff --git a/python/testData/codeInsight/controlflow/assignment2.py b/python/testData/codeInsight/controlflow/assignment2.py new file mode 100644 index 000000000000..c6fa955206d7 --- /dev/null +++ b/python/testData/codeInsight/controlflow/assignment2.py @@ -0,0 +1,3 @@ +sibling = [] +if sibling: + sibling[0].text = 123 \ No newline at end of file diff --git a/python/testData/codeInsight/controlflow/assignment2.txt b/python/testData/codeInsight/controlflow/assignment2.txt new file mode 100644 index 000000000000..75934ecfe967 --- /dev/null +++ b/python/testData/codeInsight/controlflow/assignment2.txt @@ -0,0 +1,11 @@ +0(1) element: null +1(2) element: PyAssignmentStatement +2(3) WRITE ACCESS: sibling +3(4) element: PyIfStatement +4(5,10) READ ACCESS: sibling +5(6) element: PyStatementList. Condition: sibling:true +6(7) element: PyAssignmentStatement +7(8) element: PySubscriptionExpression +8(9) READ ACCESS: sibling +9(10) READ ACCESS: text +10() element: null \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/PyControlFlowBuilderTest.java b/python/testSrc/com/jetbrains/python/PyControlFlowBuilderTest.java index 836106768336..d4680a981267 100644 --- a/python/testSrc/com/jetbrains/python/PyControlFlowBuilderTest.java +++ b/python/testSrc/com/jetbrains/python/PyControlFlowBuilderTest.java @@ -74,6 +74,10 @@ public class PyControlFlowBuilderTest extends LightMarkedTestCase { doTest(); } + public void testAssignment2() throws Exception { + doTest(); + } + public void testAugAssignment() throws Exception { doTest(); }