Skip to content

Commit 61a417b

Browse files
committed
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.
1 parent a97c363 commit 61a417b

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/testdir/test_functions.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ func Test_empty()
8686
endfunc
8787

8888
func Test_test_void()
89-
call assert_fails('echo 1 == test_void()', 'E685:')
89+
call assert_fails('echo 1 == test_void()', 'E1031:')
9090
if has('float')
91-
call assert_fails('echo 1.0 == test_void()', 'E685:')
91+
call assert_fails('echo 1.0 == test_void()', 'E1031:')
9292
endif
9393
call assert_fails('let x = json_encode(test_void())', 'E685:')
9494
call assert_fails('let x = copy(test_void())', 'E685:')
95-
call assert_fails('let x = copy([test_void()])', 'E685:')
95+
call assert_fails('let x = copy([test_void()])', 'E1031:')
9696
endfunc
9797

9898
func Test_len()

src/typval.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,6 @@ copy_tv(typval_T *from, typval_T *to)
591591
case VAR_NUMBER:
592592
case VAR_BOOL:
593593
case VAR_SPECIAL:
594-
case VAR_VOID:
595594
to->vval.v_number = from->vval.v_number;
596595
break;
597596
case VAR_FLOAT:
@@ -664,6 +663,9 @@ copy_tv(typval_T *from, typval_T *to)
664663
++to->vval.v_dict->dv_refcount;
665664
}
666665
break;
666+
case VAR_VOID:
667+
emsg(_(e_cannot_use_void_value));
668+
break;
667669
case VAR_UNKNOWN:
668670
case VAR_ANY:
669671
internal_error_no_abort("copy_tv(UNKNOWN)");

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,8 @@ static char *(features[]) =
750750

751751
static int included_patches[] =
752752
{ /* Add new patch number below this line */
753+
/**/
754+
3007,
753755
/**/
754756
3006,
755757
/**/

0 commit comments

Comments
 (0)