From: Hirohito Higashi Date: Sat, 3 Jan 2026 17:16:23 +0000 (+0000) Subject: patch 9.1.2049: Vim9: unexpected E1209 error X-Git-Tag: v9.1.2049^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a9967bddfc55499653d5b2e467f488eccb7a2fb;p=thirdparty%2Fvim.git patch 9.1.2049: Vim9: unexpected E1209 error Problem: Vim9: unexpected E1209 error Solution: Fix error message (Hirohito Higashi) closes: #19067 Signed-off-by: Hirohito Higashi Signed-off-by: Christian Brabandt --- diff --git a/src/eval.c b/src/eval.c index 15ee3fe110..254a0c6083 100644 --- a/src/eval.c +++ b/src/eval.c @@ -6799,13 +6799,13 @@ var2fpos( char_u *name; static pos_T pos; pos_T *pp; + int error = FALSE; // Argument can be [lnum, col, coladd]. if (varp->v_type == VAR_LIST) { list_T *l; int len; - int error = FALSE; listitem_T *li; l = varp->vval.v_list; @@ -6857,11 +6857,16 @@ var2fpos( if (name == NULL) return NULL; + error = TRUE; pos.lnum = 0; - if (name[0] == '.' && (!in_vim9script() || name[1] == NUL)) + if (name[0] == '.') { - // cursor - pos = curwin->w_cursor; + if (!in_vim9script() || name[1] == NUL) + { + error = FALSE; + // cursor + pos = curwin->w_cursor; + } } else if (name[0] == 'v' && name[1] == NUL) { @@ -6871,14 +6876,17 @@ var2fpos( else pos = curwin->w_cursor; } - else if (name[0] == '\'' && (!in_vim9script() - || (name[1] != NUL && name[2] == NUL))) + else if (name[0] == '\'') { - // mark - pp = getmark_buf_fnum(curbuf, name[1], FALSE, fnum); - if (pp == NULL || pp == (pos_T *)-1 || pp->lnum <= 0) - return NULL; - pos = *pp; + if (!in_vim9script() || (name[1] != NUL && name[2] == NUL)) + { + error = FALSE; + // mark + pp = getmark_buf_fnum(curbuf, name[1], FALSE, fnum); + if (pp == NULL || pp == (pos_T *)-1 || pp->lnum <= 0) + return NULL; + pos = *pp; + } } if (pos.lnum != 0) { @@ -6929,7 +6937,7 @@ var2fpos( } return &pos; } - if (in_vim9script()) + if (in_vim9script() && error) semsg(_(e_invalid_value_for_line_number_str), name); return NULL; } diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim index a07ba8c099..4346c14713 100644 --- a/src/testdir/test_vim9_builtin.vim +++ b/src/testdir/test_vim9_builtin.vim @@ -804,6 +804,10 @@ def Test_col() v9.CheckSourceDefAndScriptFailure(['col(true)'], ['E1013: Argument 1: type mismatch, expected string but got bool', 'E1222: String or List required for argument 1']) v9.CheckSourceDefAndScriptFailure(['col(".", [])'], ['E1013: Argument 2: type mismatch, expected number but got list', 'E1210: Number required for argument 2']) v9.CheckSourceDefExecAndScriptFailure(['col("")'], 'E1209: Invalid value for a line number') + v9.CheckSourceDefExecAndScriptFailure(['col(".1")'], 'E1209: Invalid value for a line number') + v9.CheckSourceDefAndScriptSuccess(['col(".")']) + v9.CheckSourceDefExecAndScriptFailure(['col("\''a1")'], 'E1209: Invalid value for a line number') + v9.CheckSourceDefAndScriptSuccess(['col("\''a")']) bw! enddef diff --git a/src/version.c b/src/version.c index 7375bfbb26..8311522dfa 100644 --- a/src/version.c +++ b/src/version.c @@ -734,6 +734,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2049, /**/ 2048, /**/