To: vim_dev@googlegroups.com Subject: Patch 8.2.3053 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3053 Problem: Vim9: cannot assign to @@ in :def function Solution: Handle '@' like '"'. Files: src/vim9compile.c, src/testdir/test_vim9_assign.vim *** ../vim-8.2.3052/src/vim9compile.c 2021-06-26 13:00:45.734565919 +0200 --- src/vim9compile.c 2021-06-26 13:20:18.008217816 +0200 *************** *** 5854,5860 **** } else if (*name == '@') { ! if (!valid_yank_reg(name[1], FALSE) || name[1] == '.') { emsg_invreg(name[1]); return FAIL; --- 5854,5861 ---- } else if (*name == '@') { ! if (name[1] != '@' ! && (!valid_yank_reg(name[1], FALSE) || name[1] == '.')) { emsg_invreg(name[1]); return FAIL; *** ../vim-8.2.3052/src/testdir/test_vim9_assign.vim 2021-06-25 21:31:03.379070659 +0200 --- src/testdir/test_vim9_assign.vim 2021-06-26 13:23:29.287843017 +0200 *************** *** 228,243 **** CheckDefFailure(['$SOME_ENV_VAR += "more"'], 'E1051:') CheckDefFailure(['$SOME_ENV_VAR += 123'], 'E1012:') - lines =<< trim END - @c = 'areg' - @c ..= 'add' - assert_equal('aregadd', @c) - END - CheckDefAndScriptSuccess(lines) - - CheckDefFailure(['@a += "more"'], 'E1051:') - CheckDefFailure(['@a += 123'], 'E1012:') - v:errmsg = 'none' v:errmsg ..= 'again' assert_equal('noneagain', v:errmsg) --- 228,233 ---- *************** *** 249,254 **** --- 239,259 ---- END enddef + def Test_assign_register() + var lines =<< trim END + @c = 'areg' + @c ..= 'add' + assert_equal('aregadd', @c) + + @@ = 'some text' + assert_equal('some text', getreg('"')) + END + CheckDefAndScriptSuccess(lines) + + CheckDefFailure(['@a += "more"'], 'E1051:') + CheckDefFailure(['@a += 123'], 'E1012:') + enddef + def Test_reserved_name() for name in ['true', 'false', 'null'] CheckDefExecAndScriptFailure(['var ' .. name .. ' = 0'], 'E1034:') *** ../vim-8.2.3052/src/version.c 2021-06-26 13:00:45.734565919 +0200 --- src/version.c 2021-06-26 13:21:10.920114029 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3053, /**/ -- hundred-and-one symptoms of being an internet addict: 34. You laugh at people with a 10 Mbit connection. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///