Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Never emit warning about valid nameref option




Example

typeset -nariu ref=var


Current output

Expected output

typeset: -a not allowed with -n

typeset: -i not allowed with -n

typeset: -u not allowed with -n

typeset: -r not allowed with -n

typeset: -a not allowed with -n

typeset: -i not allowed with -n


GitHub: Never emit warning about valid nameref option

Philippe

diff --git a/Src/builtin.c b/Src/builtin.c
index 9ddaad93e..707d56e70 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -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; */
 	    }
diff --git a/Test/K01nameref.ztst b/Test/K01nameref.ztst
index 5d229a94e..c0c8df660 100644
--- a/Test/K01nameref.ztst
+++ b/Test/K01nameref.ztst
@@ -1076,6 +1076,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


Messages sorted by: Reverse Date, Date, Thread, Author