diff --git a/src/errors.h b/src/errors.h
index 3468ab780c198db679991591db788340a1b71ef2..b4c111d3f1932028a816847aeccd726663d58ef8 100644
--- a/src/errors.h
+++ b/src/errors.h
@@ -652,3 +652,5 @@ EXTERN char e_exists_compiled_can_only_be_used_in_def_function[]
 	INIT(= N_("E1233: exists_compiled() can only be used in a :def function"));
 EXTERN char e_legacy_must_be_followed_by_command[]
 	INIT(= N_("E1234: legacy must be followed by a command"));
+EXTERN char e_function_reference_is_not_set[]
+	INIT(= N_("E1235: Function reference is not set"));
diff --git a/src/testdir/test_vim9_func.vim b/src/testdir/test_vim9_func.vim
index 0ffe68632fe327b979afeb30439433b67d5ed65e..f0c4c0d91c91c0e0412d15278a84b337ea95e09e 100644
--- a/src/testdir/test_vim9_func.vim
+++ b/src/testdir/test_vim9_func.vim
@@ -2696,6 +2696,15 @@ def Test_partial_call()
       assert_equal('ooooo', RepeatFunc(5))
   END
   CheckDefAndScriptSuccess(lines)
+
+  lines =<< trim END
+      vim9script
+      def Foo(Parser: any)
+      enddef
+      var Expr: func(dict<any>): dict<any>
+      const Call = Foo(Expr)
+  END
+  CheckScriptFailure(lines, 'E1235:')
 enddef
 
 def Test_cmd_modifier()
diff --git a/src/version.c b/src/version.c
index 74b234aa8c8cfbc2f321d4646822cde3f27a772e..b47b1e358146da5e722d4cba2fb7c1fa8443c965 100644
--- a/src/version.c
+++ b/src/version.c
@@ -755,6 +755,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    3359,
 /**/
     3358,
 /**/
diff --git a/src/vim9type.c b/src/vim9type.c
index ca090cbe5905f254057b6fce9d95b43b40b06c9d..d6e01cd7a6ba4f3daec0f46908b39a5f9cdcabc9 100644
--- a/src/vim9type.c
+++ b/src/vim9type.c
@@ -461,6 +461,16 @@ check_typval_type(type_T *expected, typval_T *actual_tv, where_T where)
     type_T	*actual_type;
     int		res = FAIL;
 
+    // For some values there is no type, assume an error will be given later
+    // for an invalid value.
+    if ((actual_tv->v_type == VAR_FUNC && actual_tv->vval.v_string == NULL)
+	    || (actual_tv->v_type == VAR_PARTIAL
+					 && actual_tv->vval.v_partial == NULL))
+    {
+	emsg(_(e_function_reference_is_not_set));
+	return FAIL;
+    }
+
     ga_init2(&type_list, sizeof(type_T *), 10);
     actual_type = typval2type(actual_tv, get_copyID(), &type_list, TRUE);
     if (actual_type != NULL)