1
0
forked from aniani/vim

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.
This commit is contained in:
Bram Moolenaar
2021-11-30 18:25:08 +00:00
parent ab36e6ae7b
commit eba3b7f664
5 changed files with 44 additions and 13 deletions

View File

@@ -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()