Mercurial > vim
comparison src/testdir/test_vim9_assign.vim @ 33668:fcc8296f36eb v9.0.2072
patch 9.0.2072: Vim9: no nr2str conversion in list-unpack
Commit: https://github.com/vim/vim/commit/c229a6ac0775e07dff456ca8832c516e57a74e74
Author: Yegappan Lakshmanan <yegappan@yahoo.com>
Date: Thu Oct 26 23:05:07 2023 +0200
patch 9.0.2072: Vim9: no nr2str conversion in list-unpack
Problem: Vim9: no nr2str conversion in list-unpack
Solution: Generate 2STRING instruction to convert dict index to string
Generate instruction to convert dict index to a string
fixes: #13417
closes: #13424
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 26 Oct 2023 23:15:06 +0200 |
parents | 2c66a4fe1513 |
children | 2fc593290679 |
comparison
equal
deleted
inserted
replaced
33667:fbe029687c67 | 33668:fcc8296f36eb |
---|---|
2984 END | 2984 END |
2985 LINES | 2985 LINES |
2986 v9.CheckDefAndScriptFailure(lines, 'E15: Invalid expression: "}"') | 2986 v9.CheckDefAndScriptFailure(lines, 'E15: Invalid expression: "}"') |
2987 enddef | 2987 enddef |
2988 | 2988 |
2989 " Test for assigning to a multi-dimensional list item. | |
2990 def Test_list_item_assign() | |
2991 var lines =<< trim END | |
2992 vim9script | |
2993 | |
2994 def Foo() | |
2995 var l: list<list<string>> = [['x', 'x', 'x'], ['y', 'y', 'y']] | |
2996 var z: number = 1 | |
2997 | |
2998 [l[1][2], z] = ['a', 20] | |
2999 assert_equal([['x', 'x', 'x'], ['y', 'y', 'a']], l) | |
3000 enddef | |
3001 Foo() | |
3002 END | |
3003 v9.CheckSourceSuccess(lines) | |
3004 enddef | |
3005 | |
2989 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker | 3006 " vim: ts=8 sw=2 sts=2 expandtab tw=80 fdm=marker |