patch 8.2.4540: line number for error is off by one
Problem: Line number for error is off by one.
Solution: Remember the line number of the comparison. (closes #9923)
diff --git a/src/eval.c b/src/eval.c
index a48b8f8..1d57c38 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2849,6 +2849,7 @@
int vim9script = in_vim9script();
int evaluate = evalarg == NULL
? 0 : (evalarg->eval_flags & EVAL_EVALUATE);
+ long comp_lnum = SOURCING_LNUM;
if (getnext)
{
@@ -2904,6 +2905,8 @@
{
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;