To: vim_dev@googlegroups.com Subject: Patch 8.2.3165 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3165 Problem: Vim9: in a || expression the error line number may be wrong. Solution: Save and restore the line number when checking the type. (closes #8569) Files: src/vim9compile.c, src/testdir/test_vim9_expr.vim *** ../vim-8.2.3164/src/vim9compile.c 2021-07-11 20:22:26.260154906 +0200 --- src/vim9compile.c 2021-07-15 14:57:41.463959951 +0200 *************** *** 5095,5100 **** --- 5095,5101 ---- while (p[0] == opchar && p[1] == opchar) { long start_lnum = SOURCING_LNUM; + long save_sourcing_lnum; int start_ctx_lnum = cctx->ctx_lnum; int save_lnum; *************** *** 5116,5121 **** --- 5117,5123 ---- generate_ppconst(cctx, ppconst); // Every part must evaluate to a bool. + save_sourcing_lnum = SOURCING_LNUM; SOURCING_LNUM = start_lnum; save_lnum = cctx->ctx_lnum; cctx->ctx_lnum = start_ctx_lnum; *************** *** 5138,5143 **** --- 5140,5146 ---- ? JUMP_IF_COND_TRUE : JUMP_IF_COND_FALSE, 0); // eval the next expression + SOURCING_LNUM = save_sourcing_lnum; if (may_get_next_line_error(p + 2, arg, cctx) == FAIL) { ga_clear(&end_ga); *** ../vim-8.2.3164/src/testdir/test_vim9_expr.vim 2021-07-15 12:48:08.811766844 +0200 --- src/testdir/test_vim9_expr.vim 2021-07-15 14:57:02.680030756 +0200 *************** *** 401,406 **** --- 401,413 ---- # comment END CheckScriptFailure(lines, 'E1004: White space required before and after ''||'' at "||true"', 3) + + lines =<< trim END + var x = false + || false + || a.b + END + CheckDefFailure(lines, 'E1001:', 3) enddef " test && *** ../vim-8.2.3164/src/version.c 2021-07-15 14:14:26.288058735 +0200 --- src/version.c 2021-07-15 14:55:02.328256088 +0200 *************** *** 757,758 **** --- 757,760 ---- { /* Add new patch number below this line */ + /**/ + 3165, /**/ -- You are not really successful until someone claims he sat beside you in school. /// 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 ///