summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-03-24 21:42:09 +0100
committerBram Moolenaar <Bram@vim.org>2016-03-24 21:42:09 +0100
commitc5fbe8af4cd80789f831b78aa44ff0b238138769 (patch)
tree20b3bcb5a78ed166babf59c96c3792ca13fbb95b
parent24c77a1e3a2ad510582116229462b482d69b4b8e (diff)
downloadvim-git-7.4.1645.tar.gz
patch 7.4.1645v7.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.
-rw-r--r--src/eval.c3
-rw-r--r--src/testdir/test_partial.vim13
-rw-r--r--src/version.c2
3 files changed, 17 insertions, 1 deletions
diff --git a/src/eval.c b/src/eval.c
index 453756217..db6ef9d5d 100644
--- 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;
diff --git a/src/testdir/test_partial.vim b/src/testdir/test_partial.vim
index 75cc49251..1fe67eabc 100644
--- 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
diff --git a/src/version.c b/src/version.c
index b90a0d0a9..dd9b5c285 100644
--- a/src/version.c
+++ b/src/version.c
@@ -749,6 +749,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1645,
+/**/
1644,
/**/
1643,