patch 8.2.0679: Vim9: incomplete support for closures
Problem: Vim9: incomplete support for closures.
Solution: At the end of a function copy arguments and local variables if
they are still used by a referenced closure.
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index a317d8f..0fd2892 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -650,4 +650,16 @@
assert_equal('some more', RefFunc({s -> local .. s}))
enddef
+def MakeRef()
+ let local = 'some '
+ g:Ref = {s -> local .. s}
+enddef
+
+def Test_closure_ref_after_return()
+ MakeRef()
+ assert_equal('some thing', g:Ref('thing'))
+ unlet g:Ref
+enddef
+
+
" vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker