@Override
    public void visitXPathBinaryExpression(XPathBinaryExpression parent) {
      if (myExpression == parent.getROperand()) {
        final XPathElementType op = parent.getOperator();
        final XPathExpression lop = parent.getLOperand();
        if (op == XPathTokenTypes.AND || op == XPathTokenTypes.OR) {
          myExpectedType = XPathType.BOOLEAN;
        } else if (XPath2TokenTypes.NUMBER_OPERATIONS.contains(op)) {
          if (isXPath1(myExpression)) {
            myExpectedType = XPathType.NUMBER;
          } else {
            myExpectedType = matchingType(lop, op);
          }
        } else if (XPath2TokenTypes.COMP_OPS.contains(op)) {
          if (lop != null && lop.getType() != XPathType.NODESET) {
            if ((myExpectedType = lop.getType()) == XPathType.BOOLEAN) {
              if (!isXPath1(myExpression)) myExpectedType = XPath2Type.BOOLEAN_STRICT;
            } else if (myExpectedType == XPath2Type.BOOLEAN) {
              myExpectedType = XPath2Type.BOOLEAN_STRICT;
            }
          } else {
            myExpectedType = XPathType.UNKNOWN;
          }
        } else if (XPath2TokenTypes.INTERSECT_EXCEPT.contains(op)) {
          myExpectedType = XPath2SequenceType.create(XPath2Type.NODE, XPath2SequenceType.Cardinality.ZERO_OR_MORE);
        } else if (op == XPath2TokenTypes.TO) {
          myExpectedType = XPath2Type.INTEGER;
        } else {
          myExpectedType = XPathType.UNKNOWN;
        }
      } else {
        super.visitXPathBinaryExpression(parent);
      }
    }
@Override
    public void visitXPathBinaryExpression(XPathBinaryExpression parent)