void (@NotNull PyBinaryExpression node) { final PyExpression lhs = node.getLeftExpression(); final PyExpression rhs = node.getRightExpression(); if (lhs instanceof PyReferenceExpression && rhs instanceof PyReferenceExpression || lhs instanceof PyReferenceExpression && rhs instanceof PyNoneLiteralExpression || lhs instanceof PyNoneLiteralExpression && rhs instanceof PyReferenceExpression) { final boolean leftIsNone = lhs instanceof PyNoneLiteralExpression || PyNames.NONE.equals(lhs.getName()); final boolean rightIsNone = rhs instanceof PyNoneLiteralExpression || PyNames.NONE.equals(rhs.getName()); if (leftIsNone ^ rightIsNone) { final PyReferenceExpression target = (PyReferenceExpression)(rightIsNone ? lhs : rhs); if (node.isOperator(PyNames.IS)) { pushAssertion(target, myPositive, false, context -> PyNoneType.INSTANCE, null); return; } if (node.isOperator("isnot")) { pushAssertion(target, !myPositive, false, context -> PyNoneType.INSTANCE, null); return; } } } final Object leftValue = PyEvaluator.evaluateNoResolve(lhs, Object.class); final Object rightValue = PyEvaluator.evaluateNoResolve(rhs, Object.class); if (leftValue instanceof Boolean && rightValue instanceof Boolean) { return; } if (node.isOperator(PyNames.IS) && (leftValue == Boolean.FALSE || rightValue == Boolean.FALSE) || node.isOperator("isnot") && (leftValue == Boolean.TRUE || rightValue == Boolean.TRUE)) { myPositive = !myPositive; super.visitPyBinaryExpression(node); myPositive = !myPositive; return; } super.visitPyBinaryExpression(node); }