To: vim_dev@googlegroups.com Subject: Patch 8.2.2071 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.2071 Problem: Vim9: list assign doesn't except empty remainder list. Solution: Recognize list assignment with ";". Files: src/ex_docmd.c, src/testdir/test_vim9_assign.vim *** ../vim-8.2.2070/src/ex_docmd.c 2020-11-28 21:21:13.830682201 +0100 --- src/ex_docmd.c 2020-11-30 20:57:25.778465796 +0100 *************** *** 3356,3362 **** if (*eap->cmd == '[') { p = to_name_const_end(eap->cmd); ! if (p == eap->cmd || *skipwhite(p) != '=') { eap->cmdidx = CMD_eval; return eap->cmd; --- 3356,3369 ---- if (*eap->cmd == '[') { p = to_name_const_end(eap->cmd); ! if (p == eap->cmd && *p == '[') ! { ! int count = 0; ! int semicolon = FALSE; ! ! p = skip_var_list(eap->cmd, TRUE, &count, &semicolon, TRUE); ! } ! if (p == NULL || p == eap->cmd || *skipwhite(p) != '=') { eap->cmdidx = CMD_eval; return eap->cmd; *** ../vim-8.2.2070/src/testdir/test_vim9_assign.vim 2020-11-28 21:21:13.830682201 +0100 --- src/testdir/test_vim9_assign.vim 2020-11-30 20:46:50.541298485 +0100 *************** *** 632,661 **** enddef def Test_assignment_var_list() ! var v1: string ! var v2: string ! var vrem: list ! [v1] = ['aaa'] ! assert_equal('aaa', v1) ! ! [v1, v2] = ['one', 'two'] ! assert_equal('one', v1) ! assert_equal('two', v2) ! ! [v1, v2; vrem] = ['one', 'two'] ! assert_equal('one', v1) ! assert_equal('two', v2) ! assert_equal([], vrem) ! ! [v1, v2; vrem] = ['one', 'two', 'three'] ! assert_equal('one', v1) ! assert_equal('two', v2) ! assert_equal(['three'], vrem) ! ! [&ts, &sw] = [3, 4] ! assert_equal(3, &ts) ! assert_equal(4, &sw) ! set ts=8 sw=4 enddef def Test_assignment_vim9script() --- 632,664 ---- enddef def Test_assignment_var_list() ! var lines =<< trim END ! var v1: string ! var v2: string ! var vrem: list ! [v1] = ['aaa'] ! assert_equal('aaa', v1) ! ! [v1, v2] = ['one', 'two'] ! assert_equal('one', v1) ! assert_equal('two', v2) ! ! [v1, v2; vrem] = ['one', 'two'] ! assert_equal('one', v1) ! assert_equal('two', v2) ! assert_equal([], vrem) ! ! [v1, v2; vrem] = ['one', 'two', 'three'] ! assert_equal('one', v1) ! assert_equal('two', v2) ! assert_equal(['three'], vrem) ! ! [&ts, &sw] = [3, 4] ! assert_equal(3, &ts) ! assert_equal(4, &sw) ! set ts=8 sw=4 ! END ! CheckDefAndScriptSuccess(lines) enddef def Test_assignment_vim9script() *** ../vim-8.2.2070/src/version.c 2020-11-30 17:40:41.303714382 +0100 --- src/version.c 2020-11-30 21:12:01.971206730 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 2071, /**/ -- ARTHUR: I command you as King of the Britons to stand aside! BLACK KNIGHT: I move for no man. The Quest for the Holy Grail (Monty Python) /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///