summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-02-06 17:17:02 +0000
committerBram Moolenaar <Bram@vim.org>2022-02-06 17:17:02 +0000
commit160afdb1850b8cf56dc8e94acee7a04bc2113992 (patch)
treed34b0cb67df71e50f3443b5218a71bdd98de53c6
parent2626d6a71ca616bd91d4ee2c27bd76a78a00d412 (diff)
patch 8.2.4311: Vim9: changing script variable type not caught compile timev8.2.4311
Problem: Vim9: changing script variable type not caught at compile time. Solution: Set the declared type.
-rw-r--r--src/testdir/test_vim9_assign.vim10
-rw-r--r--src/version.c2
-rw-r--r--src/vim9instr.c2
3 files changed, 13 insertions, 1 deletions
diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim
index 79c08d3f44..7d3e2c1356 100644
--- a/src/testdir/test_vim9_assign.vim
+++ b/src/testdir/test_vim9_assign.vim
@@ -692,6 +692,16 @@ def Test_extend_list()
END
v9.CheckDefExecAndScriptFailure(lines, 'E1013: Argument 2: type mismatch, expected list<number> but got list<string>', 4)
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
def Test_extend_dict()
diff --git a/src/version.c b/src/version.c
index 20bc28ab46..2342462a0f 100644
--- a/src/version.c
+++ b/src/version.c
@@ -747,6 +747,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 4311,
+/**/
4310,
/**/
4309,
diff --git a/src/vim9instr.c b/src/vim9instr.c
index cf26650d17..9116f4111c 100644
--- a/src/vim9instr.c
+++ b/src/vim9instr.c
@@ -1040,7 +1040,7 @@ generate_VIM9SCRIPT(
RETURN_OK_IF_SKIP(cctx);
if (isn_type == ISN_LOADSCRIPT)
- isn = generate_instr_type(cctx, isn_type, type);
+ isn = generate_instr_type2(cctx, isn_type, type, type);
else
isn = generate_instr_drop(cctx, isn_type, 1);
if (isn == NULL)