[m-rev.] diff: diagnose one colon, not two, in predmode decls

Julien Fischer jfischer at opturion.com
Mon Apr 22 00:29:34 AEST 2024


On Sun, 21 Apr 2024, Zoltan Somogyi wrote:

> Diagnose predmode decls with one colon, not two.
> 
> compiler/parse_type_name.m:
>     Generate a specific error message for predmode declarations in which
>     the type and mode of an argument are joined by one colon, not two.
>     It is an easy mistake to make, but a hard one to see without the
>     specific error message added by this diff, because the brain tends to see
>     what it intended to type, not what it actually typed.
> 
> tests/invalid_nodepend/predmode.{m,err_exp}:
>     Extend this test case to test for the new error messsage.
...

> diff --git a/tests/invalid_nodepend/predmode.err_exp b/tests/invalid_nodepend/predmode.err_exp
> index 75477c1cc..0160bafe7 100644
> --- a/tests/invalid_nodepend/predmode.err_exp
> +++ b/tests/invalid_nodepend/predmode.err_exp
> @@ -8,7 +8,10 @@ predmode.m:017:   in the first argument:
>  predmode.m:017:   error: an integer such as `2' cannot be a valid mode.
>  predmode.m:017: In `:- pred' declaration:
>  predmode.m:017:   in the second argument:
> +predmode.m:017:   error: the type and mode are separated by one colon, not two.

It wouldn't hurt for the error message to show the symbols involved as well, e.g.

     error: the type and mode are separated by one colon (`:`), not two (`::`).

Julien.


More information about the reviews mailing list