# HG changeset patch # User Bram Moolenaar # Date 1642707904 -3600 # Node ID 24da57a079efa7d8121ea9015590686d8bb35c1a # Parent c97e40973b62b7effb146ac2af54f6425bae8ae1 patch 8.2.4163: no error for omitting function name after autoload prefix Commit: https://github.com/vim/vim/commit/2017d6f3b1d523204e5471e941cfa687b4da0058 Author: Bram Moolenaar Date: Thu Jan 20 19:38:46 2022 +0000 patch 8.2.4163: no error for omitting function name after autoload prefix Problem: No error for omitting function name after autoload prefix. Solution: Check for missing function name. (issue https://github.com/vim/vim/issues/9577) diff --git a/src/testdir/test_vim9_import.vim b/src/testdir/test_vim9_import.vim --- a/src/testdir/test_vim9_import.vim +++ b/src/testdir/test_vim9_import.vim @@ -1514,6 +1514,21 @@ def Test_vim9script_autoload_duplicate() delete('Xdir', 'rf') enddef +def Test_autoload_missing_function_name() + mkdir('Xdir/autoload', 'p') + + var lines =<< trim END + vim9script + + def loadme#() + enddef + END + writefile(lines, 'Xdir/autoload/loadme.vim') + assert_fails('source Xdir/autoload/loadme.vim', 'E129:') + + delete('Xdir', 'rf') +enddef + def Test_import_autoload_postponed() mkdir('Xdir/autoload', 'p') var save_rtp = &rtp diff --git a/src/userfunc.c b/src/userfunc.c --- a/src/userfunc.c +++ b/src/userfunc.c @@ -3693,7 +3693,8 @@ trans_function_name( // Note that TFN_ flags use the same values as GLV_ flags. end = get_lval(start, NULL, &lv, FALSE, skip, flags | GLV_READ_ONLY, lead > 2 ? 0 : FNE_CHECK_START); - if (end == start) + if (end == start + || (end != NULL && end[-1] == AUTOLOAD_CHAR && *end == '(')) { if (!skip) emsg(_(e_function_name_required)); diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4163, +/**/ 4162, /**/ 4161,