1
0
forked from aniani/vim

patch 8.2.3269: Vim9: wrong argument check for partial

Problem:    Vim9: wrong argument check for partial. (Naohiro Ono)
Solution:   Handle getting return type without arguments. Correct the minimal
            number of arguments for what is included in the partial.
            (closes #8667)
This commit is contained in:
Bram Moolenaar
2021-08-01 15:40:31 +02:00
parent 73b8b0ae3a
commit f78da4f9d6
4 changed files with 44 additions and 24 deletions

View File

@@ -2582,24 +2582,31 @@ def Test_invalid_function_name()
enddef
def Test_partial_call()
var Xsetlist = function('setloclist', [0])
Xsetlist([], ' ', {title: 'test'})
getloclist(0, {title: 1})->assert_equal({title: 'test'})
var lines =<< trim END
var Xsetlist: func
Xsetlist = function('setloclist', [0])
Xsetlist([], ' ', {title: 'test'})
getloclist(0, {title: 1})->assert_equal({title: 'test'})
Xsetlist = function('setloclist', [0, [], ' '])
Xsetlist({title: 'test'})
getloclist(0, {title: 1})->assert_equal({title: 'test'})
Xsetlist = function('setloclist', [0, [], ' '])
Xsetlist({title: 'test'})
getloclist(0, {title: 1})->assert_equal({title: 'test'})
Xsetlist = function('setqflist')
Xsetlist([], ' ', {title: 'test'})
getqflist({title: 1})->assert_equal({title: 'test'})
Xsetlist = function('setqflist')
Xsetlist([], ' ', {title: 'test'})
getqflist({title: 1})->assert_equal({title: 'test'})
Xsetlist = function('setqflist', [[], ' '])
Xsetlist({title: 'test'})
getqflist({title: 1})->assert_equal({title: 'test'})
Xsetlist = function('setqflist', [[], ' '])
Xsetlist({title: 'test'})
getqflist({title: 1})->assert_equal({title: 'test'})
var Len: func: number = function('len', ['word'])
assert_equal(4, Len())
var Len: func: number = function('len', ['word'])
assert_equal(4, Len())
var RepeatFunc = function('repeat', ['o'])
assert_equal('ooooo', RepeatFunc(5))
END
CheckDefAndScriptSuccess(lines)
enddef
def Test_cmd_modifier()