# HG changeset patch # User Bram Moolenaar # Date 1618082104 -7200 # Node ID e0fa539a9b349f55e17b29080d28ffbdc2334d6d # Parent 05c9ccb777ecddc17d93d68a3be7163532ad01df patch 8.2.2750: Vim9: error for using underscore in nested function Commit: https://github.com/vim/vim/commit/da479c7597a61c4d50c842df21c9294bd9bf1037 Author: Bram Moolenaar Date: Sat Apr 10 21:01:38 2021 +0200 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 https://github.com/vim/vim/issues/8096) diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim --- 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 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2750, +/**/ 2749, /**/ 2748, diff --git a/src/vim9compile.c b/src/vim9compile.c --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -422,6 +422,10 @@ check_defined(char_u *p, size_t len, cct 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)