@Override
  @NotNull
  public XPathType getType() {
    if (getNode().getElementType() == XPath2ElementTypes.CONTEXT_ITEM) {
      final XPathPredicate predicate = PsiTreeUtil.getParentOfType(this, XPathPredicate.class);
      if (predicate != null) {
        final PsiElement filter = predicate.getParent();
        if (filter instanceof XPathFilterExpression) {
          final XPathExpression expression = ((XPathFilterExpression)filter).getExpression();
          if (expression != null) {
            final XPathType type = expression.getType();
            return (type instanceof XPath2SequenceType ? ((XPath2SequenceType)type).getType() : type);
          }
        }
      }
      return XPath2Type.SEQUENCE;
    }

    final XPathExpression step = getStep();
    if (step != null) {
      return step.getType();
    }
    return XPathType.NODESET;
  }
@Override
  @NotNull
  public XPathType getType()