Mercurial > vim
changeset 23923:be36288235af v8.2.2504
patch 8.2.2504: Vim9: crash when using an argument from a closure
Commit: https://github.com/vim/vim/commit/44ec21c467ddf481b422c787324ea08f375f6942
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Feb 12 21:50:57 2021 +0100
patch 8.2.2504: Vim9: crash when using an argument from a closure
Problem: Vim9: crash when using an argument from a closure.
Solution: Check if gen_load_outer is NULL. (closes https://github.com/vim/vim/issues/7821)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 12 Feb 2021 22:00:04 +0100 |
parents | dba960dacd31 |
children | 2f0d80c68af1 |
files | src/testdir/test_vim9_func.vim src/version.c src/vim9compile.c |
diffstat | 3 files changed, 16 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1669,6 +1669,18 @@ def Test_closure_using_argument() unlet g:UseArg unlet g:UseVararg + + var lines =<< trim END + vim9script + def Test(Fun: func(number): number): list<number> + return map([1, 2, 3], (_, i) => Fun(i)) + enddef + def Inc(nr: number): number + return nr + 2 + enddef + assert_equal([3, 4, 5], Test(Inc)) + END + CheckScriptSuccess(lines) enddef def MakeGetAndAppendRefs()