Describe the bug
In Vim9 script, we cannot pass true as an argument to setqflist(), to specify that an entry is valid.
To Reproduce
Run this shell command:
vim -Nu NONE -S <(cat <<'EOF'
vim9script
let items = [#{filename: '/tmp/file', lnum: 1, valid: true}]
let what = #{items: items}
setqflist([], ' ', what)
EOF
)
And this shell command:
vim -Nu NONE -S <(cat <<'EOF'
vim9script
let items = [#{filename: '/tmp/file', lnum: 1, valid: false}]
let what = #{items: items}
setloclist(0, [], ' ', what)
EOF
)
E611 is raised in both cases:
E611: Using a Special as a Number
Expected behavior
No error is raised.
Environment
Additional context
Regression introduced in 8.2.1465.
I don't know how to fix this issue; the code for the quickfix list is too complex for me. Here is a patch adding a test:
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim index b3b6b3225..c2c7416ec 100644 --- a/src/testdir/test_vim9_func.vim +++ b/src/testdir/test_vim9_func.vim @@ -1609,6 +1609,18 @@ def Test_mapcheck() iunabbrev foo enddef +def Test_setqflist() + let items = [#{filename: '/tmp/file', lnum: 1, valid: true}] + let what = #{items: items} + setqflist([], ' ', what) + assert_equal(1, getqflist()[0].valid) + + items = [#{filename: '/tmp/file', lnum: 1, valid: false}] + what = #{items: items} + setloclist(0, [], ' ', what) + assert_equal(0, getloclist(0)[0].valid) +enddef + def Test_recursive_call() assert_equal(6765, Fibonacci(20)) enddef
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.![]()
Describe the bug
In Vim9 script, we cannot pass
trueas an argument tosetqflist(), to specify that an entry is valid.To Reproduce
Run this shell command:
vim -Nu NONE -S <(cat <<'EOF' vim9script let items = [#{filename: '/tmp/file', lnum: 1, valid: true}] let what = #{items: items} setqflist([], ' ', what) EOF )