]> granicus.if.org Git - vim/commitdiff
patch 8.2.2115: Vim9: some errors not tested for; dead code v8.2.2115
authorBram Moolenaar <Bram@vim.org>
Tue, 8 Dec 2020 21:08:51 +0000 (22:08 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 8 Dec 2020 21:08:51 +0000 (22:08 +0100)
Problem:    Vim9: some errors not tested for; dead code.
Solution:   Add a test.  Remove dead code.

src/testdir/test_vim9_assign.vim
src/version.c
src/vim9compile.c

index cf8f456afa1febbcc8969ce0493f16412ce60a6b..2b02cb960a050ade10c93f73b2cb5c3c9c8ec3fd 100644 (file)
@@ -1045,6 +1045,9 @@ def Test_var_declaration()
     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 @@ def Test_var_declaration_fails()
     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()
index b35208219090df90595ebd4db855d6b7a3ca2407..3d48637390c31db1240d43245bd3a606598daca0 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2115,
 /**/
     2114,
 /**/
index 3ba2f87e024f868c9cd5998a38c39588e7b1a5f3..da069f405b6c7cca6e4bff6438ef3a11fd9ce83b 100644 (file)
@@ -5705,12 +5705,7 @@ compile_assignment(char_u *arg, exarg_T *eap, cmdidx_T cmdidx, cctx_T *cctx)
 
                        // 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;