1
0
forked from aniani/vim

patch 9.0.1207: error when object type is expected but getting "any"

Problem:    Error when object type is expected but getting "any".
Solution:   When actual type is "any" use a runtime type check.
            (closes #11826)
This commit is contained in:
Bram Moolenaar
2023-01-16 16:39:37 +00:00
parent 5a57a5e209
commit 450c7a97d1
3 changed files with 27 additions and 0 deletions

View File

@@ -878,6 +878,11 @@ check_type_maybe(
}
else if (expected->tt_type == VAR_OBJECT)
{
if (actual->tt_type == VAR_ANY)
return MAYBE; // use runtime type check
if (actual->tt_type != VAR_OBJECT)
return FAIL; // don't use tt_member
// check the class, base class or an implemented interface matches
class_T *cl;
for (cl = (class_T *)actual->tt_member; cl != NULL;