Mercurial > vim
changeset 8712:65130a9d3386 v7.4.1645
commit https://github.com/vim/vim/commit/c5fbe8af4cd80789f831b78aa44ff0b238138769
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Mar 24 21:42:09 2016 +0100
patch 7.4.1645
Problem: When a dict contains a partial it can't be redefined as a
function. (Nikolai Pavlov)
Solution: Remove the partial when overwriting with a function.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 24 Mar 2016 21:45:07 +0100 |
parents | 0579053e5409 |
children | c1752d081a9a |
files | src/eval.c src/testdir/test_partial.vim src/version.c |
diffstat | 3 files changed, 17 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/eval.c +++ b/src/eval.c @@ -23455,7 +23455,8 @@ ex_function(exarg_T *eap) else arg = fudi.fd_newkey; if (arg != NULL && (fudi.fd_di == NULL - || fudi.fd_di->di_tv.v_type != VAR_FUNC)) + || (fudi.fd_di->di_tv.v_type != VAR_FUNC + && fudi.fd_di->di_tv.v_type != VAR_PARTIAL))) { if (*arg == K_SPECIAL) j = 3;
--- a/src/testdir/test_partial.vim +++ b/src/testdir/test_partial.vim @@ -193,3 +193,16 @@ func Test_tostring() call assert_true(v:false, v:exception) endtry endfunc + +func Test_redefine_dict_func() + let d = {} + function d.test4() + endfunction + let d.test4 = d.test4 + try + function! d.test4(name) + endfunction + catch + call assert_true(v:errmsg, v:exception) + endtry +endfunc