Skip to content

Commit cd26801

Browse files
committed
patch 8.2.3203: Vim9: compiled string expression causes type error
Problem: Vim9: compiled string expression causes type error. (Yegappan Lakshmanan) Solution: Remove the string type from the stack.
1 parent 5dd839c commit cd26801

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/evalfunc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,6 +711,8 @@ static argcheck_T arg3_slice[] = {arg_slice1, arg_number, arg_number};
711711
static argcheck_T arg4_strpart[] = {arg_string, arg_number, arg_number, arg_bool};
712712
static argcheck_T arg23_win_execute[] = {arg_number, arg_string_or_list_string, arg_string};
713713
static argcheck_T arg4_match_func[] = {arg_string_or_list_any, arg_string, arg_number, arg_number};
714+
static argcheck_T arg15_search[] = {arg_string, arg_string, arg_number, arg_number, NULL};
715+
714716

715717
/*
716718
* Functions that return the return type of a builtin function.
@@ -1738,7 +1740,7 @@ static funcentry_T global_functions[] =
17381740
ret_number, f_screenrow},
17391741
{"screenstring", 2, 2, FEARG_1, arg2_number,
17401742
ret_string, f_screenstring},
1741-
{"search", 1, 5, FEARG_1, NULL,
1743+
{"search", 1, 5, FEARG_1, arg15_search,
17421744
ret_number, f_search},
17431745
{"searchcount", 0, 1, FEARG_1, arg1_dict_any,
17441746
ret_dict_any, f_searchcount},

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,8 @@ static char *(features[]) =
755755

756756
static int included_patches[] =
757757
{ /* Add new patch number below this line */
758+
/**/
759+
3203,
758760
/**/
759761
3202,
760762
/**/

src/vim9compile.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3244,6 +3244,9 @@ compile_string(isn_T *isn, cctx_T *cctx)
32443244
int instr_count;
32453245
isn_T *instr = NULL;
32463246

3247+
// Remove the string type from the stack.
3248+
--cctx->ctx_type_stack.ga_len;
3249+
32473250
// Temporarily reset the list of instructions so that the jump labels are
32483251
// correct.
32493252
cctx->ctx_instr.ga_len = 0;
@@ -4263,8 +4266,8 @@ compile_subscript(
42634266
}
42644267
}
42654268

4266-
// Do not skip over white space to find the "(", "execute 'x' ()" is
4267-
// not a function call.
4269+
// Do not skip over white space to find the "(", "execute 'x' (expr)"
4270+
// is not a function call.
42684271
if (**arg == '(')
42694272
{
42704273
garray_T *stack = &cctx->ctx_type_stack;

0 commit comments

Comments
 (0)