patch 8.2.0677: Vim9: no support for closures
Problem: Vim9: no support for closures.
Solution: Find variables in the outer function scope, so long as the scope
exists.
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index 2ee91f1..a317d8f 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -641,4 +641,13 @@
call assert_equal(1, caught_1059)
endfunc
+def RefFunc(Ref: func(string): string): string
+ return Ref('more')
+enddef
+
+def Test_closure_simple()
+ let local = 'some '
+ assert_equal('some more', RefFunc({s -> local .. s}))
+enddef
+
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker