diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-03-09 19:46:48 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-03-09 19:46:48 +0000 |
commit | 56b84b1728e68f984446ec2698716cb8a1f6871d (patch) | |
tree | b542f00e7e9bd542596f566da6cbf29157fdd100 | |
parent | f2832ad9653815103b39daf873511baa37424d3d (diff) | |
download | vim-git-56b84b1728e68f984446ec2698716cb8a1f6871d.tar.gz |
patch 8.2.4533: Vim9: no test that after assigning null type is still checkedv8.2.4533
Problem: Vim9: no test that after assigning null the type is still checked.
Solution: Add a test.
-rw-r--r-- | src/testdir/test_vim9_assign.vim | 25 | ||||
-rw-r--r-- | src/version.c | 2 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim index abc3a15b9..21a39e1f6 100644 --- a/src/testdir/test_vim9_assign.vim +++ b/src/testdir/test_vim9_assign.vim @@ -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 [] diff --git a/src/version.c b/src/version.c index 9248ca403..9b72517a5 100644 --- a/src/version.c +++ b/src/version.c @@ -751,6 +751,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 4533, +/**/ 4532, /**/ 4531, |