Patch 9.0.0703
Problem: Failing check for argument type for const any.
Solution: Check for any type properly. (closes #11316)
Files: src/evalfunc.c, src/vim9type.c, src/proto/vim9type.pro,
src/testdir/test_vim9_script.vim
*** ../vim-9.0.0702/src/evalfunc.c 2022-10-07 14:31:04.320852668 +0100
--- src/evalfunc.c 2022-10-09 12:51:21.574160614 +0100
***************
*** 257,266 ****
static int
arg_float_or_nr(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_FLOAT
! || type->tt_type == VAR_NUMBER)
return OK;
arg_type_mismatch(&t_number, type, context->arg_idx + 1);
return FAIL;
--- 257,265 ----
static int
arg_float_or_nr(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
! if (type->tt_type == VAR_FLOAT
! || type->tt_type == VAR_NUMBER
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_number, type, context->arg_idx + 1);
return FAIL;
***************
*** 356,365 ****
static int
arg_list_or_blob(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_LIST
! || type->tt_type == VAR_BLOB)
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
return FAIL;
--- 355,363 ----
static int
arg_list_or_blob(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_LIST
! || type->tt_type == VAR_BLOB
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
return FAIL;
***************
*** 385,394 ****
static int
arg_string_or_nr(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_STRING
! || type->tt_type == VAR_NUMBER)
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
--- 383,391 ----
static int
arg_string_or_nr(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_STRING
! || type->tt_type == VAR_NUMBER
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
***************
*** 400,409 ****
static int
arg_buffer(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_STRING
! || type->tt_type == VAR_NUMBER)
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
--- 397,405 ----
static int
arg_buffer(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
! if (type->tt_type == VAR_STRING
! || type->tt_type == VAR_NUMBER
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
***************
*** 415,425 ****
static int
arg_buffer_or_dict_any(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_STRING
|| type->tt_type == VAR_NUMBER
! || type->tt_type == VAR_DICT)
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
--- 411,420 ----
static int
arg_buffer_or_dict_any(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_NUMBER
! || type->tt_type == VAR_DICT
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
***************
*** 431,440 ****
static int
arg_lnum(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_STRING
! || type->tt_type == VAR_NUMBER)
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
--- 426,434 ----
static int
arg_lnum(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
! if (type->tt_type == VAR_STRING
! || type->tt_type == VAR_NUMBER
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
***************
*** 446,454 ****
static int
arg_string_or_list_string(type_T *type, type_T *decl_type UNUSED,
argcontext_T *context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_STRING)
return OK;
if (type->tt_type != VAR_LIST)
{
--- 440,447 ----
static int
arg_string_or_list_string(type_T *type, type_T *decl_type UNUSED,
argcontext_T *context)
{
! if (type->tt_type == VAR_STRING
! || type_any_or_unknown(type))
return OK;
if (type->tt_type != VAR_LIST)
{
***************
*** 469,478 ****
static int
arg_string_or_list_any(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_STRING
! || type->tt_type == VAR_LIST)
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
--- 462,470 ----
static int
arg_string_or_list_any(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_STRING
! || type->tt_type == VAR_LIST
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
***************
*** 484,493 ****
static int
arg_string_or_dict_any(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_STRING
! || type->tt_type == VAR_DICT)
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
--- 476,484 ----
static int
arg_string_or_dict_any(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_STRING
! || type->tt_type == VAR_DICT
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
***************
*** 499,508 ****
static int
arg_string_or_blob(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_STRING
! || type->tt_type == VAR_BLOB)
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
--- 490,498 ----
static int
arg_string_or_blob(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_STRING
! || type->tt_type == VAR_BLOB
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
***************
*** 514,523 ****
static int
arg_list_or_dict(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_LIST
! || type->tt_type == VAR_DICT)
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
return FAIL;
--- 504,512 ----
static int
arg_list_or_dict(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_LIST
! || type->tt_type == VAR_DICT
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
return FAIL;
***************
*** 547,557 ****
type_T *decl_type UNUSED,
argcontext_T *context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_LIST
|| type->tt_type == VAR_DICT
! || type->tt_type == VAR_BLOB)
return arg_type_modifiable(type, context->arg_idx + 1);
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
return FAIL;
--- 536,545 ----
type_T *decl_type UNUSED,
argcontext_T *context)
{
! if (type->tt_type == VAR_LIST
|| type->tt_type == VAR_DICT
! || type->tt_type == VAR_BLOB
! || type_any_or_unknown(type))
return arg_type_modifiable(type, context->arg_idx + 1);
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
return FAIL;
***************
*** 563,574 ****
static int
arg_list_or_dict_or_blob_or_string(type_T *type, type_T *decl_type UNUSED,
argcontext_T *context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_LIST
|| type->tt_type == VAR_DICT
|| type->tt_type == VAR_BLOB
! || type->tt_type == VAR_STRING)
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
return FAIL;
--- 551,561 ----
static int
arg_list_or_dict_or_blob_or_string(type_T *type, type_T *decl_type UNUSED,
argcontext_T *context)
{
! if (type->tt_type == VAR_LIST
|| type->tt_type == VAR_DICT
|| type->tt_type == VAR_BLOB
! || type->tt_type == VAR_STRING
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
return FAIL;
***************
*** 642,656 ****
}
}
! if ((type->tt_member != &t_any && type->tt_member != &t_unknown)
! || args[0] != NULL)
{
where_T where = WHERE_INIT;
if (is_map)
t_func_exp.tt_member = expected_member == NULL
! || type->tt_member == &t_any
! || type->tt_member == &t_unknown
? &t_any : expected_member;
else
t_func_exp.tt_member = &t_bool;
--- 629,641 ----
}
}
! if (!type_any_or_unknown(type->tt_member) || args[0] != NULL)
{
where_T where = WHERE_INIT;
if (is_map)
t_func_exp.tt_member = expected_member == NULL
! || type_any_or_unknown(type->tt_member)
? &t_any : expected_member;
else
t_func_exp.tt_member = &t_bool;
***************
*** 673,680 ****
{
if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_PARTIAL
! || type == &t_unknown
! || type == &t_any)
return OK;
if (type->tt_type == VAR_FUNC)
--- 658,664 ----
{
if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_PARTIAL
! || type_any_or_unknown(type))
return OK;
if (type->tt_type == VAR_FUNC)
***************
*** 691,698 ****
{
if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_PARTIAL
! || type == &t_unknown
! || type == &t_any)
return OK;
if (type->tt_type == VAR_FUNC)
--- 675,681 ----
{
if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_PARTIAL
! || type_any_or_unknown(type))
return OK;
if (type->tt_type == VAR_FUNC)
***************
*** 709,716 ****
{
if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_PARTIAL
! || type == &t_unknown
! || type == &t_any)
return OK;
if (type->tt_type == VAR_FUNC)
--- 692,698 ----
{
if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_PARTIAL
! || type_any_or_unknown(type))
return OK;
if (type->tt_type == VAR_FUNC)
***************
*** 722,729 ****
args[0] = context->arg_types[0].type_curr->tt_member;
else
args[0] = &t_unknown;
! if ((type->tt_member != &t_any && type->tt_member != &t_unknown)
! || args[0] != &t_unknown)
{
where_T where = WHERE_INIT;
--- 704,710 ----
args[0] = context->arg_types[0].type_curr->tt_member;
else
args[0] = &t_unknown;
! if (!type_any_or_unknown(type->tt_member) || args[0] != &t_unknown)
{
where_T where = WHERE_INIT;
***************
*** 748,760 ****
static int
arg_string_or_func(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_STRING
|| type->tt_type == VAR_PARTIAL
|| type->tt_type == VAR_FUNC
|| type->tt_type == VAR_BOOL
! || type->tt_type == VAR_NUMBER)
return OK;
arg_type_mismatch(&t_func_any, type, context->arg_idx + 1);
return FAIL;
--- 729,740 ----
static int
arg_string_or_func(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_PARTIAL
|| type->tt_type == VAR_FUNC
|| type->tt_type == VAR_BOOL
! || type->tt_type == VAR_NUMBER
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_func_any, type, context->arg_idx + 1);
return FAIL;
***************
*** 766,776 ****
static int
arg_string_list_or_blob(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_LIST
|| type->tt_type == VAR_BLOB
! || type->tt_type == VAR_STRING)
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
return FAIL;
--- 746,755 ----
static int
arg_string_list_or_blob(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_LIST
|| type->tt_type == VAR_BLOB
! || type->tt_type == VAR_STRING
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
return FAIL;
***************
*** 791,800 ****
static int
arg_chan_or_job(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_CHANNEL
! || type->tt_type == VAR_JOB)
return OK;
arg_type_mismatch(&t_channel, type, context->arg_idx + 1);
return FAIL;
--- 770,778 ----
static int
arg_chan_or_job(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
! if (type->tt_type == VAR_CHANNEL
! || type->tt_type == VAR_JOB
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_channel, type, context->arg_idx + 1);
return FAIL;
***************
*** 854,864 ****
static int
arg_str_or_nr_or_list(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_STRING
|| type->tt_type == VAR_NUMBER
! || type->tt_type == VAR_LIST)
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
--- 832,841 ----
static int
arg_str_or_nr_or_list(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_NUMBER
! || type->tt_type == VAR_LIST
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
***************
*** 870,879 ****
static int
arg_dict_any_or_string(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_DICT
! || type->tt_type == VAR_STRING)
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
--- 847,855 ----
static int
arg_dict_any_or_string(type_T *type, type_T *decl_type UNUSED, argcontext_T
*context)
{
! if (type->tt_type == VAR_DICT
! || type->tt_type == VAR_STRING
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
return FAIL;
***************
*** 902,914 ****
static int
arg_get1(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_BLOB
|| type->tt_type == VAR_LIST
|| type->tt_type == VAR_DICT
|| type->tt_type == VAR_FUNC
! || type->tt_type == VAR_PARTIAL)
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
--- 878,889 ----
static int
arg_get1(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
! if (type->tt_type == VAR_BLOB
|| type->tt_type == VAR_LIST
|| type->tt_type == VAR_DICT
|| type->tt_type == VAR_FUNC
! || type->tt_type == VAR_PARTIAL
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
***************
*** 922,934 ****
static int
arg_len1(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_STRING
|| type->tt_type == VAR_NUMBER
|| type->tt_type == VAR_BLOB
|| type->tt_type == VAR_LIST
! || type->tt_type == VAR_DICT)
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
--- 897,908 ----
static int
arg_len1(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
! if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_NUMBER
|| type->tt_type == VAR_BLOB
|| type->tt_type == VAR_LIST
! || type->tt_type == VAR_DICT
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
***************
*** 958,969 ****
static int
arg_repeat1(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_STRING
|| type->tt_type == VAR_NUMBER
|| type->tt_type == VAR_BLOB
! || type->tt_type == VAR_LIST)
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
--- 932,942 ----
static int
arg_repeat1(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
! if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_NUMBER
|| type->tt_type == VAR_BLOB
! || type->tt_type == VAR_LIST
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_string, type, context->arg_idx + 1);
***************
*** 977,987 ****
static int
arg_slice1(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_LIST
|| type->tt_type == VAR_BLOB
! || type->tt_type == VAR_STRING)
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
--- 950,959 ----
static int
arg_slice1(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
! if (type->tt_type == VAR_LIST
|| type->tt_type == VAR_BLOB
! || type->tt_type == VAR_STRING
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_list_any, type, context->arg_idx + 1);
***************
*** 995,1005 ****
static int
arg_string_or_list_or_dict(type_T *type, type_T *decl_type UNUSED,
argcontext_T *context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_STRING
|| type->tt_type == VAR_LIST
! || type->tt_type == VAR_DICT)
return OK;
semsg(_(e_string_list_or_dict_required_for_argument_nr),
--- 967,976 ----
static int
arg_string_or_list_or_dict(type_T *type, type_T *decl_type UNUSED,
argcontext_T *context)
{
! if (type->tt_type == VAR_STRING
|| type->tt_type == VAR_LIST
! || type->tt_type == VAR_DICT
! || type_any_or_unknown(type))
return OK;
semsg(_(e_string_list_or_dict_required_for_argument_nr),
***************
*** 1014,1024 ****
static int
arg_cursor1(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
! if (type->tt_type == VAR_ANY
! || type->tt_type == VAR_UNKNOWN
! || type->tt_type == VAR_NUMBER
|| type->tt_type == VAR_STRING
! || type->tt_type == VAR_LIST)
return OK;
arg_type_mismatch(&t_number, type, context->arg_idx + 1);
--- 985,994 ----
static int
arg_cursor1(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
! if (type->tt_type == VAR_NUMBER
|| type->tt_type == VAR_STRING
! || type->tt_type == VAR_LIST
! || type_any_or_unknown(type))
return OK;
arg_type_mismatch(&t_number, type, context->arg_idx + 1);
*** ../vim-9.0.0702/src/vim9type.c 2022-09-30 12:00:02.329104816 +0100
--- src/vim9type.c 2022-10-09 12:41:42.297715665 +0100
***************
*** 337,342 ****
--- 337,353 ----
}
/*
+ * Return TRUE if "type" is NULL, any or unknown.
+ * This also works for const (comparing with &t_any and &t_unknown doesn't).
+ */
+ int
+ type_any_or_unknown(type_T *type)
+ {
+ return type == NULL || type->tt_type == VAR_ANY
+ || type->tt_type == VAR_UNKNOWN;
+ }
+
+ /*
* Get a type_T for a typval_T.
* "type_gap" is used to temporarily create types in.
* When "flags" has TVTT_DO_MEMBER also get the member type, otherwise use
*** ../vim-9.0.0702/src/proto/vim9type.pro 2022-09-29 19:14:37.675876694
+0100
--- src/proto/vim9type.pro 2022-10-09 12:42:08.645754593 +0100
***************
*** 9,14 ****
--- 9,15 ----
type_T *alloc_func_type(type_T *ret_type, int argcount, garray_T *type_gap);
type_T *get_func_type(type_T *ret_type, int argcount, garray_T *type_gap);
int func_type_add_arg_types(type_T *functype, int argcount, garray_T
*type_gap);
+ int type_any_or_unknown(type_T *type);
int need_convert_to_bool(type_T *type, typval_T *tv);
type_T *typval2type(typval_T *tv, int copyID, garray_T *type_gap, int flags);
type_T *typval2type_vimvar(typval_T *tv, garray_T *type_gap);
*** ../vim-9.0.0702/src/testdir/test_vim9_script.vim 2022-10-08
14:39:31.966903597 +0100
--- src/testdir/test_vim9_script.vim 2022-10-09 12:38:01.657274740 +0100
***************
*** 305,310 ****
--- 305,329 ----
assert_equal(v:t_number, type(foo.bar))
END
v9.CheckDefAndScriptSuccess(lines)
+
+ # also when used as a builtin function argument
+ lines =<< trim END
+ vim9script
+
+ def SorterFunc(lhs: dict<string>, rhs: dict<string>): number
+ return lhs.name <# rhs.name ? -1 : 1
+ enddef
+
+ def Run(): void
+ var list = [{name: "3"}, {name: "2"}]
+ const Sorter = get({}, "unknown", SorterFunc)
+ sort(list, Sorter)
+ assert_equal([{name: "2"}, {name: "3"}], list)
+ enddef
+
+ Run()
+ END
+ v9.CheckScriptSuccess(lines)
enddef
def Test_const_bang()
*** ../vim-9.0.0702/src/version.c 2022-10-09 11:44:22.953119184 +0100
--- src/version.c 2022-10-09 12:35:44.388866945 +0100
***************
*** 701,702 ****
--- 701,704 ----
{ /* Add new patch number below this line */
+ /**/
+ 703,
/**/
--
Veni, Vidi, Video -- I came, I saw, I taped what I saw.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// \\\
\\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/20221009121438.A0A1B1C065C%40moolenaar.net.