From 801cd35e7e3b21e519e12a1610ee1d721e40893e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 10 Oct 2022 16:08:16 +0100 Subject: [PATCH] patch 9.0.0715: wrong argument for append() gives two error messages Problem: Wrong argument for append() gives two error messages. Solution: When getting an error for a number argument don't try using it as a string. (closes #11335) --- src/testdir/test_functions.vim | 2 ++ src/typval.c | 4 +++- src/version.c | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim index 85e27c6560c4a3..938a839bfdeb8b 100644 --- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -950,6 +950,8 @@ func Test_append() " Using $ instead of '$' must give an error call assert_fails("call append($, 'foobar')", 'E116:') + + call assert_fails("call append({}, '')", ['E728:', 'E728:']) endfunc " Test for setline() diff --git a/src/typval.c b/src/typval.c index a4fdb782f1e6fe..d6f6196b58731b 100644 --- a/src/typval.c +++ b/src/typval.c @@ -2509,10 +2509,12 @@ eval_env_var(char_u **arg, typval_T *rettv, int evaluate) tv_get_lnum(typval_T *argvars) { linenr_T lnum = -1; + int did_emsg_before = did_emsg; if (argvars[0].v_type != VAR_STRING || !in_vim9script()) lnum = (linenr_T)tv_get_number_chk(&argvars[0], NULL); - if (lnum <= 0 && argvars[0].v_type != VAR_NUMBER) + if (lnum <= 0 && did_emsg_before == did_emsg + && argvars[0].v_type != VAR_NUMBER) { int fnum; pos_T *fp; diff --git a/src/version.c b/src/version.c index 772267eff6331c..564d69d8df5cc1 100644 --- a/src/version.c +++ b/src/version.c @@ -699,6 +699,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 715, /**/ 714, /**/