To: vim_dev@googlegroups.com Subject: Patch 8.2.1371 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.1371 Problem: Vim9: no error for missing white space around operator. Solution: Check for white space around && and ||. Files: src/eval.c, src/testdir/test_vim9_expr.vim *** ../vim-8.2.1370/src/eval.c 2020-08-05 11:51:26.545858013 +0200 --- src/eval.c 2020-08-05 12:31:10.916295559 +0200 *************** *** 2242,2252 **** --- 2242,2266 ---- if (getnext) *arg = eval_next_line(evalarg_used); else + { + if (evaluate && in_vim9script() && !VIM_ISWHITE(p[-1])) + { + error_white_both(p, 2); + clear_tv(rettv); + return FAIL; + } *arg = p; + } /* * Get the second variable. */ + if (evaluate && in_vim9script() && !IS_WHITE_OR_NUL((*arg)[2])) + { + error_white_both(p, 2); + clear_tv(rettv); + return FAIL; + } *arg = skipwhite_and_linebreak(*arg + 2, evalarg_used); evalarg_used->eval_flags = !result ? orig_flags : orig_flags & ~EVAL_EVALUATE; *************** *** 2359,2369 **** --- 2373,2397 ---- if (getnext) *arg = eval_next_line(evalarg_used); else + { + if (evaluate && in_vim9script() && !VIM_ISWHITE(p[-1])) + { + error_white_both(p, 2); + clear_tv(rettv); + return FAIL; + } *arg = p; + } /* * Get the second variable. */ + if (evaluate && in_vim9script() && !IS_WHITE_OR_NUL((*arg)[2])) + { + error_white_both(p, 2); + clear_tv(rettv); + return FAIL; + } *arg = skipwhite_and_linebreak(*arg + 2, evalarg_used); evalarg_used->eval_flags = result ? orig_flags : orig_flags & ~EVAL_EVALUATE; *** ../vim-8.2.1370/src/testdir/test_vim9_expr.vim 2020-08-05 11:51:26.545858013 +0200 --- src/testdir/test_vim9_expr.vim 2020-08-05 12:28:08.281051273 +0200 *************** *** 175,180 **** --- 175,197 ---- END CheckScriptSuccess(lines) + # check white space + lines =<< trim END + vim9script + let var = v:true||v:true + END + CheckScriptFailure(lines, 'E1004:') + lines =<< trim END + vim9script + let var = v:true ||v:true + END + CheckScriptFailure(lines, 'E1004:') + lines =<< trim END + vim9script + let var = v:true|| v:true + END + CheckScriptFailure(lines, 'E1004:') + # check keeping the value lines =<< trim END vim9script *************** *** 279,284 **** --- 296,318 ---- END CheckScriptSuccess(lines) + # check white space + lines =<< trim END + vim9script + let var = v:true&&v:true + END + CheckScriptFailure(lines, 'E1004:') + lines =<< trim END + vim9script + let var = v:true &&v:true + END + CheckScriptFailure(lines, 'E1004:') + lines =<< trim END + vim9script + let var = v:true&& v:true + END + CheckScriptFailure(lines, 'E1004:') + # check keeping the value lines =<< trim END vim9script *** ../vim-8.2.1370/src/version.c 2020-08-05 12:10:46.134836943 +0200 --- src/version.c 2020-08-05 12:31:59.808100571 +0200 *************** *** 756,757 **** --- 756,759 ---- { /* Add new patch number below this line */ + /**/ + 1371, /**/ -- You cannot have a baby in one month by getting nine women pregnant. /// 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 ///