From 5f07055ac1548e6254651f40a23e74093a9bebfe Mon Sep 17 00:00:00 2001 From: gingerBill Date: Thu, 15 Jan 2026 17:28:28 +0000 Subject: Add `#must_tail` and `"preserve/none"` calling convention --- src/check_expr.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'src/check_expr.cpp') diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 3b470cb88..74ae02f94 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -8426,11 +8426,14 @@ gb_internal ExprKind check_call_expr(CheckerContext *c, Operand *operand, Ast *c break; case ProcTailing_must_tail: is_call_tailed = true; - if (proc != nullptr) { - Entity *e = entity_from_expr(proc); - if (e != nullptr && e->kind == Entity_Procedure) { - // TODO(bill): `preserve_none` - } + if (c->curr_proc_sig == nullptr || !are_types_identical(c->curr_proc_sig, pt)) { + ERROR_BLOCK(); + gbString a = type_to_string(pt); + gbString b = type_to_string(c->curr_proc_sig); + error(call, "Use of '#must_tail' of a procedure must have the same type as the procedure it was called within"); + error_line("\tCall type: %s, parent type: %s", a, b); + gb_string_free(b); + gb_string_free(a); } break; } -- cgit v1.2.3