1
0
forked from aniani/vim

patch 8.2.1915: Vim9: error for wrong number of arguments is not useful

Problem:    Vim9: error for wrong number of arguments is not useful.
Solution:   Mention whatever we have for the name. (closes #7208)
This commit is contained in:
Bram Moolenaar
2020-10-28 14:31:16 +01:00
parent b4bcea474d
commit 6cf7e3b026
3 changed files with 7 additions and 3 deletions

View File

@@ -322,6 +322,8 @@ def Test_call_wrong_args()
CheckDefFailure(['bufnr(xxx)'], 'E1001:') CheckDefFailure(['bufnr(xxx)'], 'E1001:')
CheckScriptFailure(['def Func(Ref: func(s: string))'], 'E475:') CheckScriptFailure(['def Func(Ref: func(s: string))'], 'E475:')
CheckDefFailure(['echo {i -> 0}()'], 'E119: Not enough arguments for function: {i -> 0}()')
var lines =<< trim END var lines =<< trim END
vim9script vim9script
def Func(s: string) def Func(s: string)
@@ -1551,7 +1553,7 @@ def Test_restore_modifiers()
set eventignore= set eventignore=
autocmd QuickFixCmdPost * copen autocmd QuickFixCmdPost * copen
def AutocmdsDisabled() def AutocmdsDisabled()
eval 0 eval 0
enddef enddef
func Func() func Func()
noautocmd call s:AutocmdsDisabled() noautocmd call s:AutocmdsDisabled()

View File

@@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
1915,
/**/ /**/
1914, 1914,
/**/ /**/

View File

@@ -1687,12 +1687,12 @@ generate_PCALL(
if (argcount < type->tt_min_argcount - varargs) if (argcount < type->tt_min_argcount - varargs)
{ {
semsg(_(e_toofewarg), "[reference]"); semsg(_(e_toofewarg), name);
return FAIL; return FAIL;
} }
if (!varargs && argcount > type->tt_argcount) if (!varargs && argcount > type->tt_argcount)
{ {
semsg(_(e_toomanyarg), "[reference]"); semsg(_(e_toomanyarg), name);
return FAIL; return FAIL;
} }
} }