patch 8.2.2920: still a way to shadow a builtin function
Problem: Still a way to shadow a builtin function. (Yasuhiro Matsumoto)
Solution: Check the key when using extend(). (issue #8302)
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index e1aff61..f945e90 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -2686,6 +2686,11 @@
call assert_fails('let g:.trim = {x -> " " .. x}', 'E704:')
call assert_fails('let s:["trim"] = {x -> " " .. x}', 'E704:')
call assert_fails('let s:.trim = {x -> " " .. x}', 'E704:')
+
+ call assert_fails('call extend(g:, #{foo: { -> "foo" }})', 'E704:')
+ let g:bar = 123
+ call extend(g:, #{bar: { -> "foo" }}, "keep")
+ call assert_fails('call extend(g:, #{bar: { -> "foo" }}, "force")', 'E704:')
endfunc