To: vim_dev@googlegroups.com Subject: Patch 8.2.4675 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.4675 Problem: No error for missing expression after :elseif. (Ernie Rael) Solution: Check for missing expression. (closes #10068) Files: src/ex_eval.c, src/testdir/test_vim9_script.vim *** ../vim-8.2.4674/src/ex_eval.c 2022-03-03 15:11:15.082646961 +0000 --- src/ex_eval.c 2022-04-03 16:08:39.336652634 +0100 *************** *** 1146,1152 **** if (eap->cmdidx == CMD_elseif) { ! result = eval_to_bool(eap->arg, &error, eap, skip); // When throwing error exceptions, we want to throw always the first // of several errors in a row. This is what actually happens when --- 1146,1157 ---- if (eap->cmdidx == CMD_elseif) { ! // When skipping we ignore most errors, but a missing expression is ! // wrong, perhaps it should have been "else". ! if (skip && ends_excmd(*eap->arg)) ! semsg(_(e_invalid_expression_str), eap->arg); ! else ! result = eval_to_bool(eap->arg, &error, eap, skip); // When throwing error exceptions, we want to throw always the first // of several errors in a row. This is what actually happens when *** ../vim-8.2.4674/src/testdir/test_vim9_script.vim 2022-04-02 19:43:53.927491819 +0100 --- src/testdir/test_vim9_script.vim 2022-04-03 16:12:19.748419484 +0100 *************** *** 1605,1610 **** --- 1605,1620 ---- endif END v9.CheckDefFailure(lines, 'E488:') + + lines =<< trim END + var cond = true + if cond + echo 'true' + elseif + echo 'false' + endif + END + v9.CheckDefAndScriptFailure(lines, ['E1143:', 'E15:'], 4) enddef let g:bool_true = v:true *** ../vim-8.2.4674/src/version.c 2022-04-03 15:46:57.389502603 +0100 --- src/version.c 2022-04-03 16:10:18.188551235 +0100 *************** *** 752,753 **** --- 752,755 ---- { /* Add new patch number below this line */ + /**/ + 4675, /**/ -- Permission is granted to read this message out aloud on Kings Cross Road, London, under the condition that the orator is properly dressed. /// 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 ///