# HG changeset patch # User Bram Moolenaar # Date 1599325203 -7200 # Node ID a71d7dcba862197e3ec5d0cd5f799ed258291e33 # Parent 0c20a211a4effb6ae5a3524a4980496569d3c134 patch 8.2.1606: Vim9: cannot use "true" with has() Commit: https://github.com/vim/vim/commit/04637e243d39f791cfc97c3ce96d99ef1bf047e1 Author: Bram Moolenaar Date: Sat Sep 5 18:45:29 2020 +0200 patch 8.2.1606: Vim9: cannot use "true" with has() Problem: Vim9: cannot use "true" with has(). Solution: Use tv_get_bool(). (closes https://github.com/vim/vim/issues/6876) diff --git a/src/evalfunc.c b/src/evalfunc.c --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -4763,7 +4763,7 @@ f_has(typval_T *argvars, typval_T *rettv } } - if (argvars[1].v_type != VAR_UNKNOWN && tv_get_number(&argvars[1]) != 0) + if (argvars[1].v_type != VAR_UNKNOWN && tv_get_bool(&argvars[1])) // return whether feature could ever be enabled rettv->vval.v_number = x; else diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1516,6 +1516,10 @@ def Test_getcompletion() set wildignore& enddef +def Test_has() + assert_equal(1, has('eval', true)) +enddef + def Fibonacci(n: number): number if n < 2 return n diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -755,6 +755,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1606, +/**/ 1605, /**/ 1604,