Patch 8.2.4163

16 views
Skip to first unread message

Bram Moolenaar

unread,
Jan 20, 2022, 2:39:28 PM1/20/22
to vim...@googlegroups.com

Patch 8.2.4163
Problem: No error for omitting function name after autoload prefix.
Solution: Check for missing function name. (issue #9577)
Files: src/userfunc.c, src/testdir/test_vim9_import.vim


*** ../vim-8.2.4162/src/userfunc.c 2022-01-20 19:10:20.498583720 +0000
--- src/userfunc.c 2022-01-20 19:36:38.222320264 +0000
***************
*** 3693,3699 ****
// 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 (!skip)
emsg(_(e_function_name_required));
--- 3693,3700 ----
// 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
! || (end != NULL && end[-1] == AUTOLOAD_CHAR && *end == '('))
{
if (!skip)
emsg(_(e_function_name_required));
*** ../vim-8.2.4162/src/testdir/test_vim9_import.vim 2022-01-20 19:10:20.498583720 +0000
--- src/testdir/test_vim9_import.vim 2022-01-20 19:31:38.064299582 +0000
***************
*** 1514,1519 ****
--- 1514,1534 ----
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
*** ../vim-8.2.4162/src/version.c 2022-01-20 19:10:20.498583720 +0000
--- src/version.c 2022-01-20 19:37:30.921272589 +0000
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 4163,
/**/

--
TALL KNIGHT: When you have found the shrubbery, then you must cut down the
mightiest tree in the forest ... with a herring.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Dominique Pellé

unread,
Jan 20, 2022, 5:30:31 PM1/20/22
to vim_dev
On Thu, Jan 20, 2022 at 8:39 PM Bram Moolenaar wrote:

> Patch 8.2.4163
> Problem: No error for omitting function name after autoload prefix.
> Solution: Check for missing function name. (issue #9577)
> Files: src/userfunc.c, src/testdir/test_vim9_import.vim

This patch broke my configuration: vim-8.2.4162 was fine,
but starting at vim-8.2.4163, I get errors like these when I start vim:

((HEAD detached at v8.2.4163))pel@pel-cirrus7:~/sb/vim/src$ ./vim
Error detected while processing
/home/pel/.vimrc[7]../home/pel/.vim/autoload/plug.vim:
line 619:
E129: Function name required
line 620:
E121: Undefined variable: a:0
line 621:
E133: :return not inside a function
Error detected while processing
/home/pel/.vimrc[7]../home/pel/.vim/autoload/plug.vim[636]../home/pel/.vimrc[7]../home/pel/.vim/autoload/plug.vim:
line 635:
E133: :return not inside a function
Error detected while processing /home/pel/.vimrc:
line 402:
E185: Cannot find color scheme 'rastafari'
Press ENTER or type command to continue

The code in /home/pel/.vim/autoload/plug.vim:619 looks like this:

619 function! plug#(repo, ...)
620 if a:0 > 1
621 return s:err('Invalid number of arguments (1..2)')
622 endif
623
624 try
625 let repo = s:trim(a:repo)
626 let opts = a:0 == 1 ? s:parse_options(a:1) : s:base_spec
627 let name = get(opts, 'as', s:plug_fnamemodify(repo, ':t:s?\.git$??'))
628 let spec = extend(s:infer_properties(name, repo), opts)
629 if !has_key(g:plugs, name)
630 call add(g:plugs_order, name)
631 endif
632 let g:plugs[name] = spec
633 let s:loaded[name] = get(s:loaded, name, 0)
634 catch
635 return s:err(repo . ' ' . v:exception)
636 endtry
637 endfunction

I just re-installed the latest https://github.com/junegunn/vim-plug
(git tag 0.11.0) the problem is still there except that it's now at
line 709 in https://github.com/junegunn/vim-plug/blob/master/plug.vim :

709 function! plug#(repo, ...)
710 if a:0 > 1
711 return s:err('Invalid number of arguments (1..2)')
712 endif
...

I suppose that I won't be the only stumbling upon this error
as vim-plug is quite popular.

Regards
Dominique

Ni Va

unread,
Jan 21, 2022, 2:13:29 AM1/21/22
to vim_dev
Capture.PNG

confirmed conflict.
NiVa

Bram Moolenaar

unread,
Jan 21, 2022, 5:34:38 AM1/21/22
to vim...@googlegroups.com, Dominique Pellé
Hmm, so since it was possible to use an empty name, it was actually
used. Should have checked for that long ago. Oh well, then we'll have
to restrict it to Vim9 syntax.


--
TIM: But follow only if you are men of valour. For the entrance to this cave
is guarded by a monster, a creature so foul and cruel that no man yet has
fought with it and lived. Bones of full fifty men lie strewn about its
lair ...
Reply all
Reply to author
Forward
0 new messages