Skip to content

Commit

Permalink
patch 8.2.2750: Vim9: error for using underscore in nested function
Browse files Browse the repository at this point in the history
Problem:    Vim9: error for using underscore in nested function.
Solution:   Do not consider "_" already defined. (closes #8096)
  • Loading branch information
brammool committed Apr 10, 2021
1 parent fe95b94 commit da479c7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/testdir/test_vim9_func.vim
Expand Up @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -750,6 +750,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2750,
/**/
2749,
/**/
Expand Down
4 changes: 4 additions & 0 deletions src/vim9compile.c
Expand Up @@ -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)
Expand Down

0 comments on commit da479c7

Please sign in to comment.