To: vim_dev@googlegroups.com Subject: Patch 8.2.1342 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1342 Problem: Vim9: accidentally using "x" gives a confusing error. Solution: Disallow using ":t" in Vim9 script. (issue #6399) Files: runtime/doc/vim9.txt, src/vim9compile.c, src/vim9script.c, src/ex_docmd.c, src/testdir/test_vim9_script.vim *** ../vim-8.2.1341/runtime/doc/vim9.txt 2020-07-29 22:10:42.037708767 +0200 --- runtime/doc/vim9.txt 2020-08-01 16:51:08.544085637 +0200 *************** *** 190,197 **** An existing variable cannot be assigned to with `:let`, since that implies a declaration. Global, window, tab, buffer and Vim variables can only be used ! without `:let`, because they are are not really declared, they can also be ! deleted with `:unlet`. Variables cannot shadow previously defined variables. Variables may shadow Ex commands, rename the variable if needed. --- 190,197 ---- An existing variable cannot be assigned to with `:let`, since that implies a declaration. Global, window, tab, buffer and Vim variables can only be used ! without `:let`, because they are not really declared, they can also be deleted ! with `:unlet`. Variables cannot shadow previously defined variables. Variables may shadow Ex commands, rename the variable if needed. *************** *** 352,361 **** |curly-braces-names| cannot be used. ! No :xit, :append, :change or :insert ~ ! These commands are too easily confused with local variable names. Instead of ! `:x` or `:xit` you can use `:exit`. Comparators ~ --- 352,362 ---- |curly-braces-names| cannot be used. ! No :xit, :t, :append, :change or :insert ~ ! These commands are too easily confused with local variable names. ! Instead of `:x` or `:xit` you can use `:exit`. ! Instead of `:t` you can use `:copy`. Comparators ~ *** ../vim-8.2.1341/src/vim9compile.c 2020-08-01 15:53:16.513720174 +0200 --- src/vim9compile.c 2020-08-01 16:53:27.699366986 +0200 *************** *** 7467,7472 **** --- 7467,7473 ---- case CMD_append: case CMD_change: case CMD_insert: + case CMD_t: case CMD_xit: not_in_vim9(&ea); goto erret; *** ../vim-8.2.1341/src/vim9script.c 2020-07-28 21:15:04.084366193 +0200 --- src/vim9script.c 2020-08-01 16:53:52.071242035 +0200 *************** *** 67,75 **** if (in_vim9script()) switch (eap->cmdidx) { - case CMD_insert: case CMD_append: case CMD_change: case CMD_xit: semsg(_("E1100: Missing :let: %s"), eap->cmd); return FAIL; --- 67,76 ---- if (in_vim9script()) switch (eap->cmdidx) { case CMD_append: case CMD_change: + case CMD_insert: + case CMD_t: case CMD_xit: semsg(_("E1100: Missing :let: %s"), eap->cmd); return FAIL; *** ../vim-8.2.1341/src/ex_docmd.c 2020-07-29 20:00:35.123334575 +0200 --- src/ex_docmd.c 2020-08-01 16:54:46.722962769 +0200 *************** *** 7276,7281 **** --- 7276,7284 ---- { long n; + if (not_in_vim9(eap) == FAIL) + return; + n = get_address(eap, &eap->arg, eap->addr_type, FALSE, FALSE, FALSE, 1); if (eap->arg == NULL) // error detected { *** ../vim-8.2.1341/src/testdir/test_vim9_script.vim 2020-08-01 15:53:16.513720174 +0200 --- src/testdir/test_vim9_script.vim 2020-08-01 16:58:50.557728784 +0200 *************** *** 1628,1645 **** enddef def Test_no_insert_xit() - call CheckDefExecFailure(['x = 1'], 'E1100:') call CheckDefExecFailure(['a = 1'], 'E1100:') - call CheckDefExecFailure(['i = 1'], 'E1100:') call CheckDefExecFailure(['c = 1'], 'E1100:') - CheckScriptFailure(['vim9script', 'x = 1'], 'E1100:') CheckScriptFailure(['vim9script', 'a = 1'], 'E488:') CheckScriptFailure(['vim9script', 'a'], 'E1100:') - CheckScriptFailure(['vim9script', 'i = 1'], 'E488:') - CheckScriptFailure(['vim9script', 'i'], 'E1100:') CheckScriptFailure(['vim9script', 'c = 1'], 'E488:') CheckScriptFailure(['vim9script', 'c'], 'E1100:') enddef def IfElse(what: number): string --- 1628,1648 ---- enddef def Test_no_insert_xit() call CheckDefExecFailure(['a = 1'], 'E1100:') call CheckDefExecFailure(['c = 1'], 'E1100:') + call CheckDefExecFailure(['i = 1'], 'E1100:') + call CheckDefExecFailure(['t = 1'], 'E1100:') + call CheckDefExecFailure(['x = 1'], 'E1100:') CheckScriptFailure(['vim9script', 'a = 1'], 'E488:') CheckScriptFailure(['vim9script', 'a'], 'E1100:') CheckScriptFailure(['vim9script', 'c = 1'], 'E488:') CheckScriptFailure(['vim9script', 'c'], 'E1100:') + CheckScriptFailure(['vim9script', 'i = 1'], 'E488:') + CheckScriptFailure(['vim9script', 'i'], 'E1100:') + CheckScriptFailure(['vim9script', 't'], 'E1100:') + CheckScriptFailure(['vim9script', 't = 1'], 'E1100:') + CheckScriptFailure(['vim9script', 'x = 1'], 'E1100:') enddef def IfElse(what: number): string *** ../vim-8.2.1341/src/version.c 2020-08-01 16:35:04.365552564 +0200 --- src/version.c 2020-08-01 16:59:41.513472921 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1342, /**/ -- hundred-and-one symptoms of being an internet addict: 98. The Alta Vista administrators ask you what sites are missing in their index files. /// 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 ///