Mercurial > vim
diff src/testdir/test_expr.vim @ 26348:bf1a7ce3f14a v8.2.3705
patch 8.2.3705: cannot pass a lambda name to function() or funcref()
Commit: https://github.com/vim/vim/commit/eba3b7f6645c8f856132b4c06a009a3b0a44e21c
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Nov 30 18:25:08 2021 +0000
patch 8.2.3705: cannot pass a lambda name to function() or funcref()
Problem: Cannot pass a lambda name to function() or funcref(). (Yegappan
Lakshmanan)
Solution: Handle a lambda name differently.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 30 Nov 2021 19:30:05 +0100 |
parents | ce6490cd6282 |
children | e01607ab0fab |
line wrap: on
line diff
--- a/src/testdir/test_expr.vim +++ b/src/testdir/test_expr.vim @@ -547,6 +547,13 @@ func Test_function_with_funcref() call assert_fails("call function('foo()')", 'E475:') call assert_fails("call function('foo()')", 'foo()') call assert_fails("function('')", 'E129:') + + let Len = {s -> strlen(s)} + call assert_equal(6, Len('foobar')) + let name = string(Len) + " can evaluate "function('<lambda>99')" + call execute('let Ref = ' .. name) + call assert_equal(4, Ref('text')) endfunc func Test_funcref()