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

Re: PATCH: Disallow array initializer for named reference



With that patch, I get this:

$ typeset -n ref=(var1 var2)
typeset: -a not allowed with -n

which is a bit confusing as there is no -a. When I do the same with -i, I get the following error:

$ typeset -i int=(123 456)  
typeset: int: inconsistent type for assignment

If I replace your zwarnnam with the zerrnam used for -i

-  zwarnnam(name, "-a not allowed with -n");
+  zerrnam(name, "%s: inconsistent type for assignment", asg->name);

then I get a similar error message which looks more appropriate:

$ typeset -n ref=(var1 var2)
typeset: ref: inconsistent type for assignment

and combining explicitly -n with -a still generates the previous message:

$ typeset -na ref=(var1 var2)
typeset: -a not allowed with -n

Philippe


On Tue, Jun 10, 2025 at 4:41 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
On Mon, Jun 9, 2025 at 12:17 PM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> I overlooked that using the paren syntax skips past setting the -a
> option.  Patch later.


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