changeset 21216:bcd08812cde3 v8.2.1159

patch 8.2.1159: Vim9: no error for missing space after a comma Commit: https://github.com/vim/vim/commit/6b7a0a8c201bbace7e69fe0709f72b95092193df Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jul 8 18:38:08 2020 +0200 patch 8.2.1159: Vim9: no error for missing space after a comma Problem: Vim9: no error for missing space after a comma. Solution: Check for white space.
author Bram Moolenaar <Bram@vim.org>
date Wed, 08 Jul 2020 18:45:09 +0200
parents 2f00e3222520
children d9d839c4d070
files src/testdir/test_vim9_expr.vim src/testdir/test_vim9_script.vim src/version.c src/vim9compile.c
diffstat 4 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -1014,6 +1014,7 @@ def Test_expr7_list()
 
   call CheckDefExecFailure(["let x = g:anint[3]"], 'E714:')
   call CheckDefFailure(["let x = g:list_mixed[xxx]"], 'E1001:')
+  call CheckDefFailure(["let x = [1,2,3]"], 'E1069:')
   call CheckDefExecFailure(["let x = g:list_mixed['xx']"], 'E39:')
   call CheckDefFailure(["let x = g:list_mixed[0"], 'E111:')
   call CheckDefExecFailure(["let x = g:list_empty[3]"], 'E684:')
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -571,7 +571,7 @@ enddef
 
 def Test_try_catch_fails()
   call CheckDefFailure(['catch'], 'E603:')
-  call CheckDefFailure(['try', 'echo 0', 'catch','catch'], 'E1033:')
+  call CheckDefFailure(['try', 'echo 0', 'catch', 'catch'], 'E1033:')
   call CheckDefFailure(['try', 'echo 0', 'catch /pat'], 'E1067:')
   call CheckDefFailure(['finally'], 'E606:')
   call CheckDefFailure(['try', 'echo 0', 'finally', 'echo 1', 'finally'], 'E607:')
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1159,
+/**/
     1158,
 /**/
     1157,
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -3060,7 +3060,14 @@ compile_list(char_u **arg, cctx_T *cctx)
 	    break;
 	++count;
 	if (*p == ',')
+	{
 	    ++p;
+	    if (*p != ']' && !IS_WHITE_OR_NUL(*p))
+	    {
+		semsg(_(e_white_after), ",");
+		return FAIL;
+	    }
+	}
 	whitep = p;
 	p = skipwhite(p);
     }