[m-rev.] for review: diffs for arg type lists
Julien Fischer
jfischer at opturion.com
Sun Dec 30 13:49:55 AEDT 2018
Hi Zoltan,
On Sun, 30 Dec 2018, Zoltan Somogyi wrote:
> Print an arg type list diff for arg lists with wrong arity.
...
> library/diff.m:
> A new module for computing diffs.
One small issue here is that the in samples/diff we have a module named diff.
That should probably be renamed.
...
> diff --git a/tests/invalid/bad_pred_arity.m b/tests/invalid/bad_pred_arity.m
> index e69de29..82a6b99 100644
> --- a/tests/invalid/bad_pred_arity.m
> +++ b/tests/invalid/bad_pred_arity.m
> @@ -0,0 +1,29 @@
> +%---------------------------------------------------------------------------%
> +% vim: ft=mercury ts=4 sw=4 et
> +%---------------------------------------------------------------------------%
> +%
> +% Test the error messages we generate for situations in which there is a
> +% mismatch between (a) the declared arity or arities of a predicate or
> +% function, and (b) their actual arity or arities in their defining clause(s).
> +%
> +%---------------------------------------------------------------------------%
> +
> +:- module bad_pred_arity.
> +:- interface.
> +
> +:- pred p(int::in, float::in, string::in,
> + int::out, string::out) is det.
> +:- pred p(int::in,
> + int::out, string::out) is det.
> +
> +%---------------------------------------------------------------------------%
> +%---------------------------------------------------------------------------%
> +
> +:- implementation.
> +
> +:- import_module int.
> +:- import_module string.
> +
> +p(I, S, I + 1, S ++ "abc").
> +
> +%---------------------------------------------------------------------------%
This test should be more comprehensive, for example if the declaration or
clause has arity 0, if there is more than one difference between the lists,
where the declaration involved is a function etc.
> diff --git a/tests/invalid/try_detism.err_exp b/tests/invalid/try_detism.err_exp
> index 90d2822..5bd877b 100644
> --- a/tests/invalid/try_detism.err_exp
> +++ b/tests/invalid/try_detism.err_exp
...
This one has changed more than I would have expected; is it just that its not
often run -- there is a .err_exp2 file for this one as well -- or is there some
other reason for the differences?
That looks fine otherwise.
Julien.
More information about the reviews
mailing list