This commit is contained in:
gingerBill
2024-08-30 11:01:06 +01:00
parent 9197a126fc
commit a4e865f90b

View File

@@ -1786,7 +1786,9 @@ gb_internal void add_entity_use(CheckerContext *c, Ast *identifier, Entity *enti
entity->flags |= EntityFlag_Used;
if (entity_has_deferred_procedure(entity)) {
Entity *deferred = entity->Procedure.deferred_procedure.entity;
add_entity_use(c, nullptr, deferred);
if (deferred != entity) {
add_entity_use(c, nullptr, deferred);
}
}
if (identifier == nullptr || identifier->kind != Ast_Ident) {
return;
@@ -6114,6 +6116,11 @@ gb_internal void check_deferred_procedures(Checker *c) {
case DeferredProcedure_in_out_by_ptr: attribute = "deferred_in_out_by_ptr"; break;
}
if (src == dst) {
error(src->token, "'%.*s' cannot be used as its own %s", LIT(dst->token.string), attribute);
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;