]> granicus.if.org Git - vim/commitdiff
patch 8.2.1601: Vim9: cannot use 'true" with garbagecollect() v8.2.1601
authorBram Moolenaar <Bram@vim.org>
Sat, 5 Sep 2020 15:30:44 +0000 (17:30 +0200)
committerBram Moolenaar <Bram@vim.org>
Sat, 5 Sep 2020 15:30:44 +0000 (17:30 +0200)
Problem:    Vim9: cannot use 'true" with garbagecollect().
Solution:   Use tv_get_bool(). (closes #6871)

src/evalfunc.c
src/testdir/test_vim9_func.vim
src/version.c

index 1764f414ea7ef2e9aa471abbab8f5e09657e5c76..aefb1bf4b14ea34648a03c8fbf0fa987cb72792b 100644 (file)
@@ -2936,7 +2936,7 @@ f_garbagecollect(typval_T *argvars, typval_T *rettv UNUSED)
     // using Lists and Dicts internally.  E.g.: ":echo [garbagecollect()]".
     want_garbage_collect = TRUE;
 
-    if (argvars[0].v_type != VAR_UNKNOWN && tv_get_number(&argvars[0]) == 1)
+    if (argvars[0].v_type != VAR_UNKNOWN && tv_get_bool(&argvars[0]) == 1)
        garbage_collect_at_exit = TRUE;
 }
 
index 8651ef8ebdc4f1fa586ada97f432b7507486b1c4..7cc323c1e2b0f4f06b6fc6490a768454f4b97acf 100644 (file)
@@ -1285,6 +1285,10 @@ def Test_extend_return_type()
   assert_equal(6, res)
 enddef
 
+def Test_garbagecollect()
+  garbagecollect(true)
+enddef
+
 def Test_insert_return_type()
   let l = insert([2, 1], 3)
   let res = 0
index 8ebf9a71671d6edaa12c8684321458e4ea677fb5..ab9c0c41d8ddb6b66c6a81c3626dcc40755c1d43 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1601,
 /**/
     1600,
 /**/