[m-rev.] for review: improve messages for some mode errors
Peter Wang
novalazy at gmail.com
Tue Jan 28 12:25:21 AEDT 2020
On Fri, 24 Jan 2020 16:26:10 +1100 (AEDT), "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
>
>
> On Fri, 24 Jan 2020 15:52:44 +1100 (AEDT), "Zoltan Somogyi" <zoltan.somogyi at runbox.com> wrote:
> > Yes, that is better. Later today I will post a diff
> > that incorporates this change, and adds a warning
> > about possible arity mismatches between type and inst
> > when the inst involved contains a higher order inst.
> > This is not as good as mentioning this only when this
> > actually is the cause of the inst mismatch, but it is
> > much easier to implement.
>
> Here is that diff. For post commit review by anyone.
That's fine.
diff --git a/tests/invalid/ho_type_mode_bug.err_exp b/tests/invalid/ho_type_mode_bug.err_exp
index 44bce363d..d48ff5be2 100644
--- a/tests/invalid/ho_type_mode_bug.err_exp
+++ b/tests/invalid/ho_type_mode_bug.err_exp
@@ -25,12 +25,16 @@ ho_type_mode_bug.m:029: free,
ho_type_mode_bug.m:029: free
ho_type_mode_bug.m:029: which does not match any of the modes for predicate
ho_type_mode_bug.m:029: `ho_type_mode_bug.my_foldl2'/6.
-ho_type_mode_bug.m:029: The first argument `P', whose inst is
-ho_type_mode_bug.m:029: `(pred(in, in, out) is det)', does not match any of
-ho_type_mode_bug.m:029: those modes.
-ho_type_mode_bug.m:029: The third argument `FirstAcc1', whose inst is `free',
+ho_type_mode_bug.m:029: The first argument `P' has inst
+ho_type_mode_bug.m:029: `(pred(in, in, out) is det)', which does not match
+ho_type_mode_bug.m:029: any of those modes.
+ho_type_mode_bug.m:029: (For higher order insts like this, the mismatch is
+ho_type_mode_bug.m:029: sometimes caused by the arity of the predicate or
+ho_type_mode_bug.m:029: function being different in the inst than in the
+ho_type_mode_bug.m:029: type.)
Possible alternatives; may or may not be clearer:
For a higher order inst, the mismatch may be
due to different arities in the inst and in
the type of the predicate or function.
For a higher order inst such as this, the
mismatch may be due to the arity of the
predicate or function being different in the
inst and in the type.
Basically, I don't like "different than" :P but you don't need to change
anything.
Peter
More information about the reviews
mailing list