# HG changeset patch # User Bram Moolenaar # Date 1627934406 -7200 # Node ID 0160aff01c323e764da722d88b2bd91e0c69a040 # Parent e4e9d42dfd674fcfc704253149e43c63dbce75ab patch 8.2.3278: Vim9: error when adding 1 to float Commit: https://github.com/vim/vim/commit/7bf9a07bd7d6264f623109c2896b2a4002c86080 Author: Bram Moolenaar Date: Mon Aug 2 21:55:15 2021 +0200 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 https://github.com/vim/vim/issues/8687) diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim --- a/src/testdir/test_vim9_assign.vim +++ b/src/testdir/test_vim9_assign.vim @@ -223,6 +223,12 @@ def Test_assignment() g:inc_counter += 1 assert_equal(2, g:inc_counter) + if has('float') + var f: float + f += 1 + assert_equal(1.0, f) + endif + $SOME_ENV_VAR ..= 'more' assert_equal('somemore', $SOME_ENV_VAR) CheckDefFailure(['$SOME_ENV_VAR += "more"'], 'E1051:') diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -756,6 +756,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3278, +/**/ 3277, /**/ 3276, diff --git a/src/vim9compile.c b/src/vim9compile.c --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -7111,7 +7111,8 @@ compile_assignment(char_u *arg, exarg_T if ( #ifdef FEAT_FLOAT // 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 need_type(stacktype, expected, -1, 0, cctx, FALSE, FALSE) == FAIL)