fixed PY-10420 False positive in redundant parentheses inspection with yield

This commit is contained in:
Ekaterina Tuzova
2013-07-30 19:31:13 +04:00
parent 87bb05bbf8
commit 95df6dc74c
3 changed files with 8 additions and 1 deletions
@@ -57,7 +57,7 @@ public class PyRedundantParenthesesInspection extends PyInspection {
PyExpression expression = node.getContainedExpression();
if (node.getText().contains("\n")) return;
PyYieldExpression yieldExpression = PsiTreeUtil.getParentOfType(expression, PyYieldExpression.class, false);
if (yieldExpression != null && yieldExpression.isDelegating()) return;
if (yieldExpression != null) return;
if (expression instanceof PyReferenceExpression || expression instanceof PyLiteralExpression) {
if (myIgnorePercOperator) {
PsiElement parent = node.getParent();
@@ -0,0 +1,3 @@
def foo():
if (yield 1):
pass
@@ -60,4 +60,8 @@ public class PyRedundantParenthesesInspectionTest extends PyTestCase {
doTest(LanguageLevel.PYTHON33);
}
public void testYield() { //PY-10420
doTest(LanguageLevel.PYTHON27);
}
}