mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 8.2.1009: Vim9: some failures not checked for
Problem: Vim9: some failures not checked for. Solution: Add test cases. Remove unused code.
This commit is contained in:
parent
0779fab297
commit
c5b1c20b6b
@ -127,6 +127,7 @@ def Test_assignment_list()
|
|||||||
list2[-3] = 77
|
list2[-3] = 77
|
||||||
assert_equal([77, 88, 99], list2)
|
assert_equal([77, 88, 99], list2)
|
||||||
call CheckDefExecFailure(['let ll = [1, 2, 3]', 'll[-4] = 6'], 'E684:')
|
call CheckDefExecFailure(['let ll = [1, 2, 3]', 'll[-4] = 6'], 'E684:')
|
||||||
|
call CheckDefExecFailure(['let [v1, v2] = [1, 2]'], 'E1092:')
|
||||||
|
|
||||||
# type becomes list<any>
|
# type becomes list<any>
|
||||||
let somelist = rand() > 0 ? [1, 2, 3] : ['a', 'b', 'c']
|
let somelist = rand() > 0 ? [1, 2, 3] : ['a', 'b', 'c']
|
||||||
@ -1920,6 +1921,20 @@ def Test_let_declaration()
|
|||||||
unlet g:other_var
|
unlet g:other_var
|
||||||
enddef
|
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()
|
def Test_let_type_check()
|
||||||
let lines =<< trim END
|
let lines =<< trim END
|
||||||
vim9script
|
vim9script
|
||||||
@ -1933,6 +1948,12 @@ def Test_let_type_check()
|
|||||||
let var:string
|
let var:string
|
||||||
END
|
END
|
||||||
CheckScriptFailure(lines, 'E1069:')
|
CheckScriptFailure(lines, 'E1069:')
|
||||||
|
|
||||||
|
lines =<< trim END
|
||||||
|
vim9script
|
||||||
|
let var: asdf
|
||||||
|
END
|
||||||
|
CheckScriptFailure(lines, 'E1010:')
|
||||||
enddef
|
enddef
|
||||||
|
|
||||||
def Test_forward_declaration()
|
def Test_forward_declaration()
|
||||||
|
@ -754,6 +754,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
1009,
|
||||||
/**/
|
/**/
|
||||||
1008,
|
1008,
|
||||||
/**/
|
/**/
|
||||||
|
@ -2119,12 +2119,8 @@ call_def_function(
|
|||||||
list_T *list;
|
list_T *list;
|
||||||
int count = iptr->isn_arg.number;
|
int count = iptr->isn_arg.number;
|
||||||
|
|
||||||
|
// type will have been checked to be a list
|
||||||
tv = STACK_TV_BOT(-1);
|
tv = STACK_TV_BOT(-1);
|
||||||
if (tv->v_type != VAR_LIST)
|
|
||||||
{
|
|
||||||
emsg(_(e_listreq));
|
|
||||||
goto failed;
|
|
||||||
}
|
|
||||||
list = tv->vval.v_list;
|
list = tv->vval.v_list;
|
||||||
|
|
||||||
// no error for short list, expect it to be checked earlier
|
// no error for short list, expect it to be checked earlier
|
||||||
|
Loading…
x
Reference in New Issue
Block a user