0
0
mirror of https://github.com/vim/vim.git synced 2025-09-24 03:44:06 -04:00

patch 8.2.1650: Vim9: result of && and || expression is not bool in script

Problem:    Vim9: result of && and || expression cannot be assigned to a bool
            at the script level.
Solution:   Add the VAR_BOOL_OK flag.  Convert to bool when needed.
This commit is contained in:
Bram Moolenaar
2020-09-09 22:27:58 +02:00
parent 3e4cc9671c
commit c1ec0422e4
8 changed files with 92 additions and 29 deletions

View File

@@ -66,13 +66,13 @@ def Test_assignment_bool()
let flag: bool = GetFlag()
assert_equal(true, flag)
flag = 0
# assert_equal(false, flag)
assert_equal(false, flag)
flag = 1
# assert_equal(true, flag)
# flag = 99 || 123
# assert_equal(true, flag)
# flag = 'yes' && []
# assert_equal(false, flag)
assert_equal(true, flag)
flag = 99 || 123
assert_equal(true, flag)
flag = 'yes' && []
assert_equal(false, flag)
END
CheckScriptSuccess(lines)
CheckDefAndScriptFailure(['let x: bool = 2'], 'E1012:')