0
0
mirror of https://github.com/vim/vim.git synced 2025-10-03 05:14:07 -04:00

patch 8.2.1302: Vim9: varargs arg after optional arg does not work

Problem:    Vim9: varargs arg after optional arg does not work
Solution:   Check for the "..." first. (issue #6507)
This commit is contained in:
Bram Moolenaar
2020-07-26 18:33:09 +02:00
parent ace6132aa8
commit 01865ade85
3 changed files with 29 additions and 5 deletions

View File

@@ -376,6 +376,28 @@ def Test_call_funcref()
assert_equal([1, 2, 3], g:echo)
END
CheckScriptSuccess(lines)
lines =<< trim END
vim9script
def OptAndVar(nr: number, opt = 12, ...l: list<number>): number
g:optarg = opt
g:listarg = l
return nr
enddef
let Funcref: func(number, ?number, ...list<number>): number = function('OptAndVar')
assert_equal(10, Funcref(10))
assert_equal(12, g:optarg)
assert_equal([], g:listarg)
assert_equal(11, Funcref(11, 22))
assert_equal(22, g:optarg)
assert_equal([], g:listarg)
assert_equal(17, Funcref(17, 18, 1, 2, 3))
assert_equal(18, g:optarg)
assert_equal([1, 2, 3], g:listarg)
END
CheckScriptSuccess(lines)
enddef
let SomeFunc = function('len')