]> granicus.if.org Git - vim/commitdiff
patch 8.2.3158: strange error message when using islocked() with a number v8.2.3158
authorBram Moolenaar <Bram@vim.org>
Tue, 13 Jul 2021 18:32:29 +0000 (20:32 +0200)
committerBram Moolenaar <Bram@vim.org>
Tue, 13 Jul 2021 18:32:29 +0000 (20:32 +0200)
Problem:    Strange error message when using islocked() with a number.
            (Yegappan Lakshmanan)
Solution:   Check that the name is empty.

src/evalfunc.c
src/testdir/test_functions.vim
src/version.c

index 060b5bbb2839094dd3d17753966ac0b9124594e5..029c8a64117950cad821d3a1a9fb4d89e2c28749 100644 (file)
@@ -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)
index a4ca5d45ff0fbd3a20c32f2695a806163fa3f57c..e0b0314d397cf28d9e23d42bc378b62e169ec1ca 100644 (file)
@@ -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))
index ace5a9d83a8baeb9eb7f306c328193a4af3a10e3..3de30484477279a2b4754d381026be2362deedd8 100644 (file)
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3158,
 /**/
     3157,
 /**/