To: vim_dev@googlegroups.com Subject: Patch 8.2.1351 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1351 Problem: Vim9: no proper error if using namespace for nested function. Solution: Specifically check for a namespace. (closes #6582) Files: src/vim9compile.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.1350/src/vim9compile.c 2020-08-01 22:16:39.724599474 +0200 --- src/vim9compile.c 2020-08-01 22:31:35.170168079 +0200 *************** *** 4899,4910 **** { int is_global = *eap->arg == 'g' && eap->arg[1] == ':'; char_u *name_start = eap->arg; ! char_u *name_end = to_name_end(eap->arg, is_global); char_u *lambda_name; lvar_T *lvar; ufunc_T *ufunc; int r; if (check_defined(name_start, name_end - name_start, cctx) == FAIL) return NULL; --- 4899,4916 ---- { int is_global = *eap->arg == 'g' && eap->arg[1] == ':'; char_u *name_start = eap->arg; ! char_u *name_end = to_name_end(eap->arg, TRUE); char_u *lambda_name; lvar_T *lvar; ufunc_T *ufunc; int r; + // Only g:Func() can use a namespace. + if (name_start[1] == ':' && !is_global) + { + semsg(_(e_namespace), name_start); + return NULL; + } if (check_defined(name_start, name_end - name_start, cctx) == FAIL) return NULL; *** ../vim-8.2.1350/src/testdir/test_vim9_func.vim 2020-08-01 18:57:49.277422206 +0200 --- src/testdir/test_vim9_func.vim 2020-08-01 22:34:32.817525781 +0200 *************** *** 131,136 **** --- 131,138 ---- CheckDefFailure(['def Nested(arg: string)', 'enddef', 'Nested()'], 'E119:') CheckDefFailure(['func Nested()', 'endfunc'], 'E1086:') + CheckDefFailure(['def s:Nested()', 'enddef'], 'E1075:') + CheckDefFailure(['def b:Nested()', 'enddef'], 'E1075:') enddef func Test_call_default_args_from_func() *** ../vim-8.2.1350/src/version.c 2020-08-01 22:23:17.387734905 +0200 --- src/version.c 2020-08-01 22:34:57.917432884 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1351, /**/ -- hundred-and-one symptoms of being an internet addict: 105. When someone asks you for your address, you tell them your URL. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///