From 1840a7b4e3577e617f724c9d07ccc78195cc010a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 13 Jul 2021 20:32:29 +0200 Subject: patch 8.2.3158: strange error message when using islocked() with a number Problem: Strange error message when using islocked() with a number. (Yegappan Lakshmanan) Solution: Check that the name is empty. --- src/evalfunc.c | 5 ++++- src/testdir/test_functions.vim | 5 +++++ src/version.c | 2 ++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/evalfunc.c b/src/evalfunc.c index 060b5bbb28..029c8a6411 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -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) diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim index a4ca5d45ff..e0b0314d39 100644 --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -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)) diff --git a/src/version.c b/src/version.c index ace5a9d83a..3de3048447 100644 --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 3158, /**/ 3157, /**/ -- cgit v1.2.3