From f17700544707160fb9588f37d1f3daef4f7bc483 Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 6 Dec 2018 23:21:56 -0500 Subject: vim-patch:8.1.0564: setting v:errors to wrong type still possible Problem: Setting v:errors to wrong type still possible. Solution: Return after giving an error message. (Christian Brabandt) https://github.com/vim/vim/commit/88b53fd0521d1e62df17a8a1f2181425e9d4854c --- src/nvim/eval.c | 1 + src/nvim/testdir/test_eval_stuff.vim | 10 ++++++++++ 2 files changed, 11 insertions(+) (limited to 'src') diff --git a/src/nvim/eval.c b/src/nvim/eval.c index a5d79bcd4a..cd29e4ef19 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -19254,6 +19254,7 @@ static void set_var(const char *name, const size_t name_len, typval_T *const tv, return; } else if (v->di_tv.v_type != tv->v_type) { EMSG2(_("E963: setting %s to value with wrong type"), name); + return; } } diff --git a/src/nvim/testdir/test_eval_stuff.vim b/src/nvim/testdir/test_eval_stuff.vim index 92e1ec5335..111c85bb95 100644 --- a/src/nvim/testdir/test_eval_stuff.vim +++ b/src/nvim/testdir/test_eval_stuff.vim @@ -11,3 +11,13 @@ endfunction func Test_catch_return_with_error() call assert_equal(1, s:foo()) endfunc + +func Test_E963() + " These commands used to cause an internal error prior to vim 8.1.0563 + let v_e = v:errors + let v_o = v:oldfiles + call assert_fails("let v:errors=''", 'E963:') + call assert_equal(v_e, v:errors) + call assert_fails("let v:oldfiles=''", 'E963:') + call assert_equal(v_o, v:oldfiles) +endfunc -- cgit