0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.3278: Vim9: error when adding 1 to float

Problem:    Vim9: error when adding 1 to float.
Solution:   Accept t_number_bool. (closes #8687)
This commit is contained in:
Bram Moolenaar
2021-08-02 21:55:15 +02:00
parent c3160727b9
commit 7bf9a07bd7
3 changed files with 10 additions and 1 deletions

View File

@@ -223,6 +223,12 @@ def Test_assignment()
g:inc_counter += 1 g:inc_counter += 1
assert_equal(2, g:inc_counter) assert_equal(2, g:inc_counter)
if has('float')
var f: float
f += 1
assert_equal(1.0, f)
endif
$SOME_ENV_VAR ..= 'more' $SOME_ENV_VAR ..= 'more'
assert_equal('somemore', $SOME_ENV_VAR) assert_equal('somemore', $SOME_ENV_VAR)
CheckDefFailure(['$SOME_ENV_VAR += "more"'], 'E1051:') CheckDefFailure(['$SOME_ENV_VAR += "more"'], 'E1051:')

View File

@@ -755,6 +755,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
3278,
/**/ /**/
3277, 3277,
/**/ /**/

View File

@@ -7111,7 +7111,8 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
if ( if (
#ifdef FEAT_FLOAT #ifdef FEAT_FLOAT
// If variable is float operation with number is OK. // If variable is float operation with number is OK.
!(expected == &t_float && stacktype == &t_number) && !(expected == &t_float && (stacktype == &t_number
|| stacktype == &t_number_bool)) &&
#endif #endif
need_type(stacktype, expected, -1, 0, cctx, need_type(stacktype, expected, -1, 0, cctx,
FALSE, FALSE) == FAIL) FALSE, FALSE) == FAIL)