From 26ff4f0ed6de6f793debcdbd51ab55cab4f469bc Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Tue, 26 Apr 2022 21:54:13 +0200 Subject: [PATCH] :bug: fix lambda calls --- src/parse/check.c | 5 +++-- src/parse/partial.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/parse/check.c b/src/parse/check.c index f01a3a0b..f9a8abc0 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -763,9 +763,10 @@ ANN static Exp check_lambda_captures(const Env env, const Func_Def fdef) { ANN static Type check_lambda_call(const Env env, Exp_Call *const exp) { const Func_Def fdef = exp->func->d.exp_lambda.def; + const bool captures = !!fdef->captures; if (exp->args) CHECK_BO(lambda_args_ref(env, exp)); - const Exp _args = !fdef->captures ? NULL : check_lambda_captures(env, fdef); - if(fdef->captures) CHECK_BO(lambda_append_args(env, exp, _args)); + const Exp _args = !captures ? NULL : check_lambda_captures(env, fdef); + if(captures) CHECK_BO(lambda_append_args(env, exp, _args)); Exp_Lambda *l = &exp->func->d.exp_lambda; Arg_List args = l->def->base->args; Exp e = exp->args; diff --git a/src/parse/partial.c b/src/parse/partial.c index 7ceb1727..a539c597 100644 --- a/src/parse/partial.c +++ b/src/parse/partial.c @@ -194,7 +194,7 @@ ANN static Exp expand(const Env env, const Func func, const Exp e, const loc_t l ANN Type partial_type(const Env env, Exp_Call *const call) { const Func base = call->func->type->info->func; - if(!base) ERR_O(call->func->pos, _("can't partially apply call a literal lambda")); + if(!base) ERR_O(call->func->pos, _("can't do partiall application on a literal lambda")); const Func f = partial_match(env, base, call->args, call->func->pos); if(!f) { const Exp e = expand(env, call->func->type->info->func, call->args, call->func->pos); -- 2.43.0