Patch 8.2.1009
Problem: Vim9: some failures not checked for.
Solution: Add test cases. Remove unused code.
Files: src/testdir/test_vim9_script.vim, src/vim9execute.c
*** ../vim-8.2.1008/src/testdir/test_vim9_script.vim 2020-06-18
18:26:18.959984391 +0200
--- src/testdir/test_vim9_script.vim 2020-06-18 22:33:18.398865592 +0200
***************
*** 127,132 ****
--- 127,133 ----
list2[-3] = 77
assert_equal([77, 88, 99], list2)
call CheckDefExecFailure(['let ll = [1, 2, 3]', 'll[-4] = 6'], 'E684:')
+ call CheckDefExecFailure(['let [v1, v2] = [1, 2]'], 'E1092:')
# type becomes list<any>
let somelist = rand() > 0 ? [1, 2, 3] : ['a', 'b', 'c']
***************
*** 1920,1925 ****
--- 1921,1940 ----
unlet g:other_var
enddef
+ def Test_let_declaration_fails()
+ let lines =<< trim END
+ vim9script
+ const var: string
+ END
+ CheckScriptFailure(lines, 'E1021:')
+
+ lines =<< trim END
+ vim9script
+ let 9var: string
+ END
+ CheckScriptFailure(lines, 'E475:')
+ enddef
+
def Test_let_type_check()
let lines =<< trim END
vim9script
***************
*** 1933,1938 ****
--- 1948,1959 ----
let var:string
END
CheckScriptFailure(lines, 'E1069:')
+
+ lines =<< trim END
+ vim9script
+ let var: asdf
+ END
+ CheckScriptFailure(lines, 'E1010:')
enddef
def Test_forward_declaration()
*** ../vim-8.2.1008/src/vim9execute.c 2020-06-16 11:34:38.314223444 +0200
--- src/vim9execute.c 2020-06-18 22:42:21.621492790 +0200
***************
*** 2119,2130 ****
list_T *list;
int count = iptr->isn_arg.number;
tv = STACK_TV_BOT(-1);
- if (tv->v_type != VAR_LIST)
- {
- emsg(_(e_listreq));
- goto failed;
- }
list = tv->vval.v_list;
// no error for short list, expect it to be checked earlier
--- 2119,2126 ----
list_T *list;
int count = iptr->isn_arg.number;
+ // type will have been checked to be a list
tv = STACK_TV_BOT(-1);
list = tv->vval.v_list;
// no error for short list, expect it to be checked earlier
*** ../vim-8.2.1008/src/version.c 2020-06-18 22:18:07.396246807 +0200
--- src/version.c 2020-06-18 22:42:57.053398562 +0200
***************
*** 756,757 ****
--- 756,759 ----
{ /* Add new patch number below this line */
+ /**/
+ 1009,
/**/
--
It's not hard to meet expenses, they're everywhere.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/202006182044.05IKi2BH451699%40masaka.moolenaar.net.