diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-12-18 17:23:14 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-12-18 17:23:14 +0100 |
commit | 3beaf9cd8efa3ba83e07187215004d140b89d529 (patch) | |
tree | 193f21162a9cb4dc605cd16b1e8ab639d1d60520 /src/testdir | |
parent | 6e562fcc07c71ad1437c89c3d3cc423efb691f0a (diff) |
patch 8.2.2159: Vim9: when declaring a list it is not allocated yetv8.2.2159
Problem: Vim9: when declaring a list it is not allocated yet, causing a
following extend() to fail.
Solution: When fetching a variable value for a list or dict that is null
allocate the list or dict, so it can be used. (closes #7491)
Diffstat (limited to 'src/testdir')
-rw-r--r-- | src/testdir/test_vim9_assign.vim | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim index ad7b85b5fc..c9872d4e63 100644 --- a/src/testdir/test_vim9_assign.vim +++ b/src/testdir/test_vim9_assign.vim @@ -391,6 +391,16 @@ def Test_extend_list() assert_equal(['a', 'b'], list) END CheckScriptSuccess(lines) + lines =<< trim END + vim9script + var list: list<string> + def Func() + extend(list, ['x', 'b']) + enddef + Func() + assert_equal(['x', 'b'], list) + END + CheckScriptSuccess(lines) lines =<< trim END vim9script @@ -584,8 +594,9 @@ def Test_assignment_dict() return test enddef FillDict() + assert_equal({a: 43}, test) END - CheckScriptFailure(lines, 'E1103:') + CheckScriptSuccess(lines) # assignment to global dict lines =<< trim END |