Patch 8.2.4540
Problem:    Line number for error is off by one.
Solution:   Remember the line number of the comparison. (closes #9923)
Files:      src/eval.c, src/testdir/test_vim9_expr.vim


*** ../vim-8.2.4539/src/eval.c  2022-03-08 13:18:10.809020782 +0000
--- src/eval.c  2022-03-10 19:54:19.040646239 +0000
***************
*** 2849,2854 ****
--- 2849,2855 ----
        int         vim9script = in_vim9script();
        int         evaluate = evalarg == NULL
                                   ? 0 : (evalarg->eval_flags & EVAL_EVALUATE);
+       long        comp_lnum = SOURCING_LNUM;
  
        if (getnext)
        {
***************
*** 2904,2909 ****
--- 2905,2912 ----
        {
            int ret;
  
+           // use the line of the comparison for messages
+           SOURCING_LNUM = comp_lnum;
            if (vim9script && check_compare_types(type, rettv, &var2) == FAIL)
            {
                ret = FAIL;
*** ../vim-8.2.4539/src/testdir/test_vim9_expr.vim      2022-03-10 
19:23:24.333580627 +0000
--- src/testdir/test_vim9_expr.vim      2022-03-10 19:52:04.604950589 +0000
***************
*** 844,849 ****
--- 844,856 ----
    v9.CheckDefAndScriptFailure(['echo [] == v:none'], 'E1072: Cannot compare 
list with special')
    v9.CheckDefAndScriptFailure(['echo 123 == v:none'], 'E1072: Cannot compare 
number with special')
    v9.CheckDefAndScriptFailure(['echo 0z00 == v:none'], 'E1072: Cannot compare 
blob with special')
+ 
+   lines =<< trim END
+       echo [] == v:none
+ 
+       eval 0 + 0
+   END
+   v9.CheckDefAndScriptFailure(lines, 'E1072:', 1)
  enddef
  
  def Test_expr4_wrong_type()
*** ../vim-8.2.4539/src/version.c       2022-03-10 19:23:24.333580627 +0000
--- src/version.c       2022-03-10 19:53:20.772777941 +0000
***************
*** 752,753 ****
--- 752,755 ----
  {   /* Add new patch number below this line */
+ /**/
+     4540,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
226. You sit down at the computer right after dinner and your spouse
     says "See you in the morning."

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220310200925.10AC91C0DCA%40moolenaar.net.

Raspunde prin e-mail lui