1
0
forked from aniani/vim

patch 9.1.1037: Vim9: confusing error when using abstract method via super

Problem:  Vim9: confusing error when using abstract method via super
Solution: Display an error when an abstract method is invoked using
          super (Ernie Rael)

fixes: #15514
closes: #16478

Signed-off-by: Ernie Rael <errael@raelity.com>
Signed-off-by: Aliaksei Budavei <0x000c70@gmail.com>
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Ernie Rael
2025-01-19 10:03:00 +01:00
committed by Christian Brabandt
parent 5abc44e3c1
commit bce60c4742
4 changed files with 223 additions and 54 deletions

View File

@@ -373,6 +373,7 @@ compile_class_object_index(cctx_T *cctx, char_u **arg, type_T *type)
break;
}
}
ocmember_T *ocm = NULL;
if (ufunc == NULL)
{
@@ -405,6 +406,15 @@ compile_class_object_index(cctx_T *cctx, char_u **arg, type_T *type)
}
}
if (is_super && IS_ABSTRACT_METHOD(ufunc))
{
// Trying to invoke an abstract method in a super class is not
// allowed.
semsg(_(e_abstract_method_str_direct), ufunc->uf_name,
ufunc->uf_defclass->class_name);
return FAIL;
}
// A private object method can be used only inside the class where it
// is defined or in one of the child classes.
// A private class method can be used only in the class where it is