From: Jérémie Astor Date: Wed, 20 Apr 2022 11:48:43 +0000 (+0200) Subject: :art: test partial application X-Git-Tag: nightly~289 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=refs%2Fpull%2F246%2Fhead;p=gwion.git :art: test partial application --- diff --git a/src/parse/check.c b/src/parse/check.c index 6f091426..46a713a6 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -1320,7 +1320,7 @@ ANN static m_bool check_stmt_exp(const Env env, const Stmt_Exp stmt) { CHECK_OB(check_exp(env, stmt->val)); if(stmt->val->exp_type == ae_exp_lambda) { const loc_t loc = stmt->val->d.exp_lambda.def->base->pos; - env_warn(env, loc, "Partial application not used"); + env_warn(env, loc, _("Partial application not used")); } } return stmt->val ? check_exp(env, stmt->val) ? 1 : -1 : 1; diff --git a/src/parse/partial.c b/src/parse/partial.c index 685419f8..85aab198 100644 --- a/src/parse/partial.c +++ b/src/parse/partial.c @@ -138,8 +138,8 @@ ANN static Func partial_match(const Env env, const Func up, const Exp args, cons if(f->next) { const Func next = partial_match(env, f->next, args, loc); if(next) { - gwerr_basic("can't resolve ambiguity", "in this partial application", "use typed holes: _ $ type", env->name, loc, 0); - gw_err("\nthose functions could match:\n"); + gwerr_basic(_("can't resolve ambiguity"), _("in this partial application"), _("use typed holes: _ $ type"), env->name, loc, 0); + gw_err(_("\nthose functions could match:\n")); print_signature(f); ambiguity(env, next, args, loc); env->context->error = true; @@ -199,7 +199,7 @@ ANN Type partial_type(const Env env, Exp_Call *const call) { call->args = e; return partial_type(env, call); } - ERR_O(call->func->pos, "not match found for partial application"); + ERR_O(call->func->pos, _("no match found for partial application")); } Func_Base *const base = partial_base(env, f->def->base, call->args, call->func->pos); const Stmt code = partial_code(env, call->func, call->args); diff --git a/tests/apms/apms1.gw b/tests/partial/apms1.gw similarity index 100% rename from tests/apms/apms1.gw rename to tests/partial/apms1.gw diff --git a/tests/apms/apms2.gw b/tests/partial/apms2.gw similarity index 100% rename from tests/apms/apms2.gw rename to tests/partial/apms2.gw diff --git a/tests/apms/apms3.gw b/tests/partial/apms3.gw similarity index 100% rename from tests/apms/apms3.gw rename to tests/partial/apms3.gw diff --git a/tests/partial/partial_ambiguous.gw b/tests/partial/partial_ambiguous.gw new file mode 100644 index 00000000..3a273dd1 --- /dev/null +++ b/tests/partial/partial_ambiguous.gw @@ -0,0 +1,4 @@ +#! [contains] can't resolve ambiguity +fun void test(int i, int j) {} +fun void test(int i, string s) {} +test(_, _); diff --git a/tests/partial/partial_no_match.gw b/tests/partial/partial_no_match.gw new file mode 100644 index 00000000..8daa922e --- /dev/null +++ b/tests/partial/partial_no_match.gw @@ -0,0 +1,3 @@ +#! [contains] no match found for partial application +fun void test(int i) {} +test(_, _); diff --git a/tests/partial/partial_not_used.gw b/tests/partial/partial_not_used.gw new file mode 100644 index 00000000..936be2b4 --- /dev/null +++ b/tests/partial/partial_not_used.gw @@ -0,0 +1,2 @@ +#! [contains] Partial application not used +me.arg(_);