patch 8.2.2115: Vim9: some errors not tested for; dead code
Problem: Vim9: some errors not tested for; dead code.
Solution: Add a test. Remove dead code.
diff --git a/src/testdir/test_vim9_assign.vim b/src/testdir/test_vim9_assign.vim
index cf8f456..2b02cb9 100644
--- a/src/testdir/test_vim9_assign.vim
+++ b/src/testdir/test_vim9_assign.vim
@@ -1045,6 +1045,9 @@
s:name = 'prefixed'
g:var_prefixed = s:name
+ const FOO: number = 123
+ assert_equal(123, FOO)
+
var s:other: number
other = 1234
g:other_var = other
@@ -1087,6 +1090,10 @@
var 9var: string
END
CheckScriptFailure(lines, 'E475:')
+
+ CheckDefFailure(['var foo.bar = 2'], 'E1087:')
+ CheckDefFailure(['var foo[3] = 2'], 'E1087:')
+ CheckDefFailure(['const foo: number'], 'E1021:')
enddef
def Test_var_type_check()
diff --git a/src/version.c b/src/version.c
index b352082..3d48637 100644
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2115,
+/**/
2114,
/**/
2113,
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 3ba2f87..da069f4 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -5705,12 +5705,7 @@
// without operator check type here, otherwise below
if (has_index)
- {
use_type = member_type;
- if (member_type == NULL)
- // could be indexing "any"
- use_type = &t_any;
- }
if (need_type(rhs_type, use_type, -1, cctx,
FALSE, is_const) == FAIL)
goto theend;