aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tomo.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tomo.c b/tomo.c
index dea0e609..4d89c54c 100644
--- a/tomo.c
+++ b/tomo.c
@@ -562,6 +562,10 @@ void transpile_code(env_t *base_env, Text_t filename, bool force_retranspile)
binding_t *main_binding = get_binding(module_env, "main");
if (main_binding && main_binding->type->tag == FunctionType) {
+ type_t *ret = Match(main_binding->type, FunctionType)->ret;
+ if (ret->tag != VoidType && ret->tag != AbortType)
+ compiler_err(ast->file, ast->start, ast->end, "The main() function in this file has a return type of %T, but it should not have any return value!", ret);
+
CORD_put(CORD_all(
"int ", main_binding->code, "$parse_and_run(int argc, char *argv[]) {\n"
"#line 1\n"