0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 9.0.1108: type error when using "any" type and adding to float

Problem:    Type error when using "any" type and adding a number to a float.
Solution:   Accept both a number and a float. (closes #11753)
This commit is contained in:
Bram Moolenaar
2022-12-29 20:56:24 +00:00
parent 73ade49c4b
commit c6951a76a5
12 changed files with 117 additions and 54 deletions

View File

@@ -1045,7 +1045,7 @@ compile_for(char_u *arg_start, cctx_T *cctx)
if (lhs_type == &t_any)
lhs_type = item_type;
else if (item_type != &t_unknown
&& need_type_where(item_type, lhs_type, -1,
&& need_type_where(item_type, lhs_type, FALSE, -1,
where, cctx, FALSE, FALSE) == FAIL)
goto failed;
var_lvar = reserve_local(cctx, arg, varlen, ASSIGN_FINAL,
@@ -2469,7 +2469,7 @@ compile_redir(char_u *line, exarg_T *eap, cctx_T *cctx)
if (compile_assign_lhs(arg, lhs, CMD_redir,
FALSE, FALSE, FALSE, 1, cctx) == FAIL)
return NULL;
if (need_type(&t_string, lhs->lhs_member_type,
if (need_type(&t_string, lhs->lhs_member_type, FALSE,
-1, 0, cctx, FALSE, FALSE) == FAIL)
return NULL;
if (cctx->ctx_skip == SKIP_YES)
@@ -2551,7 +2551,7 @@ compile_return(char_u *arg, int check_return_type, int legacy, cctx_T *cctx)
int save_flags = cmdmod.cmod_flags;
generate_LEGACY_EVAL(cctx, p);
if (need_type(&t_any, cctx->ctx_ufunc->uf_ret_type, -1,
if (need_type(&t_any, cctx->ctx_ufunc->uf_ret_type, FALSE, -1,
0, cctx, FALSE, FALSE) == FAIL)
return NULL;
cmdmod.cmod_flags |= CMOD_LEGACY;
@@ -2580,8 +2580,8 @@ compile_return(char_u *arg, int check_return_type, int legacy, cctx_T *cctx)
}
else
{
if (need_type(stack_type, cctx->ctx_ufunc->uf_ret_type, -1,
0, cctx, FALSE, FALSE) == FAIL)
if (need_type(stack_type, cctx->ctx_ufunc->uf_ret_type, FALSE,
-1, 0, cctx, FALSE, FALSE) == FAIL)
return NULL;
}
}