patch 8.2.3296: Vim9: cannot add a number to a float
Problem: Vim9: cannot add a number to a float.
Solution: Accept a number if the destination is a float. (closes #8703)
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 1c6e328..d2a6f68 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -7021,8 +7021,10 @@
// Special case: assigning to @# can use a number or a
// string.
- if (lhs_type == &t_number_or_string
- && rhs_type->tt_type == VAR_NUMBER)
+ // Also: can assign a number to a float.
+ if ((lhs_type == &t_number_or_string
+ || lhs_type == &t_float)
+ && rhs_type->tt_type == VAR_NUMBER)
lhs_type = &t_number;
if (*p != '=' && need_type(rhs_type, lhs_type,
-1, 0, cctx, FALSE, FALSE) == FAIL)