changeset 22639:5bd53bf63836 v8.2.1868

patch 8.2.1868: Vim9: no error for missing space after comma in dict Commit: https://github.com/vim/vim/commit/9a13e185e5de95b150555134b34030bd47c4e22b Author: Bram Moolenaar <Bram@vim.org> Date: Mon Oct 19 21:45:07 2020 +0200 patch 8.2.1868: Vim9: no error for missing space after comma in dict Problem: Vim9: no error for missing space after comma in dict. Solution: Check for white space. (closes https://github.com/vim/vim/issues/6672)
author Bram Moolenaar <Bram@vim.org>
date Mon, 19 Oct 2020 22:00:03 +0200
parents 6e498fecf578
children e2a0b8084d58
files src/testdir/test_vim9_expr.vim src/version.c src/vim9compile.c
diffstat 3 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/testdir/test_vim9_expr.vim
+++ b/src/testdir/test_vim9_expr.vim
@@ -1880,6 +1880,7 @@ def Test_expr7_dict()
   CheckDefFailure(["var x = #{a : 8}"], 'E1068:', 1)
   CheckDefFailure(["var x = #{a :8}"], 'E1068:', 1)
   CheckDefFailure(["var x = #{a: 8 , b: 9}"], 'E1068:', 1)
+  CheckDefFailure(["var x = #{a: 1,b: 2}"], 'E1069:', 1)
 
   CheckDefFailure(["var x = #{8: 8}"], 'E1014:', 1)
   CheckDefFailure(["var x = #{xxx}"], 'E720:', 1)
--- a/src/version.c
+++ b/src/version.c
@@ -751,6 +751,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1868,
+/**/
     1867,
 /**/
     1866,
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -2996,6 +2996,11 @@ compile_dict(char_u **arg, cctx_T *cctx,
 	    return FAIL;
 	}
 	whitep = *arg + 1;
+	if (!IS_WHITE_OR_NUL(*whitep))
+	{
+	    semsg(_(e_white_space_required_after_str), ",");
+	    return FAIL;
+	}
 	*arg = skipwhite(*arg + 1);
     }