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

patch 8.2.4533: Vim9: no test that after assigning null type is still checked

Problem:    Vim9: no test that after assigning null the type is still checked.
Solution:   Add a test.
This commit is contained in:
Bram Moolenaar 2022-03-09 19:46:48 +00:00
parent f2832ad965
commit 56b84b1728
2 changed files with 27 additions and 0 deletions

View File

@ -340,10 +340,35 @@ def Test_null_values()
var j: job = null_job
var c: channel = null_channel
endif
var d: dict<func> = {a: function('tr'), b: null_function}
END
v9.CheckDefAndScriptSuccess(lines)
enddef
def Test_keep_type_after_assigning_null()
var lines =<< trim END
var b: blob
b = null_blob
b = 'text'
END
v9.CheckDefExecAndScriptFailure(lines, 'E1012: Type mismatch; expected blob but got string')
lines =<< trim END
var l: list<number>
l = null_list
l = ['text']
END
v9.CheckDefExecAndScriptFailure(lines, 'E1012: Type mismatch; expected list<number> but got list<string>')
lines =<< trim END
var d: dict<string>
d = null_dict
d = {a: 1, b: 2}
END
v9.CheckDefExecAndScriptFailure(lines, 'E1012: Type mismatch; expected dict<string> but got dict<number>')
enddef
def Test_skipped_assignment()
var lines =<< trim END
for x in []

View File

@ -750,6 +750,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
4533,
/**/
4532,
/**/