mirror of
https://github.com/vim/vim.git
synced 2025-09-25 03:54:15 -04:00
patch 8.2.1996: Vim9: invalid error for argument of extend()
Problem: Vim9: invalid error for argument of extend(). Solution: Check if the type could match. (closes #7299)
This commit is contained in:
@@ -516,6 +516,20 @@ check_type(type_T *expected, type_T *actual, int give_msg, int argidx)
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Like check_type() but also allow for a runtime type check. E.g. "any" can be
|
||||
* used for "number".
|
||||
*/
|
||||
int
|
||||
check_arg_type(type_T *expected, type_T *actual, int argidx)
|
||||
{
|
||||
if (check_type(expected, actual, FALSE, 0) == OK
|
||||
|| use_typecheck(actual, expected))
|
||||
return OK;
|
||||
// TODO: should generate a TYPECHECK instruction.
|
||||
return check_type(expected, actual, TRUE, argidx);
|
||||
}
|
||||
|
||||
/*
|
||||
* Skip over a type definition and return a pointer to just after it.
|
||||
* When "optional" is TRUE then a leading "?" is accepted.
|
||||
|
Reference in New Issue
Block a user