@Override
  public boolean isAssignableFrom(@NotNull XPathType type) {
    if (type instanceof XPath2SequenceType) {
      type = ((XPath2SequenceType)type).getType();
    }
    if (type instanceof XPath2Type) {
      if (this.equals(type)) {
        return true;
      } else {
        XPathType t = ((XPath2Type)type).getSuperType();
        while (t != null) {
          if (t.equals(this)) return true;
          if (!(t instanceof XPath2Type)) {
            break;
          }
          t = ((XPath2Type)t).getSuperType();
        }
      }
    }

    return false;
  }
@Override
  public boolean isAssignableFrom(@NotNull XPathType type)