1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-11-24 01:50:54 +01:00

51437: Fix incorrectly-passed test case, masked by unrelated bug.

A bug with zmodload when unloading/reloading a static module caused the
state of the shell options to change during K01 test.  Worked around it.
Also changed warnnestedvar messages to look more like other such.
This commit is contained in:
Bart Schaefer 2023-02-14 17:54:42 -08:00
parent 7e0c4406ce
commit 32cceefa95
3 changed files with 29 additions and 4 deletions

View file

@ -3068,7 +3068,7 @@ check_warn_pm(Param pm, const char *pmtype, int created,
} else
return;
if (pm->node.flags & PM_SPECIAL)
if (pm->node.flags & (PM_SPECIAL|PM_NAMEREF))
return;
for (i = funcstack; i; i = i->prev) {
@ -6181,6 +6181,7 @@ setloopvar(char *name, char *value)
if (pm && (pm->node.flags & PM_NAMEREF)) {
pm->base = pm->width = 0;
pm->u.str = ztrdup(value);
pm->node.flags &= ~PM_UNSET;
pm->node.flags |= PM_NEWREF;
setscope(pm);
pm->node.flags &= ~PM_NEWREF;
@ -6248,7 +6249,7 @@ setscope(Param pm)
pm->node.nam);
unsetparam_pm(pm, 0, 1);
} else if (isset(WARNNESTEDVAR))
zwarn("%s: global reference to local variable: %s",
zwarn("reference %s in enclosing scope set to local variable %s",
pm->node.nam, pm->u.str);
}
if (pm->u.str && upscope(pm, pm->base) == pm &&