0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 8.2.2261: Vim9: boolean option gets string type

Problem:    Vim9: boolean option gets string type.
Solution:   Check for VAR_BOOL. (closes #7588)
This commit is contained in:
Bram Moolenaar
2021-01-01 14:49:15 +01:00
parent 5efe0e5d16
commit d5ea8f08f7
3 changed files with 10 additions and 2 deletions

View File

@@ -2417,6 +2417,11 @@ def Test_expr7_option()
&grepprg = test_null_string() &grepprg = test_null_string()
assert_equal('', &grepprg) assert_equal('', &grepprg)
set grepprg& set grepprg&
# check matching type
var bval: bool = &tgc
var nval: number = &ts
var sval: string = &path
enddef enddef
def Test_expr7_environment() def Test_expr7_environment()

View File

@@ -750,6 +750,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 */
/**/
2261,
/**/ /**/
2260, 2260,
/**/ /**/

View File

@@ -3172,8 +3172,9 @@ compile_get_option(char_u **arg, cctx_T *cctx)
if (ret == OK) if (ret == OK)
{ {
// include the '&' in the name, eval_option() expects it. // include the '&' in the name, eval_option() expects it.
char_u *name = vim_strnsave(start, *arg - start); char_u *name = vim_strnsave(start, *arg - start);
type_T *type = rettv.v_type == VAR_NUMBER ? &t_number : &t_string; type_T *type = rettv.v_type == VAR_BOOL ? &t_bool
: rettv.v_type == VAR_NUMBER ? &t_number : &t_string;
ret = generate_LOAD(cctx, ISN_LOADOPT, 0, name, type); ret = generate_LOAD(cctx, ISN_LOADOPT, 0, name, type);
vim_free(name); vim_free(name);