From 955f047e069497be4cbeffa3e0309360aeb1efa7 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 9 Mar 2024 14:02:19 -0500 Subject: First pass at lambdas/closures --- typecheck.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'typecheck.c') diff --git a/typecheck.c b/typecheck.c index 10f2f1d4..88b9d892 100644 --- a/typecheck.c +++ b/typecheck.c @@ -396,6 +396,8 @@ type_t *get_type(env_t *env, ast_t *ast) return t; // Constructor code_err(call->fn, "This is not a type that has a constructor"); } + if (fn_type_t->tag == ClosureType) + fn_type_t = Match(fn_type_t, ClosureType)->fn; if (fn_type_t->tag != FunctionType) code_err(call->fn, "This isn't a function, it's a %T", fn_type_t); auto fn_type = Match(fn_type_t, FunctionType); -- cgit v1.2.3