]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.2.1009: Vim9: some failures not checked for v8.2.1009
authorBram Moolenaar <Bram@vim.org>
Thu, 18 Jun 2020 20:43:27 +0000 (22:43 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 18 Jun 2020 20:43:27 +0000 (22:43 +0200)
Problem:    Vim9: some failures not checked for.
Solution:   Add test cases.  Remove unused code.

src/testdir/test_vim9_script.vim
src/version.c
src/vim9execute.c

index d4cd60222327877d31c87dfff842bf876f35fbd9..25fed4acd1f6cb9ab651d95ed6250e5ead15710f 100644 (file)
@@ -127,6 +127,7 @@ def Test_assignment_list()
   list2[-3] = 77
   assert_equal([77, 88, 99], list2)
   call CheckDefExecFailure(['let ll = [1, 2, 3]', 'll[-4] = 6'], 'E684:')
+  call CheckDefExecFailure(['let [v1, v2] = [1, 2]'], 'E1092:')
 
   # type becomes list<any>
   let somelist = rand() > 0 ? [1, 2, 3] : ['a', 'b', 'c']
@@ -1920,6 +1921,20 @@ def Test_let_declaration()
   unlet g:other_var
 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()
   let lines =<< trim END
     vim9script
@@ -1933,6 +1948,12 @@ def Test_let_type_check()
     let var:string
   END
   CheckScriptFailure(lines, 'E1069:')
+
+  lines =<< trim END
+    vim9script
+    let var: asdf
+  END
+  CheckScriptFailure(lines, 'E1010:')
 enddef
 
 def Test_forward_declaration()
index a3fedf1cde372e88025565e999f8d33310f81f62..c702791a1229e5bc8e2c976af2831f38782e6055 100644 (file)
@@ -754,6 +754,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1009,
 /**/
     1008,
 /**/
index e92af22cc237ecf87cae7abe30db22c94b09f18a..53a30c9b4372212edcb58665ea38197e1314b3ec 100644 (file)
@@ -2119,12 +2119,8 @@ call_def_function(
                    list_T      *list;
                    int         count = iptr->isn_arg.number;
 
+                   // type will have been checked to be a list
                    tv = STACK_TV_BOT(-1);
-                   if (tv->v_type != VAR_LIST)
-                   {
-                       emsg(_(e_listreq));
-                       goto failed;
-                   }
                    list = tv->vval.v_list;
 
                    // no error for short list, expect it to be checked earlier