@Override
  public boolean canBePromotedTo(XPathType type) {
    while (type instanceof XPath2SequenceType) {
      type = ((XPath2SequenceType)type).getType();
    }
    if (this == ITEM || NODE.isAssignableFrom(this) || (this == ANYATOMICTYPE && ANYATOMICTYPE.isAssignableFrom(type))) return true;

    if (FLOAT.isAssignableFrom(this) && type == DOUBLE) return true;
    if (DECIMAL.isAssignableFrom(this) && (type == DOUBLE || type == FLOAT)) return true;
    if (INTEGER.isAssignableFrom(this) && (type == DOUBLE || type == FLOAT || type == INTEGER || type == DECIMAL)) return true;

    if (ANYURI.isAssignableFrom(this) && type == STRING) return true;

    // effective boolean value
    if (ANYURI.isAssignableFrom(this) && type == BOOLEAN) return true;
    if (STRING.isAssignableFrom(this) && type == BOOLEAN) return true;
    if (NUMERIC.isAssignableFrom(this) && type == BOOLEAN) return true;
    if (this == UNTYPEDATOMIC && type == BOOLEAN) return true;

    // function parameters do not use eff. boolean value, type must strictly match
    if (this == BOOLEAN && type == BOOLEAN_STRICT) return true;

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