]> Nishi Git Mirror - gwion.git/commitdiff
:art: test partial application 246/head
authorJérémie Astor <fennecdjay@gmail.com>
Wed, 20 Apr 2022 11:48:43 +0000 (13:48 +0200)
committerJérémie Astor <fennecdjay@gmail.com>
Wed, 20 Apr 2022 11:48:43 +0000 (13:48 +0200)
src/parse/check.c
src/parse/partial.c
tests/partial/apms1.gw [moved from tests/apms/apms1.gw with 100% similarity]
tests/partial/apms2.gw [moved from tests/apms/apms2.gw with 100% similarity]
tests/partial/apms3.gw [moved from tests/apms/apms3.gw with 100% similarity]
tests/partial/partial_ambiguous.gw [new file with mode: 0644]
tests/partial/partial_no_match.gw [new file with mode: 0644]
tests/partial/partial_not_used.gw [new file with mode: 0644]

index 6f0914260ac7d824f3b77a476e2292066b5bac10..46a713a67204446efa02bed2f1e75767f6b334aa 100644 (file)
@@ -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;
index 685419f803c2ff07ed11ea6237905fe3e8eea121..85aab198ff3bbdf87bd49cc176980b5b83f3e012 100644 (file)
@@ -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);
similarity index 100%
rename from tests/apms/apms1.gw
rename to tests/partial/apms1.gw
similarity index 100%
rename from tests/apms/apms2.gw
rename to tests/partial/apms2.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 (file)
index 0000000..3a273dd
--- /dev/null
@@ -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 (file)
index 0000000..8daa922
--- /dev/null
@@ -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 (file)
index 0000000..936be2b
--- /dev/null
@@ -0,0 +1,2 @@
+#! [contains] Partial application not used
+me.arg(_);