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 6b353dd..a97146d 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -2637,6 +2637,8 @@
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 7785ac3..ed22375 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2750,
+/**/
2749,
/**/
2748,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index b005ff2..02c75c4 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -422,6 +422,10 @@
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)