patch 9.0.1801: Vim9 instanceof() fails in a def func
Problem: Vim9 instanceof() fails in a def func
Solution: allow Objects in compile time check
closes: #12907
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
diff --git a/src/evalfunc.c b/src/evalfunc.c
index bdfd632..2cd1985 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -282,7 +282,11 @@
static int
arg_object(type_T *type, type_T *decl_type UNUSED, argcontext_T *context)
{
- return check_arg_type(&t_object, type, context);
+ if (type->tt_type == VAR_OBJECT
+ || type_any_or_unknown(type))
+ return OK;
+ arg_type_mismatch(&t_object, type, context->arg_idx + 1);
+ return FAIL;
}
/*