forked from aniani/vim
patch 8.2.1778: Vim9: returning from a partial call clears outer context
Problem: Vim9: returning from a partial call clears outer context, causing
a crash.
Solution: Put the outer context in the stack frame. (closes #7044)
This commit is contained in:
@@ -1384,6 +1384,21 @@ def Test_nested_closure_fails()
|
||||
CheckScriptFailure(lines, 'E1012:')
|
||||
enddef
|
||||
|
||||
def Test_nested_lambda()
|
||||
var lines =<< trim END
|
||||
vim9script
|
||||
def Func()
|
||||
var x = 4
|
||||
var Lambda1 = {-> 7}
|
||||
var Lambda2 = {-> [Lambda1(), x]}
|
||||
var res = Lambda2()
|
||||
assert_equal([7, 4], res)
|
||||
enddef
|
||||
Func()
|
||||
END
|
||||
CheckScriptSuccess(lines)
|
||||
enddef
|
||||
|
||||
def Test_sort_return_type()
|
||||
var res: list<number>
|
||||
res = [1, 2, 3]->sort()
|
||||
|
||||
Reference in New Issue
Block a user