Skip to content

Commit ace6132

Browse files
committed
patch 8.2.1301: Vim9: varargs argument type not parsed properly
Problem: Vim9: varargs argument type not parsed properly. Solution: Skip over the "...". (issue #6507)
1 parent 4fc224c commit ace6132

3 files changed

Lines changed: 17 additions & 0 deletions

File tree

src/testdir/test_vim9_func.vim

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,19 @@ def Test_call_funcref()
363363
assert_equal(123, g:echo)
364364
END
365365
CheckScriptSuccess(lines)
366+
367+
lines =<< trim END
368+
vim9script
369+
def EchoList(...l: list<number>)
370+
g:echo = l
371+
enddef
372+
let Funcref: func(...list<number>) = function('EchoList')
373+
Funcref()
374+
assert_equal([], g:echo)
375+
Funcref(1, 2, 3)
376+
assert_equal([1, 2, 3], g:echo)
377+
END
378+
CheckScriptSuccess(lines)
366379
enddef
367380

368381
let SomeFunc = function('len')

src/version.c

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

755755
static int included_patches[] =
756756
{ /* Add new patch number below this line */
757+
/**/
758+
1301,
757759
/**/
758760
1300,
759761
/**/

src/vim9compile.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,6 +1956,8 @@ skip_type(char_u *start, int optional)
19561956
{
19571957
char_u *sp = p;
19581958

1959+
if (STRNCMP(p, "...", 3) == 0)
1960+
p += 3;
19591961
p = skip_type(p, TRUE);
19601962
if (p == sp)
19611963
return p; // syntax error

0 commit comments

Comments
 (0)