aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2026-01-15 17:28:28 +0000
committergingerBill <gingerBill@users.noreply.github.com>2026-01-15 17:28:28 +0000
commit5f07055ac1548e6254651f40a23e74093a9bebfe (patch)
tree62d3123463beb55f8be5c1a32f177be08888ee4f /src/check_expr.cpp
parent0366cd3304b3910a397c4989e46bee4c575adeec (diff)
Add `#must_tail` and `"preserve/none"` calling convention
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp13
1 files changed, 8 insertions, 5 deletions
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;
}