1
0
forked from aniani/vim

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)
This commit is contained in:
Bram Moolenaar
2021-08-05 19:01:17 +02:00
parent 4f33bc20d7
commit af647e76ca
3 changed files with 23 additions and 2 deletions

View File

@@ -7021,8 +7021,10 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
// 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)