core: type: check if a class tries to implement an interface it doesn't extend or inherit

This commit is contained in:
2025-10-28 15:17:50 +00:00
parent e8eee9ca0d
commit b58015baff
3 changed files with 24 additions and 1 deletions

View File

@@ -719,10 +719,25 @@ static const struct b_error_definition builtin_errors[] = {
"Class initialisation failure"),
};
static const struct b_error_msg builtin_msg[] = {
B_ERROR_MSG(B_MSG_TYPE_REGISTRATION_FAILURE, "Type registration failed"),
B_ERROR_MSG(B_MSG_CLASS_INIT_FAILURE, "Class initialisation failed"),
B_ERROR_MSG_TEMPLATE(
B_MSG_CLASS_SPECIFIES_UNKNOWN_INTERFACE,
"Class @[class_name] specifies an implementation for interface "
"@[interface_name] that it does not extend or inherit",
B_ERROR_TEMPLATE_PARAM(
"class_name", B_ERROR_TEMPLATE_PARAM_STRING, "%s"),
B_ERROR_TEMPLATE_PARAM(
"interface_name", B_ERROR_TEMPLATE_PARAM_STRING, "%s")),
};
static const struct b_error_vendor builtin_vendor = {
.v_name = "Blue",
.v_error_definitions = builtin_errors,
.v_error_definitions_length = sizeof builtin_errors,
.v_msg = builtin_msg,
.v_msg_length = sizeof builtin_msg,
};
static void get_error_id(