Simplify a check in CompatibilityVisitor

GitOrigin-RevId: 14bc99af4e89c443bba2f8569fdfad0053459fe4
This commit is contained in:
Mikhail Golubev
2022-05-02 15:26:54 +00:00
committed by intellij-monorepo-bot
parent bdb243bb58
commit c6a15fa65b
@@ -7,6 +7,7 @@ import com.intellij.codeInspection.ProblemDescriptor;
import com.intellij.codeInspection.util.InspectionMessage;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.TextRange;
@@ -330,10 +331,10 @@ public abstract class CompatibilityVisitor extends PyAnnotator {
super.visitPyPrintStatement(node);
final PsiElement[] arguments = node.getChildren();
final Predicate<PsiElement> nonParenthesesPredicate =
final Condition<PsiElement> nonParenthesesPredicate =
element -> !(element instanceof PyParenthesizedExpression || element instanceof PyTupleExpression);
if (arguments.length == 0 || Arrays.stream(arguments).anyMatch(nonParenthesesPredicate)) {
if (arguments.length == 0 || ContainerUtil.exists(arguments, nonParenthesesPredicate)) {
registerForAllMatchingVersions(level -> level.isPy3K() && registerForLanguageLevel(level),
PyPsiBundle.message("INSP.compatibility.feature.support.print.statement"),
node,