0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 8.2.2297: Vim9: cannot set 'number' to a boolean value

Problem:    Vim9: cannot set 'number' to a boolean value.
Solution:   Use tv_get_bool(). (closes #7615)
This commit is contained in:
Bram Moolenaar
2021-01-04 13:37:54 +01:00
parent 014f698cb6
commit 0ea0440865
3 changed files with 19 additions and 2 deletions

View File

@@ -1370,8 +1370,14 @@ ex_let_one(
|| opt_type == gov_hidden_bool
|| opt_type == gov_hidden_number)
&& (tv->v_type != VAR_STRING || !in_vim9script()))
// number, possibly hidden
n = (long)tv_get_number(tv);
{
if (opt_type == gov_bool || opt_type == gov_hidden_bool)
// bool, possibly hidden
n = (long)tv_get_bool(tv);
else
// number, possibly hidden
n = (long)tv_get_number(tv);
}
// Avoid setting a string option to the text "v:false" or similar.
// In Vim9 script also don't convert a number to string.