patch 8.2.2254: Vim9: bool option type is number
Problem: Vim9: bool option type is number.
Solution: Have get_option_value() return a different value for bool and
number options. (closes #7583)
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 5602ff5..c2c3fc9 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -5191,9 +5191,9 @@
if (*name == '&')
{
- int cc;
- long numval;
- int opt_type;
+ int cc;
+ long numval;
+ getoption_T opt_type;
*dest = dest_option;
if (cmdidx == CMD_final || cmdidx == CMD_const)
@@ -5214,15 +5214,24 @@
opt_type = get_option_value(skip_option_env_lead(name),
&numval, NULL, *opt_flags);
*p = cc;
- if (opt_type == -3)
+ switch (opt_type)
{
- semsg(_(e_unknown_option), name);
- return FAIL;
+ case gov_unknown:
+ semsg(_(e_unknown_option), name);
+ return FAIL;
+ case gov_string:
+ case gov_hidden_string:
+ *type = &t_string;
+ break;
+ case gov_bool:
+ case gov_hidden_bool:
+ *type = &t_bool;
+ break;
+ case gov_number:
+ case gov_hidden_number:
+ *type = &t_number;
+ break;
}
- if (opt_type == -2 || opt_type == 0)
- *type = &t_string;
- else
- *type = &t_number; // both number and boolean option
}
else if (*name == '$')
{