0
0
mirror of https://github.com/vim/vim.git synced 2025-10-02 05:04:20 -04:00

patch 8.2.1167: Vim9: builtin function method call only supports first arg

Problem:    Vim9: builtin function method call only supports first argument.
Solution:   Shift arguments when needed. (closes #6305, closes #6419)
This commit is contained in:
Bram Moolenaar
2020-07-09 21:20:47 +02:00
parent ae97b94176
commit 389df259c4
7 changed files with 94 additions and 10 deletions

View File

@@ -1411,6 +1411,28 @@ def Test_expr7_subscript_linebreak()
one)
enddef
def Test_expr7_method_call()
new
setline(1, ['first', 'last'])
eval 'second'->append(1)
assert_equal(['first', 'second', 'last'], getline(1, '$'))
bwipe!
let bufnr = bufnr()
let loclist = [#{bufnr: bufnr, lnum: 42, col: 17, text: 'wrong'}]
loclist->setloclist(0)
assert_equal([#{bufnr: bufnr,
lnum: 42,
col: 17,
text: 'wrong',
pattern: '',
valid: 1,
vcol: 0,
nr: 0,
type: '',
module: ''}
], getloclist(0))
enddef
func Test_expr7_trailing_fails()
call CheckDefFailure(['let l = [2]', 'l->{l -> add(l, 8)}'], 'E107')