aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/eval.c1
-rw-r--r--src/nvim/eval/funcs.c2
-rw-r--r--test/old/testdir/test_functions.vim5
3 files changed, 7 insertions, 1 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 18e5dc7cbd..c1c1f551a8 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -1737,6 +1737,7 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
}
tv_clear(&var1);
+ lp->ll_name_len = (size_t)(p - lp->ll_name);
return p;
}
diff --git a/src/nvim/eval/funcs.c b/src/nvim/eval/funcs.c
index 048f744532..e4cb63eb8e 100644
--- a/src/nvim/eval/funcs.c
+++ b/src/nvim/eval/funcs.c
@@ -4119,7 +4119,7 @@ static void f_islocked(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
FNE_CHECK_START);
if (end != NULL && lv.ll_name != NULL) {
if (*end != NUL) {
- semsg(_(e_trailing_arg), end);
+ semsg(_(lv.ll_name_len == 0 ? e_invarg2 : e_trailing_arg), end);
} else {
if (lv.ll_tv == NULL) {
dictitem_T *di = find_var(lv.ll_name, lv.ll_name_len, NULL, true);
diff --git a/test/old/testdir/test_functions.vim b/test/old/testdir/test_functions.vim
index 7c712818f9..18d0d9aa5d 100644
--- a/test/old/testdir/test_functions.vim
+++ b/test/old/testdir/test_functions.vim
@@ -98,6 +98,11 @@ func Test_err_teapot()
call assert_fails('call err_teapot(expr)', "E503: Coffee is currently not available")
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))