# HG changeset patch # User Bram Moolenaar # Date 1597595404 -7200 # Node ID b530ead4265a3d25f82bfb18e78f060b56e305a8 # Parent 47742d4ad2a342c40feedf583604faee2a9626ff patch 8.2.1467: Vim9: :echomsg doesn't like a dict argument Commit: https://github.com/vim/vim/commit/e5abf7af08ff69e7e038c067497f080d4e44332c Author: Bram Moolenaar Date: Sun Aug 16 18:29:35 2020 +0200 patch 8.2.1467: Vim9: :echomsg doesn't like a dict argument Problem: Vim9: :echomsg doesn't like a dict argument. Solution: Convert arguments like in legacy script. (closes https://github.com/vim/vim/issues/6717) diff --git a/src/testdir/test_vim9_script.vim b/src/testdir/test_vim9_script.vim --- a/src/testdir/test_vim9_script.vim +++ b/src/testdir/test_vim9_script.vim @@ -2102,6 +2102,9 @@ def Test_execute_cmd() execute 'echomsg' (n ? '"true"' : '"no"') assert_match('^true$', Screenline(&lines)) + echomsg [1, 2, 3] #{a: 1, b: 2} + assert_match('^\[1, 2, 3\] {''a'': 1, ''b'': 2}$', Screenline(&lines)) + call CheckDefFailure(['execute xxx'], 'E1001:') call CheckDefFailure(['execute "cmd"# comment'], 'E488:') enddef diff --git a/src/version.c b/src/version.c --- 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 */ /**/ + 1467, +/**/ 1466, /**/ 1465, diff --git a/src/vim9compile.c b/src/vim9compile.c --- a/src/vim9compile.c +++ b/src/vim9compile.c @@ -2422,9 +2422,6 @@ compile_list(char_u **arg, cctx_T *cctx) if (*p == ']') { ++p; - // Allow for following comment, after at least one space. - if (VIM_ISWHITE(*p) && *skipwhite(p) == '#') - p += STRLEN(p); break; } if (compile_expr0(&p, cctx) == FAIL) @@ -6206,6 +6203,7 @@ compile_throw(char_u *arg, cctx_T *cctx compile_mult_expr(char_u *arg, int cmdidx, cctx_T *cctx) { char_u *p = arg; + char_u *prev; int count = 0; for (;;) @@ -6213,8 +6211,9 @@ compile_mult_expr(char_u *arg, int cmdid if (compile_expr0(&p, cctx) == FAIL) return NULL; ++count; + prev = p; p = skipwhite(p); - if (ends_excmd(*p)) + if (ends_excmd2(prev, p)) break; } diff --git a/src/vim9execute.c b/src/vim9execute.c --- a/src/vim9execute.c +++ b/src/vim9execute.c @@ -1028,14 +1028,20 @@ call_def_function( for (idx = 0; idx < count; ++idx) { tv = STACK_TV_BOT(idx - count); - if (tv->v_type == VAR_CHANNEL || tv->v_type == VAR_JOB) + if (iptr->isn_type == ISN_EXECUTE) { - SOURCING_LNUM = iptr->isn_lnum; - emsg(_(e_inval_string)); - break; + if (tv->v_type == VAR_CHANNEL + || tv->v_type == VAR_JOB) + { + SOURCING_LNUM = iptr->isn_lnum; + emsg(_(e_inval_string)); + break; + } + else + p = tv_get_string_buf(tv, buf); } else - p = tv_get_string_buf(tv, buf); + p = tv_stringify(tv, buf); len = (int)STRLEN(p); if (ga_grow(&ga, len + 2) == FAIL) @@ -1050,8 +1056,10 @@ call_def_function( clear_tv(tv); } ectx.ec_stack.ga_len -= count; - - if (!failed && ga.ga_data != NULL) + if (failed) + goto on_error; + + if (ga.ga_data != NULL) { if (iptr->isn_type == ISN_EXECUTE) do_cmdline_cmd((char_u *)ga.ga_data);