patch 8.2.2710: Vim9: not all tests cover script and :def function

Problem:    Vim9: not all tests cover script and :def function.
Solution:   Run tests in both if possible. Fix differences.
diff --git a/src/vim9execute.c b/src/vim9execute.c
index 6e011ba..d3e2af7 100644
--- a/src/vim9execute.c
+++ b/src/vim9execute.c
@@ -3962,9 +3962,16 @@
 
 done:
     // function finished, get result from the stack.
-    tv = STACK_TV_BOT(-1);
-    *rettv = *tv;
-    tv->v_type = VAR_UNKNOWN;
+    if (ufunc->uf_ret_type == &t_void)
+    {
+	rettv->v_type = VAR_VOID;
+    }
+    else
+    {
+	tv = STACK_TV_BOT(-1);
+	*rettv = *tv;
+	tv->v_type = VAR_UNKNOWN;
+    }
     ret = OK;
 
 failed: