patch 9.1.0900: Vim9: digraph_getlist() does not accept bool arg

Commit: 
https://github.com/vim/vim/commit/198ada3d9f48c6556d20c4115ec500555b118aad
Author: Yegappan Lakshmanan <yegap...@yahoo.com>
Date:   Mon Dec 2 19:58:51 2024 +0100

    patch 9.1.0900: Vim9: digraph_getlist() does not accept bool arg
    
    Problem:  Vim9: digraph_getlist() does not accept bool argument
              (Maxim Kim)
    Solution: accept boolean as first argument (Yegappan Lakshmanan)
    
    fixes: #16154
    closes: #16159
    
    Signed-off-by: Yegappan Lakshmanan <yegap...@yahoo.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/digraph.c b/src/digraph.c
index f19e58ec7..32b36be22 100644
--- a/src/digraph.c
+++ b/src/digraph.c
@@ -2115,18 +2115,15 @@ f_digraph_getlist(typval_T *argvars, typval_T *rettv)
 # ifdef FEAT_DIGRAPHS
     int     flag_list_all;
 
-    if (in_vim9script() && check_for_opt_bool_arg(argvars, 0) == FAIL)
+    if (check_for_opt_bool_arg(argvars, 0) == FAIL)
        return;
 
     if (argvars[0].v_type == VAR_UNKNOWN)
        flag_list_all = FALSE;
     else
     {
-       int         error = FALSE;
-       varnumber_T flag = tv_get_number_chk(&argvars[0], &error);
+       varnumber_T flag = tv_get_bool(&argvars[0]);
 
-       if (error)
-           return;
        flag_list_all = flag ? TRUE : FALSE;
     }
 
diff --git a/src/testdir/test_digraph.vim b/src/testdir/test_digraph.vim
index 16eb0b158..88b8ded95 100644
--- a/src/testdir/test_digraph.vim
+++ b/src/testdir/test_digraph.vim
@@ -605,8 +605,10 @@ func Test_digraph_getlist_function()
   " of digraphs returned.
   call assert_equal(digraph_getlist()->len(), digraph_getlist(0)->len())
   call assert_notequal(digraph_getlist()->len(), digraph_getlist(1)->len())
+  call assert_equal(digraph_getlist()->len(), digraph_getlist(v:false)->len())
+  call assert_notequal(digraph_getlist()->len(), 
digraph_getlist(v:true)->len())
 
-  call assert_fails('call digraph_getlist(0z12)', 'E974: Using a Blob as a 
Number')
+  call assert_fails('call digraph_getlist(0z12)', 'E1212: Bool required for 
argument 1')
 endfunc
 
 
diff --git a/src/testdir/test_vim9_builtin.vim 
b/src/testdir/test_vim9_builtin.vim
index 7ed912365..6103453a2 100644
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -963,6 +963,18 @@ enddef
 def Test_digraph_getlist()
   v9.CheckSourceDefAndScriptFailure(['digraph_getlist(10)'], ['E1013: Argument 
1: type mismatch, expected bool but got number', 'E1212: Bool required for 
argument 1'])
   v9.CheckSourceDefAndScriptFailure(['digraph_getlist("")'], ['E1013: Argument 
1: type mismatch, expected bool but got string', 'E1212: Bool required for 
argument 1'])
+
+  var lines =<< trim END
+    var l = digraph_getlist(true)
+    assert_notequal([], l)
+    l = digraph_getlist(false)
+    assert_equal([], l)
+    l = digraph_getlist(1)
+    assert_notequal([], l)
+    l = digraph_getlist(0)
+    assert_equal([], l)
+  END
+  v9.CheckSourceDefAndScriptSuccess(lines)
 enddef
 
 def Test_digraph_set()
diff --git a/src/version.c b/src/version.c
index 7558bdc1b..6703606cf 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    900,
 /**/
     899,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1tIBsz-003f1b-N6%40256bit.org.

Raspunde prin e-mail lui