To: vim_dev@googlegroups.com Subject: Patch 8.2.1657 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1657 Problem: Vim9: no proper error for nested ":def!". Solution: Check for "!". (closes #6920) Files: src/errors.h, src/vim9compile.c, src/testdir/test_vim9_func.vim *** ../vim-8.2.1656/src/errors.h 2020-09-06 22:26:53.418275627 +0200 --- src/errors.h 2020-09-10 22:19:13.290772554 +0200 *************** *** 256,259 **** --- 256,261 ---- INIT(= N_("E1115: assert_fails() fourth argument must be a number")); EXTERN char e_assert_fails_fifth_argument[] INIT(= N_("E1116: assert_fails() fifth argument must be a string")); + EXTERN char e_cannot_use_bang_with_nested_def[] + INIT(= N_("E1117: Cannot use ! with nested :def")); #endif *** ../vim-8.2.1656/src/vim9compile.c 2020-09-09 20:03:42.908661678 +0200 --- src/vim9compile.c 2020-09-10 22:19:08.086789166 +0200 *************** *** 4320,4325 **** --- 4320,4331 ---- ufunc_T *ufunc; int r; + if (*name_start == '!') + { + emsg(_(e_cannot_use_bang_with_nested_def)); + return NULL; + } + // Only g:Func() can use a namespace. if (name_start[1] == ':' && !is_global) { *** ../vim-8.2.1656/src/testdir/test_vim9_func.vim 2020-09-10 22:05:05.157479076 +0200 --- src/testdir/test_vim9_func.vim 2020-09-10 22:27:19.409217452 +0200 *************** *** 134,139 **** --- 134,156 ---- CheckDefFailure(['func Nested()', 'endfunc'], 'E1086:') CheckDefFailure(['def s:Nested()', 'enddef'], 'E1075:') CheckDefFailure(['def b:Nested()', 'enddef'], 'E1075:') + + CheckDefFailure([ + 'def Outer()', + ' def Inner()', + ' # comment', + ' enddef', + ' def Inner()', + ' enddef', + 'enddef'], 'E1073:') + CheckDefFailure([ + 'def Outer()', + ' def Inner()', + ' # comment', + ' enddef', + ' def! Inner()', + ' enddef', + 'enddef'], 'E1117:') enddef func Test_call_default_args_from_func() *** ../vim-8.2.1656/src/version.c 2020-09-10 22:05:05.157479076 +0200 --- src/version.c 2020-09-10 22:20:25.106543267 +0200 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 1657, /**/ -- I bought a book on hair loss, but the pages kept falling out. /// 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 ///