0
0
mirror of https://github.com/vim/vim.git synced 2025-09-26 04:04:07 -04:00

patch 8.2.1795: Vim9: operators && and || have a confusing result

Problem:    Vim9: operators && and || have a confusing result.
Solution:   Make the result a boolean.
This commit is contained in:
Bram Moolenaar
2020-10-03 22:52:39 +02:00
parent 92f26c256e
commit 2bb2658bef
12 changed files with 254 additions and 216 deletions

View File

@@ -22,11 +22,11 @@ def Test_assignment_bool()
var bool4: bool = 1
assert_equal(true, bool4)
var bool5: bool = 'yes' && 'no'
var bool5: bool = 1 && true
assert_equal(true, bool5)
var bool6: bool = [] && 99
var bool6: bool = 0 && 1
assert_equal(false, bool6)
var bool7: bool = [] || #{a: 1} && 99
var bool7: bool = 0 || 1 && true
assert_equal(true, bool7)
var lines =<< trim END
@@ -41,9 +41,9 @@ def Test_assignment_bool()
assert_equal(false, flag)
flag = 1
assert_equal(true, flag)
flag = 99 || 123
flag = 1 || true
assert_equal(true, flag)
flag = 'yes' && []
flag = 1 && false
assert_equal(false, flag)
END
CheckScriptSuccess(lines)