0
0
mirror of https://github.com/vim/vim.git synced 2025-09-28 04:24:06 -04:00

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 #11468, closes #11455)
This commit is contained in:
zeertzjq
2022-11-05 20:21:58 +00:00
committed by Bram Moolenaar
parent 845bbb72ed
commit 91c75d18d9
5 changed files with 29 additions and 13 deletions

View File

@@ -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()