diff src/vim9compile.c @ 28002:1012048eed26 v8.2.4526

patch 8.2.4526: Vim9: cannot set variables to a null value Commit: https://github.com/vim/vim/commit/8acb9cc6209768ca7ec75c9f7af8c389312ea8d6 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Mar 8 13:18:55 2022 +0000 patch 8.2.4526: Vim9: cannot set variables to a null value Problem: Vim9: cannot set variables to a null value. Solution: Add null_list, null_job, etc.
author Bram Moolenaar <Bram@vim.org>
date Tue, 08 Mar 2022 14:30:05 +0100
parents 212c5894b8b1
children 0ed38a4e028d
line wrap: on
line diff
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -403,8 +403,12 @@ need_type_where(
     if (ret == OK)
 	return OK;
 
+    // If actual a constant a runtime check makes no sense.  If it's
+    // null_function it is OK.
+    if (actual_is_const && ret == MAYBE && actual == &t_func_unknown)
+	return OK;
+
     // If the actual type can be the expected type add a runtime check.
-    // If it's a constant a runtime check makes no sense.
     if (!actual_is_const && ret == MAYBE && use_typecheck(actual, expected))
     {
 	generate_TYPECHECK(cctx, expected, offset, where.wt_index);