Skip to content

Commit c5fbe8a

Browse files
committed
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.
1 parent 24c77a1 commit c5fbe8a

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

src/eval.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23455,7 +23455,8 @@ ex_function(exarg_T *eap)
2345523455
else
2345623456
arg = fudi.fd_newkey;
2345723457
if (arg != NULL && (fudi.fd_di == NULL
23458-
|| fudi.fd_di->di_tv.v_type != VAR_FUNC))
23458+
|| (fudi.fd_di->di_tv.v_type != VAR_FUNC
23459+
&& fudi.fd_di->di_tv.v_type != VAR_PARTIAL)))
2345923460
{
2346023461
if (*arg == K_SPECIAL)
2346123462
j = 3;

src/testdir/test_partial.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,16 @@ func Test_tostring()
193193
call assert_true(v:false, v:exception)
194194
endtry
195195
endfunc
196+
197+
func Test_redefine_dict_func()
198+
let d = {}
199+
function d.test4()
200+
endfunction
201+
let d.test4 = d.test4
202+
try
203+
function! d.test4(name)
204+
endfunction
205+
catch
206+
call assert_true(v:errmsg, v:exception)
207+
endtry
208+
endfunc

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ static char *(features[]) =
748748

749749
static int included_patches[] =
750750
{ /* Add new patch number below this line */
751+
/**/
752+
1645,
751753
/**/
752754
1644,
753755
/**/

0 commit comments

Comments
 (0)