1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-05-21 12:01:54 +02:00

52619 (plus tests): no empty element when appending array to unset scalar

This commit is contained in:
Bart Schaefer 2024-02-28 20:40:26 -08:00
parent 69c5887461
commit 85172998f4
3 changed files with 24 additions and 6 deletions

View file

@ -1,3 +1,8 @@
2024-02-28 Bart Schaefer <schaefer@zsh.org>
* 52619 (plus tests): Src/params.c, Test/A06assign.ztst: there
is no empty element when appending array to unset scalar
2024-02-28 Oliver Kiddle <opk@zsh.org>
* 52622 (tweaked, c.f. 52626): Src/jobs.c: adjust number of columns
@ -54,7 +59,7 @@ x2024-02-19 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp>
* 52544: Completion/Unix/Type/_diff_options: support macOS Ventura
or newer
2024-02-18 Bart Schaefer <schaefer@toltec-ubuntu>
2024-02-18 Bart Schaefer <schaefer@zsh.org>
* 52558: Etc/FAQ.yo: make note of word splitting differences
with nofork substitutions; update ToC; minor formatting fixes

View file

@ -3355,7 +3355,7 @@ assignaparam(char *s, char **val, int flags)
} else if (!(PM_TYPE(v->pm->node.flags) & (PM_ARRAY|PM_HASHED)) &&
!(v->pm->node.flags & (PM_SPECIAL|PM_TIED))) {
int uniq = v->pm->node.flags & PM_UNIQUE;
if (flags & ASSPM_AUGMENT) {
if ((flags & ASSPM_AUGMENT) && !(v->pm->node.flags & PM_UNSET)) {
/* insert old value at the beginning of the val array */
char **new;
int lv = arrlen(val);

View file

@ -296,13 +296,26 @@
# tests of var+=(array)
a=
a+=(1 2 3)
print "${(q@)a}"
0:add array to empty parameter
>'' 1 2 3
unset a
a+=(1 2 3)
print -l $a
print "${(q@)a}"
0:add array to unset parameter
>1
>2
>3
>1 2 3
() {
setopt localoptions typeset_to_unset
typeset a
a+=(1 2 3)
print "${(q@)a}"
}
0:add array to declared unset parameter
>1 2 3
a=(a)
a+=(b)