Patch 8.2.2918
Problem: Builtin function can be shadowed by global variable.
Solution: Check for builtin function before variable. (Yasuhiro Matsumoto,
closes #8302)
Files: src/eval.c, src/testdir/test_functions.vim
*** ../vim-8.2.2917/src/eval.c 2021-05-28 21:06:04.628687341 +0200
--- src/eval.c 2021-05-31 21:59:49.437027664 +0200
***************
*** 1462,1467 ****
--- 1462,1474 ----
semsg(_(e_dictkey), lp->ll_newkey);
return;
}
+ if ((lp->ll_tv->vval.v_dict == get_globvar_dict()
+ || lp->ll_tv->vval.v_dict ==
+ &SCRIPT_ITEM(current_sctx.sc_sid)->sn_vars->sv_dict)
+ && (rettv->v_type == VAR_FUNC
+ || rettv->v_type == VAR_PARTIAL)
+ && var_wrong_func_name(lp->ll_newkey, TRUE))
+ return;
// Need to add an item to the Dictionary.
di = dictitem_alloc(lp->ll_newkey);
*** ../vim-8.2.2917/src/testdir/test_functions.vim 2021-05-25
20:13:56.316778428 +0200
--- src/testdir/test_functions.vim 2021-05-31 22:03:55.432319549 +0200
***************
*** 2681,2684 ****
--- 2681,2692 ----
call assert_fails('call gettext(1)', 'E475:')
endfunc
+ func Test_builtin_check()
+ call assert_fails('let g:["trim"] = {x -> " " .. x}', 'E704:')
+ 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:')
+ endfunc
+
+
" vim: shiftwidth=2 sts=2 expandtab
*** ../vim-8.2.2917/src/version.c 2021-05-31 20:04:00.553171007 +0200
--- src/version.c 2021-05-31 22:15:07.542595589 +0200
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 2918,
/**/
--
Compilation process failed successfully.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202105312016.14VKGiUt2130506%40masaka.moolenaar.net.