[m-rev.] for review: Improve coerce mode error messages.

Julien Fischer jfischer at opturion.com
Mon May 17 12:48:32 AEST 2021


Hi Peter,

On Mon, 17 May 2021, Peter Wang wrote:

> On Sat, 15 May 2021 00:06:07 +1000 Julien Fischer <jfischer at opturion.com> wrote:
>>
>> Hi Peter,
>>
>> On Wed, 12 May 2021, Peter Wang wrote:
>>

>>> -coerce_clobbered.m:021:   mode error: `X' has instantiatedness `clobbered',
>>> -coerce_clobbered.m:021:   but it must be ground.
>>> +coerce_clobbered.m:021:   mode error: the input term has instantiatedness
>>> +coerce_clobbered.m:021:   `clobbered', but it must be ground.
>>
>> I would be inclined to use "argument" rather than "input term"  (Or
>> perhaps, "argument term".)
>
> Done.

Looking at one of the revised messages below, I would prefer "argument
term".

>> (If it does change the terminology in the reference manual should be
>> updated too.)
>>
>
> Hmm, it's quite useful to have "input term/inst/type" to contrast with
> "result term/inst/type". I will leave this for a separate change.

Elsewhere in the reference manual, we seem to use argument(s) / result when
dealing with function-like symbols.


>> Also, ground should be quoted there.
>>
>
> It needs to be a ground inst, but not necessarily `ground'.

Ok, then:

     but it must have a ground inst.

>>> +coerce_int.m:032:   mode error: in the input term:
>>> +coerce_int.m:032:   in the argument of function symbol `wrap':
>>> +coerce_int.m:032:   the subterm has instantiatedness `bound(1 ; 2)', which is
>>> +coerce_int.m:032:   invalid for the type `uint'.
>>
>> The problem there is that the new message does not make it clear
>> that 'wrap' is part of the input term's inst.  Perhaps:
>>
>>
>>      mode error: in the instantiatedness of the input term:
>>          ...
>
> I have tweaked it a bit. It now says:
>
>    coerce_int.m:032:   in coerce expression:
>    coerce_int.m:032:   mode error: in the argument:
>    coerce_int.m:032:   in the argument of function symbol `wrap':
>    coerce_int.m:032:   the instantiatedness of the subterm `bound(1 ; 2)' is
>    coerce_int.m:032:   invalid for the type of the subterm `uint'.

Give we are addressing the symptom here, rather than the cause I think
that's fine (or at least I cannot think of anything better).

>>> coerce_mode_error.m:064: In clause for `bad_from_list_to_least2(in, out)':
>>> coerce_mode_error.m:064:   in coerce:
>>> -coerce_mode_error.m:064:   mode error: the input term has instantiatedness
>>> -coerce_mode_error.m:064:   `bound('[|]'(ground, ground))',
>>> -coerce_mode_error.m:064:   and cannot be converted to the type
>>> -coerce_mode_error.m:064:   `coerce_mode_error.least2(V_1)'.
>>> +coerce_mode_error.m:064:   mode error: in the input term:
>>> +coerce_mode_error.m:064:   in argument 2 of function symbol `'[|]'':
>>
>>      in the second argument of the function symbol
>>
>
> Ok, done. I do think the numbers were easier to read, at least when you
> have a series of "argument N in foo" stacked up.
>
>> Everywhere else you use:
>>
>> (Use nth_fixed from error_util.)
>>
>> And anywhere else you use the "argument N" form.
>>
>
> I didn't understand what you meant by this.

I just meant anywhere you used the form "in argument 1 of" etc,
use "in in the first argument of" etc instead.

Julien.


More information about the reviews mailing list