Mercurial > vim
changeset 24940:0c415a0f54f9 v8.2.3007
patch 8.2.3007: Vim9: test for void value fails
Commit: https://github.com/vim/vim/commit/61a417b7c1fe858d778c7c47f33f7b4dac19360d
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jun 15 22:54:28 2021 +0200
patch 8.2.3007: Vim9: test for void value fails
Problem: Vim9: test for void value fails.
Solution: Adjust expected error. Do not make a copy of void.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 15 Jun 2021 23:15:02 +0200 |
parents | 257de87388c3 |
children | 582dbe59bccc |
files | src/testdir/test_functions.vim src/typval.c src/version.c |
diffstat | 3 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_functions.vim +++ b/src/testdir/test_functions.vim @@ -86,13 +86,13 @@ func Test_empty() endfunc func Test_test_void() - call assert_fails('echo 1 == test_void()', 'E685:') + call assert_fails('echo 1 == test_void()', 'E1031:') if has('float') - call assert_fails('echo 1.0 == test_void()', 'E685:') + call assert_fails('echo 1.0 == test_void()', 'E1031:') endif call assert_fails('let x = json_encode(test_void())', 'E685:') call assert_fails('let x = copy(test_void())', 'E685:') - call assert_fails('let x = copy([test_void()])', 'E685:') + call assert_fails('let x = copy([test_void()])', 'E1031:') endfunc func Test_len()
--- a/src/typval.c +++ b/src/typval.c @@ -591,7 +591,6 @@ copy_tv(typval_T *from, typval_T *to) case VAR_NUMBER: case VAR_BOOL: case VAR_SPECIAL: - case VAR_VOID: to->vval.v_number = from->vval.v_number; break; case VAR_FLOAT: @@ -664,6 +663,9 @@ copy_tv(typval_T *from, typval_T *to) ++to->vval.v_dict->dv_refcount; } break; + case VAR_VOID: + emsg(_(e_cannot_use_void_value)); + break; case VAR_UNKNOWN: case VAR_ANY: internal_error_no_abort("copy_tv(UNKNOWN)");