1
0
forked from aniani/vim

patch 8.2.4539: when comparing special v:none and v:null are handled the same

Problem:    When comparing special v:none and v:null are handled the same when
            compiling.
Solution:   Pass more information so that v:none can be handled differently at
            compile time.  (issue #9923)
This commit is contained in:
Bram Moolenaar
2022-03-10 19:23:28 +00:00
parent bf40e90dfe
commit 53ba6ca5b2
5 changed files with 70 additions and 34 deletions

View File

@@ -828,8 +828,22 @@ def Test_expr4_compare_null()
v9.CheckDefAndScriptFailure(['echo true != v:null'], 'E1072: Cannot compare bool with special')
v9.CheckDefAndScriptFailure(['echo v:null != true'], 'E1072: Cannot compare special with bool')
v9.CheckDefAndScriptFailure(['echo false == v:null'], 'E1072: Cannot compare bool with special')
enddef
v9.CheckDefExecAndScriptFailure(['echo [] == v:none'], ['E1072: Cannot compare list with special', 'E691: Can only compare List with List'])
def Test_expr4_compare_none()
var lines =<< trim END
assert_false('' == v:none)
assert_false('text' == v:none)
assert_true(v:none == v:none)
assert_false(v:none == '')
assert_false(v:none == 'text')
assert_true(v:none == v:none)
END
v9.CheckDefAndScriptSuccess(lines)
v9.CheckDefAndScriptFailure(['echo [] == v:none'], 'E1072: Cannot compare list with special')
v9.CheckDefAndScriptFailure(['echo 123 == v:none'], 'E1072: Cannot compare number with special')
v9.CheckDefAndScriptFailure(['echo 0z00 == v:none'], 'E1072: Cannot compare blob with special')
enddef
def Test_expr4_wrong_type()