]> granicus.if.org Git - vim/commitdiff
patch 8.2.0331: internal error when using test_void() and test_unknown() v8.2.0331
authorBram Moolenaar <Bram@vim.org>
Sat, 29 Feb 2020 12:43:27 +0000 (13:43 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 29 Feb 2020 12:43:27 +0000 (13:43 +0100)
Problem:    Internal error when using test_void() and test_unknown().
            (Dominique Pelle)
Solution:   Give a normal error.

src/evalfunc.c
src/testdir/test_functions.vim
src/testdir/test_vimscript.vim
src/version.c

index ff891eaa940b0be39a6bafc9550762d74e5e742d..3fce946bf13da7796428a250557acdc383378556 100644 (file)
@@ -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;
     }
index 327350be09d6816df0c1275a0e3b3e81985a5987..6f3b81a30c1868b57c601878636e1432398b4465 100644 (file)
@@ -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()
index 7a49b5783584369cdcded4638d559ae52106be35..cac3be53af584b0cd8edcac1a79a223705d69404 100644 (file)
@@ -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)
index b883605c695eab857712c70c723aabd0909677bb..c553f20a37309981bdd440e0bbb0d524704d1081 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    331,
 /**/
     330,
 /**/