aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorSean Dewar <seandewar@users.noreply.github.com>2021-08-06 21:08:20 +0100
committerSean Dewar <seandewar@users.noreply.github.com>2021-08-12 22:35:22 +0100
commit5811390f82c51a4bb15b2e8901e6b5a1d453480a (patch)
treeedff7b2d18c022ea8d46fe4bbae5c2fe7078d78b /src/nvim/testdir
parent32589341a41f49a11e68d5b080271115787f2dc5 (diff)
downloadrneovim-5811390f82c51a4bb15b2e8901e6b5a1d453480a.tar.gz
rneovim-5811390f82c51a4bb15b2e8901e6b5a1d453480a.tar.bz2
rneovim-5811390f82c51a4bb15b2e8901e6b5a1d453480a.zip
vim-patch:8.1.1834: cannot use a lambda as a method
Problem: Cannot use a lambda as a method. Solution: Implement ->{lambda}(). (closes vim/vim#4768) https://github.com/vim/vim/commit/22a0c0c4ecd23b6c43f79ba9b92899ca0b426e29 Add an additional lua_funcname argument to call_func_rettv() to maintain support for v:lua. A memory leak was introduced with this patch that was fixed in v8.1.2107.
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_method.vim10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/nvim/testdir/test_method.vim b/src/nvim/testdir/test_method.vim
index 58e86131dc..4788f211e8 100644
--- a/src/nvim/testdir/test_method.vim
+++ b/src/nvim/testdir/test_method.vim
@@ -128,4 +128,14 @@ func Test_method_syntax()
call assert_fails('eval [1, 2, 3]-> sort ()', 'E260:')
endfunc
+func Test_method_lambda()
+ eval "text"->{x -> x .. " extended"}()->assert_equal('text extended')
+ eval "text"->{x, y -> x .. " extended " .. y}('more')->assert_equal('text extended more')
+
+ call assert_fails('eval "text"->{x -> x .. " extended"} ()', 'E274:')
+
+ " todo: lambda accepts more arguments than it consumes
+ " call assert_fails('eval "text"->{x -> x .. " extended"}("more")', 'E99:')
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab