patch 9.1.2049: Vim9: unexpected E1209 error
Commit:
https://github.com/vim/vim/commit/4a9967bddfc55499653d5b2e467f488eccb7a2fb
Author: Hirohito Higashi <[email protected]>
Date: Sat Jan 3 17:16:23 2026 +0000
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 <[email protected]>
Signed-off-by: Christian Brabandt <[email protected]>
diff --git a/src/eval.c b/src/eval.c
index 15ee3fe11..254a0c608 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 a07ba8c09..4346c1471 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<any>', '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 7375bfbb2..8311522df 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,
/**/
--
--
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 visit
https://groups.google.com/d/msgid/vim_dev/E1vc5S0-00CKlv-2Y%40256bit.org.