changeset 23703:6bfb302d8392 v8.2.2393

patch 8.2.2393: Vim9: error message when script line starts with "[{" Commit: https://github.com/vim/vim/commit/4bce26bb70144633713e7e8f149ba99cac511336 Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jan 22 22:06:56 2021 +0100 patch 8.2.2393: Vim9: error message when script line starts with "[{" Problem: Vim9: error message when script line starts with "[{". Solution: Do not give an error for checking for end of list.
author Bram Moolenaar <Bram@vim.org>
date Fri, 22 Jan 2021 22:15:04 +0100
parents 48f0d00b5e46
children 85c8bd7cca28
files src/dict.c src/testdir/test_vim9_script.vim src/version.c
diffstat 3 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/dict.c
+++ b/src/dict.c
@@ -1032,7 +1032,8 @@ eval_dict(char_u **arg, typval_T *rettv,
 
     if (**arg != '}')
     {
-	semsg(_(e_missing_dict_end), *arg);
+	if (evalarg != NULL)
+	    semsg(_(e_missing_dict_end), *arg);
 failret:
 	if (d != NULL)
 	    dict_free(d);
--- a/src/testdir/test_vim9_script.vim
+++ b/src/testdir/test_vim9_script.vim
@@ -815,6 +815,12 @@ def Test_list_vimscript()
       # comment 6
   END
   assert_equal(['# comment 1', 'two', '# comment 3', '', 'five', '# comment 6'], lines)
+
+  lines =<< trim END
+    [{
+      a: 0}]->string()->assert_equal("[{'a': 0}]")
+  END
+  CheckDefAndScriptSuccess(lines)
 enddef
 
 if has('channel')
--- 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 */
 /**/
+    2393,
+/**/
     2392,
 /**/
     2391,