Mercurial > vim
diff src/vim9cmds.c @ 31551:67d9fbe516a3 v9.0.1108
patch 9.0.1108: type error when using "any" type and adding to float
Commit: https://github.com/vim/vim/commit/c6951a76a58663ef8a773d340f2260da7455643c
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Dec 29 20:56:24 2022 +0000
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 https://github.com/vim/vim/issues/11753)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Thu, 29 Dec 2022 22:00:04 +0100 |
parents | 25d8ba667c5a |
children | 53c3df37a2b0 |
line wrap: on
line diff
--- a/src/vim9cmds.c +++ b/src/vim9cmds.c @@ -1045,7 +1045,7 @@ compile_for(char_u *arg_start, cctx_T *c 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 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_re 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_re } 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; } }