Mercurial > vim
diff src/testdir/test_functions.vim @ 31002:a09404dad917 v9.0.0836
patch 9.0.0836: wrong error when using extend() with funcref
Commit: https://github.com/vim/vim/commit/91c75d18d9cdc32df57e648640de7476fbcb4d76
Author: zeertzjq <zeertzjq@outlook.com>
Date: Sat Nov 5 20:21:58 2022 +0000
patch 9.0.0836: wrong error when using extend() with funcref
Problem: Wrong error when using extend() with funcref.
Solution: Better check the variable type. (closes https://github.com/vim/vim/issues/11468, closes https://github.com/vim/vim/issues/11455)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 05 Nov 2022 21:30:04 +0100 |
parents | c9b31c8eb3b3 |
children | eb145a4d6bf8 |
line wrap: on
line diff
--- 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()