Skip to content

Commit 26b8433

Browse files
committed
patch 7.4.2329
Problem: Error for min() and max() contains %s. (Nikolay Pavlov) Solution: Pass the function name. (closes #1040)
1 parent f9e687e commit 26b8433

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/evalfunc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7629,7 +7629,7 @@ max_min(typval_T *argvars, typval_T *rettv, int domax)
76297629
}
76307630
}
76317631
else
7632-
EMSG(_(e_listdictarg));
7632+
EMSG2(_(e_listdictarg), domax ? "max()" : "min()");
76337633
rettv->vval.v_number = error ? 0 : n;
76347634
}
76357635

src/testdir/test_expr.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,13 @@ function Test_printf_errors()
335335
call assert_fails('echo printf("%d", 1.2)', 'E805:')
336336
endfunc
337337

338+
function Test_max_min_errors()
339+
call assert_fails('call max(v:true)', 'E712:')
340+
call assert_fails('call max(v:true)', 'max()')
341+
call assert_fails('call min(v:true)', 'E712:')
342+
call assert_fails('call min(v:true)', 'min()')
343+
endfunc
344+
338345
function Test_printf_64bit()
339346
if has('num64')
340347
call assert_equal("123456789012345", printf('%d', 123456789012345))

src/version.c

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

764764
static int included_patches[] =
765765
{ /* Add new patch number below this line */
766+
/**/
767+
2329,
766768
/**/
767769
2328,
768770
/**/

0 commit comments

Comments
 (0)