aboutsummaryrefslogtreecommitdiff
path: root/typecheck.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-03-18 15:27:07 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-03-18 15:27:07 -0400
commit7c0a77df332651c4dd6d4a6c80d3d7afabb22527 (patch)
tree4c1b883228263bfa38565926495d99e192877821 /typecheck.c
parentd94c1057accb197ec3b957fb91ff75597ac54c40 (diff)
Handle function type annotations without returns better
Diffstat (limited to 'typecheck.c')
-rw-r--r--typecheck.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/typecheck.c b/typecheck.c
index 4a73b32d..a48fa8ee 100644
--- a/typecheck.c
+++ b/typecheck.c
@@ -53,7 +53,7 @@ type_t *parse_type_ast(env_t *env, type_ast_t *ast)
}
case FunctionTypeAST: {
auto fn = Match(ast, FunctionTypeAST);
- type_t *ret_t = parse_type_ast(env, fn->ret);
+ type_t *ret_t = fn->ret ? parse_type_ast(env, fn->ret) : Type(VoidType);
if (has_stack_memory(ret_t))
code_err(fn->ret, "Functions are not allowed to return stack references, because the reference may no longer exist on the stack.");
arg_t *type_args = NULL;