To: vim_dev@googlegroups.com Subject: Patch 8.2.1357 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1357 Problem: Vim9: cannot assign to / register. Solution: Adjust check for assignment. (issue #6566) Files: src/vim9compile.c, src/testdir/test_vim9_expr.vim, src/testdir/test_vim9_script.vim *** ../vim-8.2.1356/src/vim9compile.c 2020-08-02 17:33:21.986416459 +0200 --- src/vim9compile.c 2020-08-02 18:51:54.110676409 +0200 *************** *** 5214,5222 **** int has_index = FALSE; int instr_count = -1; ! p = (*var_start == '&' || *var_start == '$' ! || *var_start == '@') ? var_start + 1 : var_start; ! p = to_name_end(p, TRUE); // "a: type" is declaring variable "a" with a type, not "a:". if (is_decl && var_end == var_start + 2 && var_end[-1] == ':') --- 5214,5227 ---- int has_index = FALSE; int instr_count = -1; ! if (*var_start == '@') ! p = var_start + 2; ! else ! { ! p = (*var_start == '&' || *var_start == '$') ! ? var_start + 1 : var_start; ! p = to_name_end(p, TRUE); ! } // "a: type" is declaring variable "a" with a type, not "a:". if (is_decl && var_end == var_start + 2 && var_end[-1] == ':') *************** *** 5279,5285 **** } else if (*var_start == '@') { ! if (!valid_yank_reg(var_start[1], TRUE)) { emsg_invreg(var_start[1]); goto theend; --- 5284,5290 ---- } else if (*var_start == '@') { ! if (!valid_yank_reg(var_start[1], FALSE) || var_start[1] == '.') { emsg_invreg(var_start[1]); goto theend; *************** *** 7247,7253 **** int oplen; int heredoc; ! var_end = find_name_end(pskip, NULL, NULL, FNE_CHECK_START | FNE_INCL_BR); oplen = assignment_len(skipwhite(var_end), &heredoc); if (oplen > 0) --- 7252,7261 ---- int oplen; int heredoc; ! if (ea.cmd[0] == '@') ! var_end = ea.cmd + 2; ! else ! var_end = find_name_end(pskip, NULL, NULL, FNE_CHECK_START | FNE_INCL_BR); oplen = assignment_len(skipwhite(var_end), &heredoc); if (oplen > 0) *** ../vim-8.2.1356/src/testdir/test_vim9_expr.vim 2020-08-02 17:33:21.986416459 +0200 --- src/testdir/test_vim9_expr.vim 2020-08-02 18:57:38.573730187 +0200 *************** *** 1439,1444 **** --- 1439,1451 ---- normal axyz assert_equal("xyz", @.) + call CheckDefFailure(["@. = 'yes'"], 'E354:') + + @/ = 'slash' + assert_equal('slash', @/) + + @= = 'equal' + assert_equal('equal', @=) enddef def Test_expr7_namespace() *** ../vim-8.2.1356/src/testdir/test_vim9_script.vim 2020-08-02 16:58:55.767760788 +0200 --- src/testdir/test_vim9_script.vim 2020-08-02 18:55:08.526173937 +0200 *************** *** 470,477 **** call CheckDefFailure(['let $VAR = 5'], 'E1016: Cannot declare an environment variable:') call CheckScriptFailure(['vim9script', 'let $ENV = "xxx"'], 'E1016:') ! call CheckDefFailure(['let @~ = 5'], 'E354:') call CheckDefFailure(['let @a = 5'], 'E1066:') call CheckScriptFailure(['vim9script', 'let @a = "abc"'], 'E1066:') call CheckDefFailure(['let g:var = 5'], 'E1016: Cannot declare a global variable:') --- 470,478 ---- call CheckDefFailure(['let $VAR = 5'], 'E1016: Cannot declare an environment variable:') call CheckScriptFailure(['vim9script', 'let $ENV = "xxx"'], 'E1016:') ! call CheckDefFailure(['let @~ = 5'], 'E1066:') call CheckDefFailure(['let @a = 5'], 'E1066:') + call CheckDefFailure(['let @/ = "x"'], 'E1066:') call CheckScriptFailure(['vim9script', 'let @a = "abc"'], 'E1066:') call CheckDefFailure(['let g:var = 5'], 'E1016: Cannot declare a global variable:') *** ../vim-8.2.1356/src/version.c 2020-08-02 17:33:21.986416459 +0200 --- src/version.c 2020-08-02 18:42:19.572346758 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1357, /**/ -- Nobody will ever need more than 640 kB RAM. -- Bill Gates, 1983 Windows 98 requires 16 MB RAM. -- Bill Gates, 1999 Logical conclusion: Nobody will ever need Windows 98. /// 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 ///