From b3637caa90e30a630fb7e677c54d5f0a1b27985d Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 25 Jan 2017 09:35:30 +0000 Subject: 40413: WARN_NESTED_VAR subscripted variable fix. No warning needed on paramter that's created temporarily to help assignment. --- ChangeLog | 5 +++++ Src/params.c | 6 +++++- Test/E01options.ztst | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a448b3256..8e22e9f4f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2017-01-25 Peter Stephenson + + * 40413: Src/params.c, Test/E01options.ztst: no WARN_NESTED_VAR + warning on bogus parameter created for subscripted assignment. + 2017-01-25 Daniel Shahaf * 40403/0004: Functions/VCS_Info/Backends/VCS_INFO_get_data_git, diff --git a/Src/params.c b/Src/params.c index ebdd25225..c38f2e001 100644 --- a/Src/params.c +++ b/Src/params.c @@ -2926,7 +2926,11 @@ assignsparam(char *s, char *val, int flags) unqueue_signals(); return NULL; } - flags &= ~ASSPM_WARN_CREATE; + /* + * Parameter defined here is a temporary bogus one. + * Don't warn about anything. + */ + flags &= ~ASSPM_WARN; } *ss = '['; v = NULL; diff --git a/Test/E01options.ztst b/Test/E01options.ztst index bcd89f787..fd3263a8f 100644 --- a/Test/E01options.ztst +++ b/Test/E01options.ztst @@ -1188,6 +1188,21 @@ ?fn_wnv:20: numeric parameter foo5 set in enclosing scope in function fn_wnv ?all off again + + ( + setopt warnnestedvar + () { + typeset -A a + : ${a[hello world]::=foo} + print ${(t)a} + key="hello world" + print $a[$key] + } + ) +0:No false positive on parameter used with subscripted assignment +>association-local +>foo + # This really just tests if XTRACE is egregiously broken. # To test it properly would need a full set of its own. fn() { print message; } -- cgit v1.3.1