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)
diff --git a/src/vim9execute.c b/src/vim9execute.c
index a6d43b5..06229b8 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -6872,16 +6872,23 @@
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);