1
0
forked from aniani/vim

patch 8.2.1641: Vim9: cannot use 0 or 1 where a bool is expected

Problem:    Vim9: cannot use 0 or 1 where a bool is expected.
Solution:   Allow using 0 and 1 for a bool type. (closes #6903)
This commit is contained in:
Bram Moolenaar
2020-09-09 14:55:31 +02:00
parent f842cd9e28
commit 29a86ffee7
6 changed files with 27 additions and 1 deletions

View File

@@ -24,7 +24,7 @@
* Allocate memory for a type_T and add the pointer to type_gap, so that it can
* be freed later.
*/
static type_T *
type_T *
alloc_type(garray_T *type_gap)
{
type_T *type;
@@ -359,6 +359,10 @@ check_type(type_T *expected, type_T *actual, int give_msg, int argidx)
{
if (expected->tt_type != actual->tt_type)
{
if (expected->tt_type == VAR_BOOL && actual->tt_type == VAR_NUMBER
&& (actual->tt_flags & TTFLAG_BOOL_OK))
// Using number 0 or 1 for bool is OK.
return OK;
if (give_msg)
arg_type_mismatch(expected, actual, argidx);
return FAIL;