From: Jérémie Astor Date: Tue, 26 Apr 2022 19:54:13 +0000 (+0200) Subject: :bug: fix lambda calls X-Git-Tag: nightly~275^2~37 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=26ff4f0ed6de6f793debcdbd51ab55cab4f469bc;p=gwion.git :bug: fix lambda calls --- 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);