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)
diff --git a/src/testdir/test_vim9_disassemble.vim b/src/testdir/test_vim9_disassemble.vim
index 27d16a5..a63779a 100644
--- a/src/testdir/test_vim9_disassemble.vim
+++ b/src/testdir/test_vim9_disassemble.vim
@@ -1278,4 +1278,22 @@
res)
enddef
+def s:CallAppend()
+ eval "some text"->append(2)
+enddef
+
+def Test_shuffle()
+ let res = execute('disass s:CallAppend')
+ assert_match('<SNR>\d*_CallAppend\_s*' ..
+ 'eval "some text"->append(2)\_s*' ..
+ '\d PUSHS "some text"\_s*' ..
+ '\d PUSHNR 2\_s*' ..
+ '\d SHUFFLE 2 up 1\_s*' ..
+ '\d BCALL append(argc 2)\_s*' ..
+ '\d DROP\_s*' ..
+ '\d PUSHNR 0\_s*' ..
+ '\d RETURN',
+ res)
+enddef
+
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker
diff --git a/src/testdir/test_vim9_expr.vim b/src/testdir/test_vim9_expr.vim
index b4e0604..83b7692 100644
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -1411,6 +1411,28 @@
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')