diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-11-05 20:21:58 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-11-05 20:21:58 +0000 |
commit | 91c75d18d9cdc32df57e648640de7476fbcb4d76 (patch) | |
tree | 9fa0460b1c499a272b85c5613b5c546f2ff37c93 /src/testdir | |
parent | 845bbb72ed2da4b5fb2a503d91cfd6435df2f584 (diff) | |
download | vim-git-91c75d18d9cdc32df57e648640de7476fbcb4d76.tar.gz |
patch 9.0.0836: wrong error when using extend() with funcrefv9.0.0836
Problem: Wrong error when using extend() with funcref.
Solution: Better check the variable type. (closes #11468, closes #11455)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_functions.vim | 19 | ||||
-rw-r--r-- | src/testdir/test_let.vim | 1 |
2 files changed, 20 insertions, 0 deletions
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim index 938a839bf..831a8946f 100644 --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -2938,6 +2938,25 @@ func Test_builtin_check() let g:bar = 123 call extend(g:, #{bar: { -> "foo" }}, "keep") call assert_fails('call extend(g:, #{bar: { -> "foo" }}, "force")', 'E704:') + unlet g:bar + + call assert_fails('call extend(l:, #{foo: { -> "foo" }})', 'E704:') + let bar = 123 + call extend(l:, #{bar: { -> "foo" }}, "keep") + call assert_fails('call extend(l:, #{bar: { -> "foo" }}, "force")', 'E704:') + unlet bar + + call assert_fails('call extend(g:, #{foo: function("extend")})', 'E704:') + let g:bar = 123 + call extend(g:, #{bar: function("extend")}, "keep") + call assert_fails('call extend(g:, #{bar: function("extend")}, "force")', 'E704:') + unlet g:bar + + call assert_fails('call extend(l:, #{foo: function("extend")})', 'E704:') + let bar = 123 + call extend(l:, #{bar: function("extend")}, "keep") + call assert_fails('call extend(l:, #{bar: function("extend")}, "force")', 'E704:') + unlet bar endfunc func Test_funcref_to_string() diff --git a/src/testdir/test_let.vim b/src/testdir/test_let.vim index 3f9bdd4db..4e4a386df 100644 --- a/src/testdir/test_let.vim +++ b/src/testdir/test_let.vim @@ -316,6 +316,7 @@ func Test_let_errors() call assert_fails('let l += 2', 'E734:') call assert_fails('let g:["a;b"] = 10', 'E461:') call assert_fails('let g:.min = function("max")', 'E704:') + call assert_fails('let g:cos = "" | let g:.cos = {-> 42}', 'E704:') if has('channel') let ch = test_null_channel() call assert_fails('let ch += 1', 'E734:') |