aboutsummaryrefslogtreecommitdiff
path: root/typecheck.c
diff options
context:
space:
mode:
Diffstat (limited to 'typecheck.c')
-rw-r--r--typecheck.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/typecheck.c b/typecheck.c
index 43be2b97..410619a5 100644
--- a/typecheck.c
+++ b/typecheck.c
@@ -262,6 +262,8 @@ void bind_statement(env_t *env, ast_t *statement)
bind_statement(env, decl->value);
}
type_t *type = get_type(env, decl->value);
+ if (type->tag == FunctionType)
+ type = Type(ClosureType, type);
CORD prefix = namespace_prefix(env->libname, env->namespace);
CORD code = CORD_cat(prefix ? prefix : "$", name);
set_binding(env, name, new(binding_t, .type=type, .code=code));