0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 8.2.0331: internal error when using test_void() and test_unknown()

Problem:    Internal error when using test_void() and test_unknown().
            (Dominique Pelle)
Solution:   Give a normal error.
This commit is contained in:
Bram Moolenaar
2020-02-29 13:43:27 +01:00
parent 57c732ed78
commit 7c215c5893
4 changed files with 15 additions and 2 deletions

View File

@@ -1890,7 +1890,10 @@ f_empty(typval_T *argvars, typval_T *rettv)
#endif #endif
case VAR_UNKNOWN: case VAR_UNKNOWN:
case VAR_VOID: 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; n = TRUE;
break; break;
} }
@@ -8275,7 +8278,10 @@ f_type(typval_T *argvars, typval_T *rettv)
case VAR_BLOB: n = VAR_TYPE_BLOB; break; case VAR_BLOB: n = VAR_TYPE_BLOB; break;
case VAR_UNKNOWN: case VAR_UNKNOWN:
case VAR_VOID: 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; n = -1;
break; break;
} }

View File

@@ -58,6 +58,9 @@ func Test_empty()
call assert_equal(0, empty(function('Test_empty'))) call assert_equal(0, empty(function('Test_empty')))
call assert_equal(0, empty(function('Test_empty', [0]))) 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 endfunc
func Test_len() func Test_len()

View 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:none))
call assert_equal(v:t_none, type(v:null)) 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(0, 0 + v:false)
call assert_equal(1, 0 + v:true) call assert_equal(1, 0 + v:true)

View File

@@ -738,6 +738,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
331,
/**/ /**/
330, 330,
/**/ /**/