patch 8.2.3229: Vim9: runtime and compile time type checks are not the same

Problem:    Vim9: runtime and compile time type checks are not the same.
Solution:   Add more runtime type checks for builtin functions. (Yegappan
            Lakshmanan, closes #8646)
diff --git a/src/cmdhist.c b/src/cmdhist.c
index f3b8b00..0ac3ff6 100644
--- a/src/cmdhist.c
+++ b/src/cmdhist.c
@@ -545,6 +545,12 @@
     rettv->vval.v_number = FALSE;
     if (check_secure())
 	return;
+
+    if (in_vim9script()
+	    && (check_for_string_arg(argvars, 0) == FAIL
+		|| check_for_string_arg(argvars, 1) == FAIL))
+	return;
+
     str = tv_get_string_chk(&argvars[0]);	// NULL on type error
     histype = str != NULL ? get_histtype(str) : -1;
     if (histype >= 0)
@@ -630,9 +636,12 @@
 f_histnr(typval_T *argvars UNUSED, typval_T *rettv)
 {
     int		i;
+    char_u	*histname;
 
-    char_u	*histname = tv_get_string_chk(&argvars[0]);
+    if (in_vim9script() && check_for_string_arg(argvars, 0) == FAIL)
+	return;
 
+    histname = tv_get_string_chk(&argvars[0]);
     i = histname == NULL ? HIST_CMD - 1 : get_histtype(histname);
     if (i >= HIST_CMD && i < HIST_COUNT)
 	i = get_history_idx(i);