[m-rev.] for post-commit review: specific diagnostics for numeric ops

Julien Fischer jfischer at opturion.com
Sun Nov 2 17:16:55 AEDT 2025


On Sun, 2 Nov 2025 at 16:16, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:

> Specialize diagnostics for numeric operations.
>
> compiler/typecheck_error_undef.m:
>     When users try to use arithmetic operations, bitwise operations,
>     or comparisons (meaning functions such as '+' or '<<', or predicates
>     such as '<') without importing any of the modules that define those ops,
>     generate a diagnostic that explains this specific situation. Mercury
>     is unusual in requiring such imports, so novices need to have this
>     pointed out to them. Have these messages replace the less-specific
>     messages we used to generate in such situations.
>
>     Fix a persistent typo.
>
> tests/invalid/int_ops.{m,err_exp}:
>     A new test case for the new diagnostics.
>
> tests/invalid/Mmakefile:
>     Enable the new test case.
>
> tests/invalid/multiply_star.err_exp:
>     Expect the diagnostic text, and stop expecting the "did you mean"
>     message that it replaces.
>
> tests/invalid/multiply_star.err_exp[23]:
>     Delete these files. They existed only because different sets of imports
>     with different options yielded different "did you mean" suggestions,
>     and we don't have those anymore.

You may want to include rational in your lists of numeric modules, since
it is also numeric and provides many of the operations in question.

That looks fine otherwise.

Julien.


More information about the reviews mailing list