Patch 8.2.4533

9 views
Skip to first unread message

Bram Moolenaar

unread,
Mar 9, 2022, 2:48:08 PM3/9/22
to vim...@googlegroups.com

Patch 8.2.4533
Problem: Vim9: no test that after assigning null the type is still checked.
Solution: Add a test.
Files: src/testdir/test_vim9_assign.vim


*** ../vim-8.2.4532/src/testdir/test_vim9_assign.vim 2022-03-08 13:18:10.813020777 +0000
--- src/testdir/test_vim9_assign.vim 2022-03-09 19:45:33.085471163 +0000
***************
*** 340,349 ****
--- 340,374 ----
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 []
*** ../vim-8.2.4532/src/version.c 2022-03-09 14:32:59.617641710 +0000
--- src/version.c 2022-03-09 19:34:17.543475327 +0000
***************
*** 752,753 ****
--- 752,755 ----
{ /* Add new patch number below this line */
+ /**/
+ 4533,
/**/

--
I noticed my daughter's Disney-net password on a sticky note:
"MickeyMinnieGoofyPluto". I asked her why it was so long.
"Because they say it has to have at least four characters."

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Reply all
Reply to author
Forward
0 new messages