private static boolean isSameType(XPathExpression expression, XPathType convertedType) {
        XPathType type = ExpectedTypeUtil.mapType(expression, expression.getType());
        while (type instanceof XPath2SequenceType) {
          type = ((XPath2SequenceType)type).getType();
        }
        while (convertedType instanceof XPath2SequenceType) {
          convertedType = ((XPath2SequenceType)convertedType).getType();
        }
        return ExpectedTypeUtil.mapType(expression, convertedType) == type;
      }
private static boolean isSameType(XPathExpression expression, XPathType convertedType)