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>
diff --git a/src/vim9expr.c b/src/vim9expr.c
index 9a96034..7b8c96a 100644
--- a/src/vim9expr.c
+++ b/src/vim9expr.c
@@ -373,6 +373,7 @@
break;
}
}
+
ocmember_T *ocm = NULL;
if (ufunc == NULL)
{
@@ -405,6 +406,15 @@
}
}
+ 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