Mercurial > vim
diff src/vim9execute.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 | 065e4ccf5e10 |
children | fc9ce07dc8a4 |
line wrap: on
line diff
--- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -6872,16 +6872,23 @@ list_instructions(char *pfx, isn_T *inst case ISN_CHECKTYPE: { checktype_T *ct = &iptr->isn_arg.type; - char *tofree; + char *tofree = NULL; + char *typename; + + if (ct->ct_type->tt_type == VAR_FLOAT + && (ct->ct_type->tt_flags & TTFLAG_NUMBER_OK)) + typename = "float|number"; + else + typename = type_name(ct->ct_type, &tofree); if (ct->ct_arg_idx == 0) smsg("%s%4d CHECKTYPE %s stack[%d]", pfx, current, - type_name(ct->ct_type, &tofree), + typename, (int)ct->ct_off); else smsg("%s%4d CHECKTYPE %s stack[%d] %s %d", pfx, current, - type_name(ct->ct_type, &tofree), + typename, (int)ct->ct_off, ct->ct_is_var ? "var": "arg", (int)ct->ct_arg_idx);