1
0
forked from aniani/vim

patch 8.2.2864: Vim9: crash when using inline function

Problem:    Vim9: crash when using inline function.
Solution:   Check for NULL pointer. Make using inline function work inside
            lambda. (closes #8217)
This commit is contained in:
Bram Moolenaar
2021-05-18 11:47:44 +02:00
parent 965c04486c
commit 074f84c01f
3 changed files with 102 additions and 7 deletions

View File

@@ -2102,6 +2102,20 @@ def Test_nested_lambda()
CheckScriptSuccess(lines)
enddef
def Test_nested_inline_lambda()
# TODO: use the "text" argument
var lines =<< trim END
vim9script
def F(text: string): func(string): func(string): string
return (arg: string): func(string): string => ((sep: string): string => {
return sep .. arg
})
enddef
assert_equal('--there', F('unused')('there')('--'))
END
CheckScriptSuccess(lines)
enddef
def Shadowed(): list<number>
var FuncList: list<func: number> = [() => 42]
return FuncList->mapnew((_, Shadowed) => Shadowed())