1
0
forked from aniani/vim

patch 8.2.4322: Vim9: crash when using funcref with closure

Problem:    Vim9: crash when using funcref with closure.
Solution:   Keep a reference to the funcref that has the outer context.
            (closes #9716)
This commit is contained in:
Bram Moolenaar
2022-02-07 19:56:43 +00:00
parent 92368aad61
commit 7aca5ca676
6 changed files with 54 additions and 5 deletions

View File

@@ -3477,6 +3477,25 @@ def Test_nested_closure_funcref()
unlet g:result_one g:result_two
enddef
def Test_nested_closure_in_dict()
var lines =<< trim END
vim9script
def Func(): dict<any>
var n: number
def Inc(): number
++n
return n
enddef
return {inc: function(Inc)}
enddef
disas Func
var d = Func()
assert_equal(1, d.inc())
assert_equal(2, d.inc())
END
v9.CheckScriptSuccess(lines)
enddef
def Test_check_func_arg_types()
var lines =<< trim END
vim9script