mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fixed PY-10420 False positive in redundant parentheses inspection with yield
This commit is contained in:
@@ -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
|
||||
+4
@@ -60,4 +60,8 @@ public class PyRedundantParenthesesInspectionTest extends PyTestCase {
|
||||
doTest(LanguageLevel.PYTHON33);
|
||||
}
|
||||
|
||||
public void testYield() { //PY-10420
|
||||
doTest(LanguageLevel.PYTHON27);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user