patch 9.0.1179: not all errors around inheritance are tested
Problem: Not all errors around inheritance are tested.
Solution: Add more tests. Fix uncovered problems.
diff --git a/src/vim9compile.c b/src/vim9compile.c
index 9fe8507..cc7a3bd 100644
--- a/src/vim9compile.c
+++ b/src/vim9compile.c
@@ -49,6 +49,20 @@
&& (cctx->ctx_ufunc->uf_flags & (FC_OBJECT|FC_NEW)))
{
int is_super = *name == 's';
+ if (is_super)
+ {
+ if (name[5] != '.')
+ {
+ emsg(_(e_super_must_be_followed_by_dot));
+ return FAIL;
+ }
+ if (cctx->ctx_ufunc->uf_class != NULL
+ && cctx->ctx_ufunc->uf_class->class_extends == NULL)
+ {
+ emsg(_(e_using_super_not_in_child_class));
+ return FAIL;
+ }
+ }
if (lvar != NULL)
{
CLEAR_POINTER(lvar);