From bbe17ef42133f1c2dfcbf909a3945911bcb38789 Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Mon, 21 Mar 2011 18:46:28 +0100 Subject: [PATCH] statement effect inspection adjusted for tuples (PY-3143) --- .../python/inspections/PyStatementEffectInspection.java | 8 ++++++++ .../inspections/PyStatementEffectInspection/test.py | 2 ++ 2 files changed, 10 insertions(+) diff --git a/python/src/com/jetbrains/python/inspections/PyStatementEffectInspection.java b/python/src/com/jetbrains/python/inspections/PyStatementEffectInspection.java index d3a93503ac46..8a06bbba7e16 100644 --- a/python/src/com/jetbrains/python/inspections/PyStatementEffectInspection.java +++ b/python/src/com/jetbrains/python/inspections/PyStatementEffectInspection.java @@ -128,6 +128,14 @@ public class PyStatementEffectInspection extends PyInspection { } } } + else if (expression instanceof PyTupleExpression) { + PyExpression[] elements = ((PyTupleExpression)expression).getElements(); + for (PyExpression element : elements) { + if (hasEffect(element)) { + return true; + } + } + } return false; } } diff --git a/python/testData/inspections/PyStatementEffectInspection/test.py b/python/testData/inspections/PyStatementEffectInspection/test.py index 8842c40e6e84..af9464037762 100644 --- a/python/testData/inspections/PyStatementEffectInspection/test.py +++ b/python/testData/inspections/PyStatementEffectInspection/test.py @@ -20,3 +20,5 @@ cout << "Hello, world" # must not be reported len(x) if True else len(y) (foo()) + +foo(),