0
0
mirror of https://github.com/vim/vim.git synced 2025-09-23 03:43:49 -04:00

patch 9.1.1094: Vim9: problem finding implemented method in type hierarchy

Problem:  Vim9: problem finding implemented method for abstract method
          in type hierarchy (Aliaksei Budavei)
Solution: When checking for abstract methods in an extended class, check
          whether an abstract method is implemented in one of the parent
          classes (Yegappan Lakshmanan)

fixes: #16495
closes: #16497

Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Yegappan Lakshmanan
2025-02-09 19:39:52 +01:00
committed by Christian Brabandt
parent f30eb4a170
commit 68d0858892
4 changed files with 175 additions and 6 deletions

View File

@@ -561,20 +561,34 @@ validate_abstract_class_methods(
if (!IS_ABSTRACT_METHOD(uf))
continue;
int method_found = FALSE;
int concrete_method_found = FALSE;
int j = 0;
for (int j = 0; j < method_count; j++)
// Check if the abstract method is already implemented in one of
// the parent classes.
for (j = 0; !concrete_method_found && j < i; j++)
{
ufunc_T *uf2 = extends_methods[j];
if (!IS_ABSTRACT_METHOD(uf2) &&
STRCMP(uf->uf_name, uf2->uf_name) == 0)
concrete_method_found = TRUE;
}
if (concrete_method_found)
continue;
for (j = 0; j < method_count; j++)
{
if (STRCMP(uf->uf_name, cl_fp[j]->uf_name) == 0)
{
method_found = TRUE;
concrete_method_found = TRUE;
break;
}
}
if (!method_found)
if (!concrete_method_found)
{
semsg(_(e_abstract_method_str_not_found), uf->uf_name);
semsg(_(e_abstract_method_str_not_implemented), uf->uf_name);
return FALSE;
}
}