[m-rev.] for review: structured types in error messages
Zoltan Somogyi
zoltan.somogyi at runbox.com
Mon Feb 21 15:40:45 AEDT 2022
2022-02-21 15:34 GMT+11:00 "Peter Wang" <novalazy at gmail.com>:
> I don't understand the relevance of function declarations here.
> The type of max_one_line_type_length would have to be written
> in a Mercury source file as:
>
> (func) = int
>
> e.g.
>
> :- func max_one_line_type_length `with_type` ((func) = int).
Agreed, but that is what I meant by ((func) = int) being
inside another type, which in this case is the whole line.
> I think error messages should (as far as possible) print types
> in the same way they would be written in Mercury code.
Agreed; the question is: the same way they would be written
in Mercury code *where*? Inside another type, or at the top level?
You are arguing for the former, I am for the latter (for when the type
is actually at the top level).
> However, I do see that the current compiler behaves as in your change:
>
> t.m:027: Argument 1 (X) has type `func = int',
> t.m:027: expected type was `int'.
Which is what my diff was based on.
Zoltan.
More information about the reviews
mailing list