54122: avoid warnings for valid nameref options

This commit is contained in:
Philippe Altherr
2026-02-16 16:05:39 -08:00
committed by Bart Schaefer
parent f6bf286da7
commit 7f1dec0bae
3 changed files with 9 additions and 1 deletions

View File

@@ -1,5 +1,8 @@
2026-02-16 Bart Schaefer <schaefer@zsh.org>
* Philippe: 54122: Src/builtin.c, Test/K01nameref.ztst: avoid
warnings for valid nameref options
* Philippe: 54063: Src/Modules/param_private.c, Src/builtin.c,
Src/params.c, Src/zsh.h, Test/K01nameref.ztst: Simplifications
for resolve_nameref() and setscope()

View File

@@ -2713,7 +2713,7 @@ bin_typeset(char *name, char **argv, LinkList assigns, Options ops, int func)
else
continue;
if (OPT_MINUS(ops,'n')) {
if ((on|off) & ~(PM_READONLY|PM_UPPER|PM_HIDEVAL)) {
if (bit & ~(PM_READONLY|PM_UPPER|PM_HIDEVAL)) {
zwarnnam(name, "-%c not allowed with -n", optval);
/* return 1; */
}

View File

@@ -1084,6 +1084,11 @@ F:previously this could create an infinite recursion and crash
1:create nameref by pattern match not allowed
*?*typeset:1: -m not allowed with -n
typeset -nariu ref=var
1:regression: warn about invalid nameref options but never about valid ones
*?*typeset:1: -a not allowed with -n
*?*typeset:1: -i not allowed with -n
e -u 0
0:assignment at different scope than declaration, -u 0
>g:1: rs=f - ra=f - rs1=f - ra1=f