diff options
| author | dana <dana@dana.is> | 2025-05-24 20:12:22 -0500 |
|---|---|---|
| committer | dana <dana@dana.is> | 2026-05-23 22:58:44 -0500 |
| commit | ea8a4c1582adecc3938defc40f005db1c490063f (patch) | |
| tree | c8340fe1be8c6ac3d43341684d261b1a3d8cc6c1 | |
| parent | 54591: fix new compiler warnings (diff) | |
| download | zsh-ea8a4c1582adecc3938defc40f005db1c490063f.tar zsh-ea8a4c1582adecc3938defc40f005db1c490063f.tar.gz zsh-ea8a4c1582adecc3938defc40f005db1c490063f.tar.bz2 zsh-ea8a4c1582adecc3938defc40f005db1c490063f.tar.lz zsh-ea8a4c1582adecc3938defc40f005db1c490063f.tar.xz zsh-ea8a4c1582adecc3938defc40f005db1c490063f.tar.zst zsh-ea8a4c1582adecc3938defc40f005db1c490063f.zip | |
message was inaccurate when an array was given by name
| -rw-r--r-- | ChangeLog | 3 | ||||
| -rw-r--r-- | Src/builtin.c | 2 | ||||
| -rw-r--r-- | Test/B08shift.ztst | 18 |
3 files changed, 22 insertions, 1 deletions
@@ -1,5 +1,8 @@ 2026-05-23 dana <dana@dana.is> + * unposted: Src/builtin.c, Test/B08shift.ztst: shift: improve + count error message + * 54591: Src/Modules/termcap.c, Src/Modules/terminfo.c, Src/jobs.c: fix new compiler warnings diff --git a/Src/builtin.c b/Src/builtin.c index 864b9d70f..cf27c5d63 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -5615,7 +5615,7 @@ bin_shift(char *name, char **argv, Options ops, UNUSED(int func)) for (; *argv; argv++) if ((s = getaparam(*argv))) { if (arrlen_lt(s, num)) { - zwarnnam(name, "shift count must be <= $#"); + zwarnnam(name, "shift count must be <= ${#%s}", *argv); ret++; continue; } diff --git a/Test/B08shift.ztst b/Test/B08shift.ztst index 0aa922673..a01128e4f 100644 --- a/Test/B08shift.ztst +++ b/Test/B08shift.ztst @@ -31,3 +31,21 @@ >mether pip azer sezar akker conter dick >mether pip azer sezar >mether pip azer + + () { local -a arr=( a b c ); shift 9 arr } + () { local -a .tmp.arr=( a b c ); shift 9 .tmp.arr } + () { shift 9 argv } a b c + () { shift 9 } a b c +1:shifting more elements than exist in array +?(anon):shift: shift count must be <= ${#arr} +?(anon):shift: shift count must be <= ${#.tmp.arr} +?(anon):shift: shift count must be <= ${#argv} +?(anon):shift: shift count must be <= $# + + () { local -i i=3; shift 9 i; print -r - $i } + () { local s=x; shift 9 s; print -r - $s } + () { local -A h=( a b ); shift 9 h; print -r - ${(kv)h} } +0:shifting non-array +>3 +>x +>a b |
