patch 8.2.2369: Vim9: functions return true/false but can't be used as bool
Problem: Vim9: functions return true/false but can't be used as bool.
Solution: Add ret_number_bool(). (closes #7693)
diff --git a/src/testdir/test_vim9_builtin.vim b/src/testdir/test_vim9_builtin.vim
index 61d129e..50dc2a0 100644
--- a/src/testdir/test_vim9_builtin.vim
+++ b/src/testdir/test_vim9_builtin.vim
@@ -115,6 +115,21 @@
CheckDefExecFailure(lines, 'E1131:', 2)
enddef
+def Test_append()
+ new
+ setline(1, range(3))
+ var res1: number = append(1, 'one')
+ assert_equal(0, res1)
+ var res2: bool = append(3, 'two')
+ assert_equal(false, res2)
+ assert_equal(['0', 'one', '1', 'two', '2'], getline(1, 6))
+enddef
+
+def Test_buflisted()
+ var res: bool = buflisted('asdf')
+ assert_equal(false, res)
+enddef
+
def Test_bufname()
split SomeFile
bufname('%')->assert_equal('SomeFile')
@@ -199,6 +214,11 @@
CheckDefExecAndScriptFailure(lines, 'E475:')
enddef
+def Test_delete()
+ var res: bool = delete('doesnotexist')
+ assert_equal(true, res)
+enddef
+
def Test_executable()
assert_false(executable(""))
assert_false(executable(test_null_string()))
diff --git a/src/testdir/test_vim9_disassemble.vim b/src/testdir/test_vim9_disassemble.vim
index 83dcda0..1aab9d5 100644
--- a/src/testdir/test_vim9_disassemble.vim
+++ b/src/testdir/test_vim9_disassemble.vim
@@ -762,7 +762,7 @@
'if has("gui_running")\_s*' ..
'\d PUSHS "gui_running"\_s*' ..
'\d BCALL has(argc 1)\_s*' ..
- '\d COND2BOOL\_s*' ..
+ '\d 2BOOL (!!val)\_s*' ..
'\d JUMP_IF_FALSE -> \d\_s*' ..
' echo "yes"\_s*' ..
'\d PUSHS "yes"\_s*' ..