diff options
author | erw7 <erw7.github@gmail.com> | 2020-06-22 23:17:20 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-22 10:17:20 -0400 |
commit | 21453e8f09b72751d396858b9ea86c0584fd6c89 (patch) | |
tree | 38273aab781fe6542592439d5a4339c1e61911fe /test | |
parent | 4496628c181e456d57e9257e14d8582d8dc548eb (diff) | |
download | rneovim-21453e8f09b72751d396858b9ea86c0584fd6c89.tar.gz rneovim-21453e8f09b72751d396858b9ea86c0584fd6c89.tar.bz2 rneovim-21453e8f09b72751d396858b9ea86c0584fd6c89.zip |
eval: fix assertion failure in garbage collection (#12436)
* eval: fix assertion failure in garbage collection
fixes #12387, #12430
Lists with CopyID+1 linked only from previous_funccal may be removed in
the garbage collection. Therefore, the terms of the assertions are not
correct. This can be confirmed by the following (The l:x with CopyID+1 of
the first function call needs to be removed by garbage collection):
func! s:f()
let l:x = [1]
let g:x = l:
endfunc
for _ in range(2)
call s:f()
endfor
call garbagecollect()
" press any key
* test: add test for #12387, #12430
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/eval/let_spec.lua | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/functional/eval/let_spec.lua b/test/functional/eval/let_spec.lua index f8fcdfd41f..5bc703b567 100644 --- a/test/functional/eval/let_spec.lua +++ b/test/functional/eval/let_spec.lua @@ -75,4 +75,19 @@ describe(':let', function() command(cmd_get_child_env) eq(eval('$NVIM_TEST'), eval('g:env_from_child')) end) + + it("release of list assigned to l: variable does not trigger assertion #12387, #12430", function() + source([[ + func! s:f() + let l:x = [1] + let g:x = l: + endfunc + for _ in range(2) + call s:f() + endfor + call garbagecollect() + call feedkeys('i', 't') + ]]) + eq(1, eval('1')) + end) end) |