To: vim_dev@googlegroups.com Subject: Patch 8.2.4395 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4395 Problem: Some code lines not covered by tests. Solution: Add a few more test cases. Fix getting more than one error for invalid assignment. Files: src/evalvars.c, src/errors.h, src/vim9compile.c, src/testdir/test_vim9_assign.vim, src/testdir/test_vim9_cmd.vim, src/testdir/test_vim9_func.vim *** ../vim-8.2.4394/src/evalvars.c 2022-02-13 21:51:02.392484124 +0000 --- src/evalvars.c 2022-02-15 20:56:17.155335165 +0000 *************** *** 1107,1113 **** { if (*semicolon == 1) { ! emsg(_(e_double_semicolon_in_list_of_variables)); return NULL; } *semicolon = 1; --- 1107,1114 ---- { if (*semicolon == 1) { ! if (!silent) ! emsg(_(e_double_semicolon_in_list_of_variables)); return NULL; } *semicolon = 1; *** ../vim-8.2.4394/src/errors.h 2022-02-14 21:42:12.156249426 +0000 --- src/errors.h 2022-02-15 21:03:27.886523804 +0000 *************** *** 2788,2794 **** INIT(= N_("E1077: Missing argument type for %s")); // E1078 unused // E1079 unused ! // E1080 unused EXTERN char e_cannot_unlet_str[] INIT(= N_("E1081: Cannot unlet %s")); #endif --- 2788,2795 ---- INIT(= N_("E1077: Missing argument type for %s")); // E1078 unused // E1079 unused ! EXTERN char e_invalid_assignment[] ! INIT(= N_("E1080: Invalid assignment")); EXTERN char e_cannot_unlet_str[] INIT(= N_("E1081: Cannot unlet %s")); #endif *** ../vim-8.2.4394/src/vim9compile.c 2022-02-15 15:37:07.319841654 +0000 --- src/vim9compile.c 2022-02-15 21:04:08.954446695 +0000 *************** *** 2420,2426 **** if (*eap->cmd == '[') { ! // [var, var] = expr *line = compile_assignment(eap->cmd, eap, CMD_SIZE, cctx); if (*line == NULL) return FAIL; --- 2420,2426 ---- if (*eap->cmd == '[') { ! // might be "[var, var] = expr" *line = compile_assignment(eap->cmd, eap, CMD_SIZE, cctx); if (*line == NULL) return FAIL; *************** *** 2958,2964 **** --- 2958,2967 ---- case CMD_decrement: line = compile_assignment(p, &ea, ea.cmdidx, &cctx); if (line == p) + { + emsg(_(e_invalid_assignment)); line = NULL; + } break; case CMD_unlet: *** ../vim-8.2.4394/src/testdir/test_vim9_assign.vim 2022-02-15 15:37:07.319841654 +0000 --- src/testdir/test_vim9_assign.vim 2022-02-15 21:10:13.109693075 +0000 *************** *** 1359,1365 **** v9.CheckDefFailure(['var null = 1'], 'E1034:') v9.CheckDefFailure(['var this = 1'], 'E1034:') ! v9.CheckDefFailure(['[a; b; c] = g:list'], 'E452:') v9.CheckDefExecFailure(['var a: number', '[a] = test_null_list()'], 'E1093:') v9.CheckDefExecFailure(['var a: number', --- 1359,1366 ---- v9.CheckDefFailure(['var null = 1'], 'E1034:') v9.CheckDefFailure(['var this = 1'], 'E1034:') ! v9.CheckDefFailure(['[a; b; c] = g:list'], 'E1001:') ! v9.CheckDefFailure(['var [a; b; c] = g:list'], 'E1080:') v9.CheckDefExecFailure(['var a: number', '[a] = test_null_list()'], 'E1093:') v9.CheckDefExecFailure(['var a: number', *** ../vim-8.2.4394/src/testdir/test_vim9_cmd.vim 2022-02-14 21:19:01.134589027 +0000 --- src/testdir/test_vim9_cmd.vim 2022-02-15 21:14:34.869148242 +0000 *************** *** 1355,1360 **** --- 1355,1367 ---- v9.CheckDefFailure(lines, 'E1146:', 1) lines =<< trim END + if 0 + d.key = 'asdf' + endif + END + v9.CheckDefSuccess(lines) + + lines =<< trim END d['key'] = 'asdf' END v9.CheckDefFailure(lines, 'E1146:', 1) *************** *** 1621,1626 **** --- 1628,1638 ---- s/text/\=['aaa', 'bbb', 'ccc']/ assert_equal(['some aaa', 'bbb', 'ccc', ' here'], getline(1, '$')) bwipe! + + # inside "if 0" substitute is ignored + if 0 + s/a/\=nothing/ and | some more + endif enddef def Test_redir_to_var() *************** *** 1664,1669 **** --- 1676,1687 ---- v9.CheckDefFailure(lines, 'E1089:') lines =<< trim END + var text: string + redir => text + END + v9.CheckDefFailure(lines, 'E1185:') + + lines =<< trim END var ls = 'asdf' redir => ls[1] redir END *** ../vim-8.2.4394/src/testdir/test_vim9_func.vim 2022-02-12 19:52:22.028702244 +0000 --- src/testdir/test_vim9_func.vim 2022-02-15 20:33:05.522098481 +0000 *************** *** 3762,3768 **** --- 3762,3776 ---- v9.CheckScriptFailure(lines, 'E476:') enddef + " The following messes up syntax highlight, keep near the end. if has('python3') + def Test_python3_command() + py3 import vim + py3 vim.command("let g:done = 'yes'") + assert_equal('yes', g:done) + unlet g:done + enddef + def Test_python3_heredoc() py3 << trim EOF import vim *************** *** 3778,3784 **** enddef endif - " This messes up syntax highlight, keep near the end. if has('lua') def Test_lua_heredoc() g:d = {} --- 3786,3791 ---- *** ../vim-8.2.4394/src/version.c 2022-02-15 19:52:52.886723403 +0000 --- src/version.c 2022-02-15 20:26:39.866824463 +0000 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4395, /**/ -- The real trick is this: to keep the lines as short as possible and keep the size the same yet free from the need for hyphena- Dammit!! (Matthew Winn) /// 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 ///