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

Re: PATCH: Simplify resolve_nameref and setscope



On Sun, Jun 8, 2025 at 11:12 AM Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> There are some mechanical problems with this patch:
> - It omits a change on line 3132 of builtin.c (arguments to resolve_nameref).

((pm = (Param)paramtab->getnode(realparamtab, asg->value.scalar))

I think this should either be

((pm = (Param)paramtab->getnode(paramtab, asg->value.scalar))

or just a call to getparamnode() [which it can't be because that's
static to params.c]

In any case if I fix builtin.c:3132 and run "make check", I get

+ params.c:1076: BUG: local parameter is not unset
 inner: foo: attempt to assign array value to non-array
Test ./K01nameref.ztst failed: error output differs from expected as
shown above for:
 (
  inner() { local -n var="${1:?}"; var=(alpha beta gamma); }
  outer() { local foo=outer; inner foo; typeset -p foo; }
  foo=3 ; { outer foo } always { typeset -p foo }
 )
Was testing: up-reference part 11, assignment to enclosing scope, type mismatch




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