diff options
Diffstat (limited to 'src/vim9type.c')
-rw-r--r-- | src/vim9type.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/vim9type.c b/src/vim9type.c index dcfc998c57..fe4dec59f0 100644 --- a/src/vim9type.c +++ b/src/vim9type.c @@ -567,22 +567,19 @@ check_typval_type(type_T *expected, typval_T *actual_tv, where_T where) if (expected == NULL) return OK; // didn't expect anything. + // + ga_init2(&type_list, sizeof(type_T *), 10); - // For some values there is no type, assume an error will be given later - // for an invalid value. + // A null_function and null_partial are special cases, they can be used to + // clear a variable. 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); - - // When the actual type is list<any> or dict<any> go through the values to - // possibly get a more specific type. - actual_type = typval2type(actual_tv, get_copyID(), &type_list, + actual_type = &t_func_unknown; + else + // When the actual type is list<any> or dict<any> go through the values + // to possibly get a more specific type. + actual_type = typval2type(actual_tv, get_copyID(), &type_list, TVTT_DO_MEMBER | TVTT_MORE_SPECIFIC); if (actual_type != NULL) { |