Skip to content

Commit

Permalink
patch 8.2.3158: strange error message when using islocked() with a nu…
Browse files Browse the repository at this point in the history
…mber

Problem:    Strange error message when using islocked() with a number.
            (Yegappan Lakshmanan)
Solution:   Check that the name is empty.
  • Loading branch information
brammool committed Jul 13, 2021
1 parent 16e26a3 commit 1840a7b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/evalfunc.c
Original file line number Diff line number Diff line change
Expand Up @@ -5961,7 +5961,10 @@ f_islocked(typval_T *argvars, typval_T *rettv)
if (end != NULL && lv.ll_name != NULL)
{
if (*end != NUL)
semsg(_(e_trailing_arg), end);
{
semsg(_(lv.ll_name == lv.ll_name_end
? e_invarg2 : e_trailing_arg), end);
}
else
{
if (lv.ll_tv == NULL)
Expand Down
5 changes: 5 additions & 0 deletions src/testdir/test_functions.vim
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ func Test_test_void()
call assert_fails('let x = copy([test_void()])', 'E1031:')
endfunc

func Test_islocked()
call assert_fails('call islocked(99)', 'E475:')
call assert_fails('call islocked("s: x")', 'E488:')
endfunc

func Test_len()
call assert_equal(1, len(0))
call assert_equal(2, len(12))
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
3158,
/**/
3157,
/**/
Expand Down

0 comments on commit 1840a7b

Please sign in to comment.