From: Bram Moolenaar Date: Sat, 10 Apr 2021 19:01:38 +0000 (+0200) Subject: patch 8.2.2750: Vim9: error for using underscore in nested function X-Git-Tag: v8.2.2750 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=da479c7597a61c4d50c842df21c9294bd9bf1037;p=vim patch 8.2.2750: Vim9: error for using underscore in nested function Problem: Vim9: error for using underscore in nested function. Solution: Do not consider "_" already defined. (closes #8096) --- diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index 6b353dd69..a97146d45 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -2637,6 +2637,8 @@ def Test_ignored_argument() return _ endfunc assert_equal('too', Oktoo()) + + assert_equal([[1], [2], [3]], range(3)->mapnew((_, v) => [v]->map((_, w) => w + 1))) END CheckScriptSuccess(lines) diff --git a/src/version.c b/src/version.c index 7785ac37c..ed2237532 100644 --- a/src/version.c +++ b/src/version.c @@ -750,6 +750,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2750, /**/ 2749, /**/ diff --git a/src/vim9compile.c b/src/vim9compile.c index b005ff236..02c75c4d6 100644 --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -422,6 +422,10 @@ check_defined(char_u *p, size_t len, cctx_T *cctx, int is_arg) int c = p[len]; ufunc_T *ufunc = NULL; + // underscore argument is OK + if (len == 1 && *p == '_') + return OK; + if (script_var_exists(p, len, cctx) == OK) { if (is_arg)