diff src/testdir/test_vim9_func.vim @ 20247:e46e72aaff74 v8.2.0679

patch 8.2.0679: Vim9: incomplete support for closures Commit: https://github.com/vim/vim/commit/bf67ea1af05cbb30cd8f0b665fb567c0dca79796 Author: Bram Moolenaar <Bram@vim.org> Date: Sat May 2 17:52:42 2020 +0200 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.
author Bram Moolenaar <Bram@vim.org>
date Sat, 02 May 2020 18:00:04 +0200
parents 23d75968ca5e
children 6f9010b6f7f9
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -650,4 +650,16 @@ def Test_closure_simple()
   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