patch 9.0.2085: Vim9: abstract can be used in interface
Problem: Vim9: abstract can be used in interface
Solution: Disallow the use of abstract in an interface
fixes: #13456
closes: #13464
Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/vim9class.c b/src/vim9class.c
index ede310b..08c3713 100644
--- a/src/vim9class.c
+++ b/src/vim9class.c
@@ -1557,26 +1557,27 @@
break;
}
- if (!is_class)
- // ignore "abstract" in an interface (as all the methods in an
- // interface are abstract.
- p = skipwhite(pa + 8);
- else
+ p = skipwhite(pa + 8);
+ if (STRNCMP(p, "def", 3) != 0 && STRNCMP(p, "static", 6) != 0)
{
- if (!is_abstract)
- {
- semsg(_(e_abstract_method_in_concrete_class), pa);
- break;
- }
-
- abstract_method = TRUE;
- p = skipwhite(pa + 8);
- if (STRNCMP(p, "def", 3) != 0)
- {
- emsg(_(e_abstract_must_be_followed_by_def));
- break;
- }
+ emsg(_(e_abstract_must_be_followed_by_def_or_static));
+ break;
}
+
+ if (!is_class)
+ {
+ // "abstract" not supported in an interface
+ emsg(_(e_abstract_cannot_be_used_in_interface));
+ break;
+ }
+
+ if (!is_abstract)
+ {
+ semsg(_(e_abstract_method_in_concrete_class), pa);
+ break;
+ }
+
+ abstract_method = TRUE;
}
int has_static = FALSE;