Merge pull request #7013 from rmn64k/reject-chained-defer

Reject chained deferred procedures.
This commit is contained in:
gingerBill
2026-07-12 09:34:42 +01:00
committed by GitHub

View File

@@ -6884,6 +6884,13 @@ gb_internal void check_deferred_procedures(Checker *c) {
continue;
}
if (entity_has_deferred_procedure(dst)) {
error(src->token,
"Deferred procedure '%.*s' cannot be used as the target of '%.*s' because it has a deferred procedure itself (deferred procedure chaining is not allowed)",
LIT(dst->token.string), LIT(src->token.string));
continue;
}
if (is_type_polymorphic(src->type) || is_type_polymorphic(dst->type)) {
error(src->token, "'%s' cannot be used with a polymorphic procedure", attribute);
continue;