Mercurial > vim
changeset 27609:766a329fe5bb v8.2.4331
patch 8.2.4331: Vim9: no test for existing script variable in block
Commit: https://github.com/vim/vim/commit/3a5988c025f8517ba382730dc54bb13df937edb4
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Feb 8 19:23:35 2022 +0000
patch 8.2.4331: Vim9: no test for existing script variable in block
Problem: Vim9: no test for existing script variable in block.
Solution: Add a test.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 08 Feb 2022 20:30:02 +0100 |
parents | e30b25cc5ce6 |
children | 81772f743738 |
files | src/testdir/test_vim9_func.vim src/version.c |
diffstat | 2 files changed, 27 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1028,11 +1028,35 @@ def Test_call_wrong_args() vim9script var name = 'piet' def FuncOne(name: string) - echo nr + echo name enddef END v9.CheckScriptFailure(lines, 'E1168:') + # same, inside the same block + lines =<< trim END + vim9script + if true + var name = 'piet' + def FuncOne(name: string) + echo name + enddef + endif + END + v9.CheckScriptFailure(lines, 'E1168:') + + # variable in other block is OK + lines =<< trim END + vim9script + if true + var name = 'piet' + endif + def FuncOne(name: string) + echo name + enddef + END + v9.CheckScriptSuccess(lines) + # argument name declared later is only found when compiling lines =<< trim END vim9script