]> granicus.if.org Git - vim/commitdiff
patch 8.2.1868: Vim9: no error for missing space after comma in dict v8.2.1868
authorBram Moolenaar <Bram@vim.org>
Mon, 19 Oct 2020 19:45:07 +0000 (21:45 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 19 Oct 2020 19:45:07 +0000 (21:45 +0200)
Problem:    Vim9: no error for missing space after comma in dict.
Solution:   Check for white space. (closes #6672)

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

index a4e7c510e5b5cf88f0aa05c9f202ce9f48e701f5..94d23c64940604d86580dfcc10545065a2c05f99 100644 (file)
@@ -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)
index 97a3b71dbadca3a93c4a44dae54526ee550cb30c..90ab88ab6eebc794f480efcb00a3e543dd277b4c 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1868,
 /**/
     1867,
 /**/
index d9908d30bec0c3b58acae4621e9bf0fb5f88d377..cd5e45bc68a69cf601fd8c3c8e170e8ab78ecd6d 100644 (file)
@@ -2996,6 +2996,11 @@ compile_dict(char_u **arg, cctx_T *cctx, int literal, ppconst_T *ppconst)
            return FAIL;
        }
        whitep = *arg + 1;
+       if (!IS_WHITE_OR_NUL(*whitep))
+       {
+           semsg(_(e_white_space_required_after_str), ",");
+           return FAIL;
+       }
        *arg = skipwhite(*arg + 1);
     }