summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-02-29 13:43:27 +0100
committerBram Moolenaar <Bram@vim.org>2020-02-29 13:43:27 +0100
commit7c215c58936cbebd4132ad6112d04db54b7c153e (patch)
tree828a4e93e763e10d9b565229f6788007d1552ea2
parent57c732ed782607ce6a8c4f9eeb65b95a00e37701 (diff)
downloadvim-git-7c215c58936cbebd4132ad6112d04db54b7c153e.tar.gz
patch 8.2.0331: internal error when using test_void() and test_unknown()v8.2.0331
Problem: Internal error when using test_void() and test_unknown(). (Dominique Pelle) Solution: Give a normal error.
-rw-r--r--src/evalfunc.c10
-rw-r--r--src/testdir/test_functions.vim3
-rw-r--r--src/testdir/test_vimscript.vim2
-rw-r--r--src/version.c2
4 files changed, 15 insertions, 2 deletions
diff --git a/src/evalfunc.c b/src/evalfunc.c
index ff891eaa9..3fce946bf 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -1890,7 +1890,10 @@ f_empty(typval_T *argvars, typval_T *rettv)
#endif
case VAR_UNKNOWN:
case VAR_VOID:
- internal_error("f_empty(UNKNOWN)");
+ // Let's not use internal_error() here, otherwise
+ // empty(test_unknown()) with ABORT_ON_INTERNAL_ERROR defined makes
+ // Vim abort.
+ semsg(_(e_intern2), "f_empty(UNKNOWN)");
n = TRUE;
break;
}
@@ -8275,7 +8278,10 @@ f_type(typval_T *argvars, typval_T *rettv)
case VAR_BLOB: n = VAR_TYPE_BLOB; break;
case VAR_UNKNOWN:
case VAR_VOID:
- internal_error("f_type(UNKNOWN)");
+ // Let's not use internal_error() here, otherwise
+ // empty(test_unknown()) with ABORT_ON_INTERNAL_ERROR defined
+ // makes Vim abort.
+ semsg(_(e_intern2), "f_type(UNKNOWN)");
n = -1;
break;
}
diff --git a/src/testdir/test_functions.vim b/src/testdir/test_functions.vim
index 327350be0..6f3b81a30 100644
--- a/src/testdir/test_functions.vim
+++ b/src/testdir/test_functions.vim
@@ -58,6 +58,9 @@ func Test_empty()
call assert_equal(0, empty(function('Test_empty')))
call assert_equal(0, empty(function('Test_empty', [0])))
+
+ call assert_fails("call empty(test_void())", 'E685:')
+ call assert_fails("call empty(test_unknown())", 'E685:')
endfunc
func Test_len()
diff --git a/src/testdir/test_vimscript.vim b/src/testdir/test_vimscript.vim
index 7a49b5783..cac3be53a 100644
--- a/src/testdir/test_vimscript.vim
+++ b/src/testdir/test_vimscript.vim
@@ -1165,6 +1165,8 @@ func Test_type()
call assert_equal(v:t_none, type(v:none))
call assert_equal(v:t_none, type(v:null))
+ call assert_fails("call type(test_void())", 'E685:')
+ call assert_fails("call type(test_unknown())", 'E685:')
call assert_equal(0, 0 + v:false)
call assert_equal(1, 0 + v:true)
diff --git a/src/version.c b/src/version.c
index b883605c6..c553f20a3 100644
--- a/src/version.c
+++ b/src/version.c
@@ -739,6 +739,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 331,
+/**/
330,
/**/
329,