0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 8.2.1391: Vim9: no error for shadowing a script function

Problem:    Vim9: no error for shadowing a script function.
Solution:   Check for already defined items. (closes #6652)
This commit is contained in:
Bram Moolenaar
2020-08-07 22:00:26 +02:00
parent 1c199f9c70
commit fa211f3c6d
3 changed files with 16 additions and 0 deletions

View File

@@ -1780,6 +1780,18 @@ def Test_func_redefine_fails()
enddef enddef
END END
CheckScriptFailure(lines, 'E1073:') CheckScriptFailure(lines, 'E1073:')
lines =<< trim END
vim9script
def Foo(): string
return 'foo'
enddef
def Func()
let Foo = {-> 'lambda'}
enddef
defcompile
END
CheckScriptFailure(lines, 'E1073:')
enddef enddef
def Test_fixed_size_list() def Test_fixed_size_list()

View File

@@ -754,6 +754,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1391,
/**/ /**/
1390, 1390,
/**/ /**/

View File

@@ -5462,6 +5462,8 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
semsg(_(e_unknown_var), name); semsg(_(e_unknown_var), name);
goto theend; goto theend;
} }
else if (check_defined(var_start, varlen, cctx) == FAIL)
goto theend;
} }
} }