Branch: Tag:

2020-03-19

2020-03-19 16:17:08 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Operators: `|() now supports UNDEFINED with multisets.

Fixes #10021.

2827:    }    } else {    int args = 2; +  +  if ((TYPEOF(Pike_sp[-1]) == PIKE_T_INT) && +  (SUBTYPEOF(Pike_sp[-1]) == NUMBER_UNDEFINED)) { +  if (TYPEOF(Pike_sp[-2]) == PIKE_T_MULTISET) { +  struct multiset *l = copy_multiset(Pike_sp[-2].u.multiset); +  pop_stack(); +  pop_stack(); +  push_multiset(l); +  return; +  } +  } else if ((TYPEOF(Pike_sp[-2]) == PIKE_T_INT) && +  (SUBTYPEOF(Pike_sp[-2]) == NUMBER_UNDEFINED)) { +  if (TYPEOF(Pike_sp[-1]) == PIKE_T_MULTISET) { +  struct multiset *l = copy_multiset(Pike_sp[-1].u.multiset); +  pop_stack(); +  pop_stack(); +  push_multiset(l); +  return; +  } +  } +     SIMPLE_ARG_TYPE_ERROR("`|", 2, get_name_of_type(TYPEOF(Pike_sp[-2])));    }    }
2973:    *! @mixed arg1    *! @type int    *! Bitwise or of @[arg1] and @[arg2]. +  *! @type zero +  *! @[UNDEFINED] may be or:ed with multisets, behaving as if +  *! it was an empty multiset.    *! @type string    *! The result is a string where each character is the bitwise    *! or of the characters in the same position in @[arg1] and
2994:    *! and @[`==]) occur in both, the value from @[arg2] is used.    *! @type multiset    *! The result is like @[arg1] but extended with the entries in -  *! @[arg2] that doesn't already occur in @[arg1] (according to +  *! @[arg2] that don't already occur in @[arg1] (according to    *! @[`>], @[`<] and @[`==]). Subsequences with orderwise equal    *! entries (i.e. where @[`<] returns false) are handled just    *! like the array case above.
3009:    *! which implement @[lfun::`==()] but @b{not@} @[lfun::`>()] and    *! @[lfun::`<()], the result will be undefined.    *! +  *! The treatment of @[UNDEFINED] with multisets was new in Pike 8.1. +  *!    *! @seealso    *! @[`&()], @[lfun::`|()], @[lfun::``|()]    */