mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.2580: Vim9: checking vararg type may be wrong
Problem: Vim9: checking vararg type is wrong when function is auto-loaded. Solution: Use the member type. (closes #7933)
This commit is contained in:
@@ -3154,6 +3154,10 @@ def Test_vim9_autoload()
|
|||||||
return 'test'
|
return 'test'
|
||||||
enddef
|
enddef
|
||||||
g:some#name = 'name'
|
g:some#name = 'name'
|
||||||
|
|
||||||
|
def some#varargs(a1: string, ...l: list<string>): string
|
||||||
|
return a1 .. l[0] .. l[1]
|
||||||
|
enddef
|
||||||
END
|
END
|
||||||
|
|
||||||
mkdir('Xdir/autoload', 'p')
|
mkdir('Xdir/autoload', 'p')
|
||||||
@@ -3166,6 +3170,8 @@ def Test_vim9_autoload()
|
|||||||
g:some#other = 'other'
|
g:some#other = 'other'
|
||||||
assert_equal('other', g:some#other)
|
assert_equal('other', g:some#other)
|
||||||
|
|
||||||
|
assert_equal('abc', some#varargs('a', 'b', 'c'))
|
||||||
|
|
||||||
# upper case script name works
|
# upper case script name works
|
||||||
lines =<< trim END
|
lines =<< trim END
|
||||||
vim9script
|
vim9script
|
||||||
|
@@ -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 */
|
||||||
|
/**/
|
||||||
|
2580,
|
||||||
/**/
|
/**/
|
||||||
2579,
|
2579,
|
||||||
/**/
|
/**/
|
||||||
|
@@ -807,9 +807,12 @@ call_by_name(char_u *name, int argcount, ectx_T *ectx, isn_T *iptr)
|
|||||||
// types are correct.
|
// types are correct.
|
||||||
for (i = 0; i < argcount; ++i)
|
for (i = 0; i < argcount; ++i)
|
||||||
{
|
{
|
||||||
type_T *type = i < ufunc->uf_args.ga_len
|
type_T *type = NULL;
|
||||||
? ufunc->uf_arg_types[i] : ufunc->uf_va_type;
|
|
||||||
|
|
||||||
|
if (i < ufunc->uf_args.ga_len)
|
||||||
|
type = ufunc->uf_arg_types[i];
|
||||||
|
else if (ufunc->uf_va_type != NULL)
|
||||||
|
type = ufunc->uf_va_type->tt_member;
|
||||||
if (type != NULL && check_typval_arg_type(type,
|
if (type != NULL && check_typval_arg_type(type,
|
||||||
&argv[i], i + 1) == FAIL)
|
&argv[i], i + 1) == FAIL)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
Reference in New Issue
Block a user