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

patch 8.2.4311: Vim9: changing script variable type not caught compile time

Problem:    Vim9: changing script variable type not caught at compile time.
Solution:   Set the declared type.
This commit is contained in:
Bram Moolenaar 2022-02-06 17:17:02 +00:00
parent 2626d6a71c
commit 160afdb185
3 changed files with 13 additions and 1 deletions

View File

@ -692,6 +692,16 @@ def Test_extend_list()
END END
v9.CheckDefExecAndScriptFailure(lines, 'E1013: Argument 2: type mismatch, expected list<number> but got list<string>', 4) v9.CheckDefExecAndScriptFailure(lines, 'E1013: Argument 2: type mismatch, expected list<number> but got list<string>', 4)
unlet g:myList unlet g:myList
lines =<< trim END
vim9script
var lds = [1, 2, 3]
def Func()
echo lds->extend(['x'])
enddef
defcompile
END
v9.CheckScriptFailure(lines, 'E1013:')
enddef enddef
def Test_extend_dict() def Test_extend_dict()

View File

@ -746,6 +746,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 */
/**/
4311,
/**/ /**/
4310, 4310,
/**/ /**/

View File

@ -1040,7 +1040,7 @@ generate_VIM9SCRIPT(
RETURN_OK_IF_SKIP(cctx); RETURN_OK_IF_SKIP(cctx);
if (isn_type == ISN_LOADSCRIPT) if (isn_type == ISN_LOADSCRIPT)
isn = generate_instr_type(cctx, isn_type, type); isn = generate_instr_type2(cctx, isn_type, type, type);
else else
isn = generate_instr_drop(cctx, isn_type, 1); isn = generate_instr_drop(cctx, isn_type, 1);
if (isn == NULL) if (isn == NULL)